Subject: Re: bug#17512: Valgrind/regression tests: Symlink test hang

From: behoffski <[email-masked]>
Date: Fri, 23 May 2014 17:58:30 +0930

On 05/21/14 14:40, Jim Meyering wrote:
> On Fri, May 16, 2014 at 5:35 PM, Paul Eggert <[email-masked]> wrote:
>>
>> [...] 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.
>

G'day Jim and Paul,

Thanks for the feedback.  I found that Jim's script worked in a similar
fashion to the home-brew script I tried, although I didn't know that
the test name was available as an environment variable, and so my
script ended up creating one massive log file.

One glitch that appears in both my script and in the one given by Jim:
The "symlink" test hangs, consuming 0% CPU, when run under Valgrind.
I ended up replacing the test with an "exit 0" script just for the sake
of getting a fast sweep across the majority of the test rig.

I haven't tried to hunt down the reason for this hang; I'm currently
on a Gentoo Link machine, with GCC and Valgrind versions:

         gcc (Gentoo 4.7.3-r1 p1.4, pie-0.5.5) 4.7.3
         Copyright (C) 2012 Free Software Foundation, Inc.
         This is free software; see the source for copying conditions.  There is NO
         warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

         valgrind-3.8.1

While there's some 4.8-series GCC versions available (but masked
for my architecture at present), that include valgrind-related
goodies such as "-Og" and "-fsanitize=address", I'm choosing a more
conservative version at present.  There's also masked versions
of Valgrind available (3.8.1-r1, 3.9.0), but again I'm being conservative
at present.

I'll wait for grep-2.20 to appear, and then will investigate whether
upgrading various tools can resolve this hang, and will report
back to the list.

cheers,

behoffski (Brenton Hoff)
Programmer, Grouse Software

ps. Congratulations to everybody on the completion of grep-2.19.