Skip to content

Commit 85a8cb4

Browse files
committed
build: Don't write valgrind log files to tmp/ directory
Inherited from libguestfs, we wrote valgrind log files into the tmp/ directory during tests. However this makes it very difficult to connect a particular log file to a particular failing test. As with nbdkit let's just write the valgrind output to stderr, where it will end up in the test log file (ie. tests/test-suite.log or tests/*.log). Cherry picked from virt-v2v commit 1e0d615a883e4056b757d041a1ad1bbd39df3b3c. I did not include the extra changes to the valgrind command line (especially --show-leak-kinds=all) since that complicates the output.
1 parent 2011037 commit 85a8cb4

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

m4/guestfs-progs.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ AS_IF([test "x$VALGRIND" != "xno"],[
8585
# --read-inline-info=no is a temporary workaround for RHBZ#1662656.
8686
# Note we run libtool, not $(LIBTOOL) since the latter expands to
8787
# libtool-kill-dependency-libs.sh
88-
VG='libtool --mode=execute $(VALGRIND) --vgdb=no --log-file=$(abs_top_builddir)/tmp/valgrind-%q{T}-%p.log --leak-check=full --error-exitcode=119 --suppressions=$(abs_top_srcdir)/valgrind-suppressions --trace-children=no --child-silent-after-fork=yes --run-libc-freeres=no --read-inline-info=no'
88+
VG='libtool --mode=execute $(VALGRIND) --vgdb=no --leak-check=full --error-exitcode=119 --suppressions=$(abs_top_srcdir)/valgrind-suppressions --trace-children=no --child-silent-after-fork=yes --run-libc-freeres=no --read-inline-info=no'
8989
],[
9090
# No valgrind, so substitute VG with something that will break.
9191
VG=VALGRIND_IS_NOT_INSTALLED

run.in

+8-9
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ prepend()
5757
s="$(cd @abs_srcdir@ && pwd)"
5858
b="$(cd @abs_builddir@ && pwd)"
5959

60-
# Set T to current date & time (mainly for valgrind logfile name).
61-
T=`date +%Y%m%d.%H.%M.%S`
62-
export T
63-
6460
# Set tmpdir and cachedir so the appliance doesn't conflict with
6561
# globally installed libguestfs.
6662
#
@@ -101,11 +97,14 @@ if [ -z "$VIRT_BUILDER_DIRS" ]; then
10197
fi
10298

10399
# This is a cheap way to find some use-after-free and uninitialized
104-
# read problems when using glibc.
105-
random_val="$(@AWK@ 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)"
106-
LD_PRELOAD="${LD_PRELOAD:+"$LD_PRELOAD:"}libc_malloc_debug.so.0"
107-
GLIBC_TUNABLES=glibc.malloc.check=1:glibc.malloc.perturb=$random_val
108-
export LD_PRELOAD GLIBC_TUNABLES
100+
# read problems when using glibc. But if we are valgrinding then
101+
# don't use this because it can stop valgrind from working.
102+
if [ -z "$VG" ]; then
103+
random_val="$(@AWK@ 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null)"
104+
LD_PRELOAD="${LD_PRELOAD:+"$LD_PRELOAD:"}libc_malloc_debug.so.0"
105+
GLIBC_TUNABLES=glibc.malloc.check=1:glibc.malloc.perturb=$random_val
106+
export LD_PRELOAD GLIBC_TUNABLES
107+
fi
109108

110109
# Do we have libtool? If we have it then we can use it to make
111110
# running valgrind simpler. However don't depend on it.

tmp/.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33
/libguestfs??????/
44
/run-*
55
/v2vovl*.qcow2
6-
/valgrind-*.log

0 commit comments

Comments
 (0)