Hi,
I'm setting up a buildfarm animal that runs under
valgrind. Unfortunately there's not really any good solution to force
make check et al. to start postgres wrapped in valgrind. For now I've
resorted to adding something like
sub replace_postgres
{ my $srcdir=$use_vpath ? "../pgsql/" : "."; my $builddir=abs_path("$pgsql"); $srcdir=abs_path("$pgsql/$srcdir");
chdir "$pgsql/src/backend/"; rename "postgres", "postgres.orig"; sysopen my $fh, "postgres",
O_CREAT|O_TRUNC|O_RDWR,0700 or die "Could not create postgres wrapper"; print $fh <<"END";
#!/bin/bash
~/src/valgrind/vg-in-place \\ --quiet \\ --error-exitcode=128 \\ --suppressions=$srcdir/src/tools/valgrind.supp
\\ --trace-children=yes --track-origins=yes --read-var-info=yes \\ --leak-check=no \\
$builddir/src/backend/postgres.orig\\ "\$@"
END close $fh; chdir $branch_root;
}
to the buildfarm client.
i.e. a script that replaces the postgres binary with a wrapper that
invokes postgres via valgrind.
That's obviously not a very good approach though. It's buildfarm
specific and thus can't be invoked by developers and it doesn't really
support being installed somewhere.
Does anybody have a better idea about how to do this?
Regards,
Andres