Re: Allowing to run a buildfarm animal under valgrind

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Allowing to run a buildfarm animal under valgrind
Date: 2016-03-08 13:58:22
Message-ID: 56DEDA7E.3050406@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 03/07/2016 08:39 PM, Andres Freund wrote:
> 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?
>

Why not just create a make target which does this? It could be run after
'make' and before 'make check'. I would make it assume valgrind was
installed and in the path rather than using vg-in-place.

If that doesn't work and you want to do something with the buildfarm,
probably a buildfarm module would be the way to go. We might need to add
a new module hook to support it, to run right after make(), but that
would be a one line addition to run_build.pl.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-03-08 13:59:04 Re: Freeze avoidance of very large table.
Previous Message Robert Haas 2016-03-08 13:54:28 Re: Splitting lengthy sgml files