complete-run: implement --valgrind

This commit is contained in:
Michael Stapelberg 2011-11-07 20:53:49 +00:00
parent 389fdcf79f
commit 1c0d69d4e6
3 changed files with 12 additions and 1 deletions

View File

@ -50,10 +50,12 @@ sub slurp {
} }
my $coverage_testing = 0; my $coverage_testing = 0;
my $valgrind = 0;
my @displays = (); my @displays = ();
my $result = GetOptions( my $result = GetOptions(
"coverage-testing" => \$coverage_testing, "coverage-testing" => \$coverage_testing,
"valgrind" => \$valgrind,
"display=s" => \@displays, "display=s" => \@displays,
); );
@ -143,6 +145,7 @@ sub take_job {
configfile => $tmpfile, configfile => $tmpfile,
outdir => $outdir, outdir => $outdir,
logpath => $logpath, logpath => $logpath,
valgrind => $valgrind,
cv => $activate_cv cv => $activate_cv
); );
@ -190,7 +193,7 @@ sub take_job {
my $output; my $output;
open(my $spool, '>', \$output); open(my $spool, '>', \$output);
my $parser = TAP::Parser->new({ my $parser = TAP::Parser->new({
exec => [ 'sh', '-c', qq|DISPLAY=$display LOGPATH="$logpath" OUTDIR="$outdir" /usr/bin/perl -Ilib $test| ], exec => [ 'sh', '-c', qq|DISPLAY=$display LOGPATH="$logpath" OUTDIR="$outdir" VALGRIND=$valgrind /usr/bin/perl -Ilib $test| ],
spool => $spool, spool => $spool,
merge => 1, merge => 1,
}); });

View File

@ -78,6 +78,13 @@ sub activate_i3 {
# the interactive signalhandler to make it crash immediately instead. # the interactive signalhandler to make it crash immediately instead.
my $i3cmd = abs_path("../i3") . " -V -d all --disable-signalhandler"; my $i3cmd = abs_path("../i3") . " -V -d all --disable-signalhandler";
if ($args{valgrind}) {
$i3cmd =
qq|valgrind -v --log-file="$args{outdir}/valgrind.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 # Append to $args{logpath} instead of overwriting because i3 might be
# run multiple times in one testcase. # run multiple times in one testcase.
my $cmd = "exec $i3cmd -c $args{configfile} >>$args{logpath} 2>&1"; my $cmd = "exec $i3cmd -c $args{configfile} >>$args{logpath} 2>&1";

View File

@ -435,6 +435,7 @@ sub launch_with_config {
configfile => $tmpfile, configfile => $tmpfile,
outdir => $ENV{OUTDIR}, outdir => $ENV{OUTDIR},
logpath => $ENV{LOGPATH}, logpath => $ENV{LOGPATH},
valgrind => $ENV{VALGRIND},
cv => $cv, cv => $cv,
); );