Re: how to use valgrind for TAP tests - Mailing list pgsql-hackers

From Tom Lane
Subject Re: how to use valgrind for TAP tests
Date
Msg-id 159904.1608307376@sss.pgh.pa.us
Whole thread Raw
In response to how to use valgrind for TAP tests  ("osumi.takamichi@fujitsu.com" <osumi.takamichi@fujitsu.com>)
Responses Re: how to use valgrind for TAP tests
RE: how to use valgrind for TAP tests
List pgsql-hackers
"osumi.takamichi@fujitsu.com" <osumi.takamichi@fujitsu.com> writes:
> I have a question about how to execute valgrind with TAP tests
> in order to check some patches in the community.
> My main interest is testing src/test/subscription now but
> is there any general way to do it ?

The standard solution is

(1) Build normally (well, with -DUSE_VALGRIND)
(2) Move the postgres executable aside, say
    mv src/backend/postgres src/backend/postgres.orig
(3) Replace the executable with a wrapper script that invokes
    valgrind on the original executable
(4) Now you can run "make check" with a valgrind'ed server,
    as well as things that depend on "make check", such as TAP tests

The script I use for (3) is attached; adjust paths and options to taste.

            regards, tom lane

#!/bin/sh

# Use this script as a wrapper to run PG under valgrind in "make check"
# scenarios.  Rename the built postgres executable to postgres.orig
# and then copy this script to $PGBLDROOT/src/backend/postgres.

# Note: a disadvantage of this approach is that the backend will see
# $PGBLDROOT/src/backend/ as its my_exec_path, hence will not pick up
# anything in the temp install dir, but will go to the configured install
# dir.  Must "make install" extensions and other stuff to work properly.

exec valgrind \
    --quiet \
    --suppressions=$PGSRCROOT/src/tools/valgrind.supp \
    --suppressions=$HOME/misc/my-valgrind.supp \
    --time-stamp=yes --error-exitcode=128 --trace-children=yes \
    --log-file=$HOME/valgrind-logs/%p.log $PMVALGRIND \
    $PGBLDROOT/src/backend/postgres.orig "$@"

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Refactoring HMAC in the core code
Next
From: James Coleman
Date:
Subject: Re: [DOC] Document concurrent index builds waiting on each other