Subject: bug#17512: Valgrind and regression tests?

From: behoffski <[email-masked]>
Date: Sat, 17 May 2014 05:44:13 +0930

G'day,

I would like to run the entire regression test for Grep (make check),
with Valgrind monitoring each invocation of grep etc, but with the
output going to a separate logfile.  (I have run valgrind for a few
cases, but have not covered the entire spectrum of the regression
test rig.)

The file grep/README-hacking recommends using valgrind, and also
suggests that hackers look at the file "README-valgrind", but no such
file exists.

I note that Valgrind sends its output to stderr by default, and that
the option --log-file=<filename> exists to redirect Valgrind output
elsewhere.  This would be needed in the case of grep et al, as stderr
is used in various ways by the programs.

Is there a simple way of incorporating valgrind into the entire
regression test run?  Two simple ideas come to mind, but I'm not
well versed in the POSIX/shell/makefile/Autoconf/regression rig setup
to know how realistic these are:

   1. Use a shell alias:

        grep="valgrind --log-file=foo grep" make check

   2. Replace grep/egrep/fgrep as appropriate to execute the program
      within a shell, where valgrind plus any options is incorporated
      into the program invocation and the logfile is treated
      appropriately in the program invocation aftermath.

Any hints, help, suggestions etc would be welcome.

cheers,

behoffski (Brenton Hoff)
Programmer, Grouse Software