complete-run: implement --strace, make --valgrind log to test-specific file

This commit is contained in:
Michael Stapelberg
2011-11-15 23:30:17 +00:00
parent 5b4f8eb7e2
commit 77a9e4b18f
3 changed files with 31 additions and 7 deletions

View File

@ -75,16 +75,31 @@ sub activate_i3 {
# the interactive signalhandler to make it crash immediately instead.
my $i3cmd = abs_path("../i3") . " -V -d all --disable-signalhandler";
# For convenience:
my $outdir = $args{outdir};
my $test = $args{testname};
if ($args{valgrind}) {
$i3cmd =
qq|valgrind -v --log-file="$args{outdir}/valgrind.log" | .
qq|valgrind -v --log-file="$outdir/valgrind-for-$test.log" | .
qq|--leak-check=full --track-origins=yes --num-callers=20 | .
qq|--tool=memcheck -- $i3cmd|;
}
# Append to $args{logpath} instead of overwriting because i3 might be
my $logfile = "$outdir/i3-log-for-$test";
# Append to $logfile instead of overwriting because i3 might be
# run multiple times in one testcase.
my $cmd = "exec $i3cmd -c $args{configfile} >>$args{logpath} 2>&1";
my $cmd = "exec $i3cmd -c $args{configfile} >>$logfile 2>&1";
if ($args{strace}) {
my $out = "$outdir/strace-for-$test.log";
# We overwrite LISTEN_PID with the correct process ID to make
# socket activation work (LISTEN_PID has to match getpid(),
# otherwise the LISTEN_FDS will be treated as a left-over).
$cmd = qq|strace -fF -s2048 -v -o "$out" -- | .
'sh -c "export LISTEN_PID=\$\$; ' . $cmd . '"';
}
# We need to use the shell due to using output redirections.
exec '/bin/sh', '-c', $cmd;

View File

@ -434,8 +434,9 @@ sub launch_with_config {
display => $ENV{DISPLAY},
configfile => $tmpfile,
outdir => $ENV{OUTDIR},
logpath => $ENV{LOGPATH},
testname => $ENV{TESTNAME},
valgrind => $ENV{VALGRIND},
strace => $ENV{STRACE},
cv => $cv,
);