bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17512: Valgrind and regression tests?


From: Jim Meyering
Subject: bug#17512: Valgrind and regression tests?
Date: Tue, 20 May 2014 22:10:03 -0700

On Fri, May 16, 2014 at 5:35 PM, Paul Eggert <address@hidden> wrote:
> behoffski wrote:
>>
>>    1. Use a shell alias:
>>
>>         grep="valgrind --log-file=foo grep" make check
>
>
> That won't work, as too many parts of the system ignore the aliases.
>
>
>>    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.
>
>
> Yes, something like that should work.  You can set up your own
> implementation of grep, like this:
>
> #! /bin/sh
> exec valgrind --log-file=foo /full/path/to/actual/grep "$@"
>
> in a shell script called 'grep', in a different directory, and prepand that
> directory to your PATH.
>
> Perhaps Jim has a better way to do it, though -- he's more of a valgrind
> wizard than I.

I use a script to replace each binary with this generated script:

#!/bin/sh
saved_binaries_dir="${0%/*}/.vg-tmp"
export PATH=$saved_binaries_dir:$PATH
prog=${0##*/}
# Disable this: http://udrepper.livejournal.com/11429.html
MALLOC_PERTURB_=0
export MALLOC_PERTURB_
exec /usr/bin/valgrind -v --suppressions=/dev/null \
  --log-file=/tmp/vg-log-2014-05-20.22:05:28-%q{GREP_TEST_NAME} \
  --leak-check=full --track-fds=yes --num-callers=15 -- "$prog" "$@"

which refers to the original binary via a subdirectory named .vg-tmp
relative to the original location of the binary. That script also moves
each binary into the .vg-tmp subdir.

Then, running "make check" creates many /tmp/vg-log-* files,
each related to the name of a test.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]