Build

It's recommended that you build both PostgreSQL and PGroonga with debug options.

It's better that you build Groonga with debug options (Groonga's configure provides --enable-debug option) too. If you use packaged Groonga, you need to install development package. It's libgroonga-dev for Debian family distribution and groonga-devel for Red Hat family distribution.

You need to install token_fitlers/stem Groonga plugin to run all tests. You can install it by groonga-token-filter-stem package.

How to build PostgreSQL

Download source from the PostgreSQL site. Here are command lines to download the source of PostgreSQL 14.0 and extract it:

% wget https://ftp.postgresql.org/pub/source/v14.0/postgresql-14.0.tar.bz2
% tar xf postgresql-14.0.tar.bz2
% cd postgresql-14.0

Run configure with CFLAGS="-O0 -g3" argument. It enables debug build. --prefix=/tmp/local is optional:

% ./configure CFLAGS="-O0 -g3" --prefix=/tmp/local

Build and install PostgreSQL:

% make -j$(nproc) > /dev/null
% make install > /dev/null

Initialize and run PostgreSQL:

% mkdir -p /tmp/local/var/lib
% /tmp/local/bin/initdb --locale C --encoding UTF-8 -D /tmp/local/var/lib/postgresql
% /tmp/local/bin/postgres -D /tmp/local/var/lib/postgresql

The following one liner is useful to reset all PostgreSQL related data. You store the one liner in your shell history, you can rerun the one linear quickly:

% rm -rf /tmp/local/var/lib/postgresql && \
    mkdir -p /tmp/local/var/lib/postgresql &&
    /tmp/local/bin/initdb \
      --locale C \
      --encoding UTF-8 \
      -D /tmp/local/var/lib/postgresql && \
   /tmp/local/bin/postgres -D /tmp/local/var/lib/postgresql

How to build and test PGroonga

It's recommended that you use the latest PGroonga instead of released PGroonga. Here are command lines to clone the latest PGroonga source:

% git clone --recursive git@github.com:pgroonga/pgroonga.git
% cd pgroonga

PGroonga has two test types:

Normally, you only use the former. test/run-sql-test.sh is the test runner for the former. It builds and installs PGroonga and runs SQL based regression tests. PATH=/tmp/local/bin:$PATH is needed because PostgreSQL is built with --prefix=/tmp/local. pg_config exists in /tmp/local/bin:

% PATH=/tmp/local/bin:$PATH test/run-sql-test.sh

See also test.