custom postgres launcher for tests - Mailing list pgsql-hackers

From Ivan Taranov
Subject custom postgres launcher for tests
Date
Msg-id CAKqLMA8V-ktRznYapXD=f903AX1A9+hqz8mf=ky3jufMG8Vd-g@mail.gmail.com
Whole thread Raw
Responses Re: custom postgres launcher for tests
List pgsql-hackers
This patch allow to use custom postgres launcher for tests (tap&regress)
by setting  environment variable PGLAUNCHER.

Other known methods (like: https://wiki.postgresql.org/wiki/Valgrind) requires
to perform installation, build system modifications, executable replacement etc...

And proposed way is simpler and more flexible.


** Use-case: run checks under Valgrind


- prepare launcher

    echo 'exec valgrind postgres "$@"' > /tmp/pgvalgrind
    chmod +x /tmp/pgvalgrind

- execute regress tests under Valgrind

    PGLAUNCHER=/tmp/pgvalgrind TESTS=gin make check-tests

- execute concrete tap-test under Valgrind

    PGLAUNCHER=/tmp/pgvalgrind PROVE_TESTS=t/001_stream_rep.pl make \
        check -C src/test/recovery


** Use-case: execute tests with different postgres versions


- prepare multi-launcher

    cat <<EOF > /tmp/launcher
    cp -f `pwd`/src/backend/postgres.v*  \`pg_config --bindir\`
    exec postgres.v\$V "\$@"
    EOF
    chmod +x /tmp/launcher

- make some versions of postgres binary

    ./configure "CFLAGS=..." && make
    mv src/backend/postgres src/backend/postgres.v1

    ./configure "CFLAGS=..." && make
    mv src/backend/postgres src/backend/postgres.v2

- run checks with different postgres binaries

    PGLAUNCHER=/tmp/launcher V=1  make check -C contrib/bloom
    PGLAUNCHER=/tmp/launcher V=2  make check -C contrib/bloom
Attachment

pgsql-hackers by date:

Previous
From: ROS Didier
Date:
Subject: open-source equivalent of golden-gate
Next
From: Andy Fan
Date:
Subject: Re: [PATCH] Erase the distinctClause if the result is unique by definition