testing: use absolute path for valgrind log file

Better assume that the program may change directories. In that
case we need an absolute path for the output file.

Nightly testing failed once because valgrind was not able to
write its output file in the new directory. It remained unclear
why the directory was changed and to what, though. But that is
a different problem.
This commit is contained in:
Patrick Ohly 2014-03-31 01:54:20 -07:00
parent f33db08c43
commit 5fd70f38e7

View file

@ -14,9 +14,16 @@
# with valgrind.<pid of shell>.<current process>.out as default.
LOGPARAM=${VALGRIND_LOG:-valgrind.p$$.c%p.out}
# more than one file might get written
LOGFILES=${VALGRIND_LOG:-valgrind.p$$.*.out}
if [ "$VALGRIND_LOG" ]; then
LOGPARAM=$VALGRIND_LOG
LOGFILES=$VALGRIND_LOG
CUSTOM_LOGPARAM=yes
else
LOGPARAM=$(pwd)/valgrind.p$$.c%p.out
# More than one file might get written, use wildcard.
LOGFILES=$(pwd)/valgrind.p$$.*.out
CUSTOM_LOGPARAM=no
fi
trap "cat $LOGFILES >&2 2>/dev/null; rm -f $LOGFILES" EXIT
@ -27,7 +34,7 @@ trap "cat $LOGFILES >&2 2>/dev/null; rm -f $LOGFILES" EXIT
# kill all valgrind processes, because there might be other, longer
# running processes that need to continue.
valgrindProcesses () {
if [ $LOGPARAM = "valgrind.p$$.c%p.out" ]; then
if [ $CUSTOM_LOGPARAM = "no" ]; then
for file in $LOGFILES; do
pid=`echo $file | perl -p -e 's/.*valgrind\.p\d+\.c(\d+).*/$1/'`
echo $pid