From 1c0d69d4e62c71c09607b70ad2a4be2e05e1cbab Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 7 Nov 2011 20:53:49 +0000 Subject: [PATCH] complete-run: implement --valgrind --- testcases/complete-run.pl | 5 ++++- testcases/lib/SocketActivation.pm | 7 +++++++ testcases/lib/i3test.pm | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/testcases/complete-run.pl b/testcases/complete-run.pl index 939ee636..a66b0982 100755 --- a/testcases/complete-run.pl +++ b/testcases/complete-run.pl @@ -50,10 +50,12 @@ sub slurp { } my $coverage_testing = 0; +my $valgrind = 0; my @displays = (); my $result = GetOptions( "coverage-testing" => \$coverage_testing, + "valgrind" => \$valgrind, "display=s" => \@displays, ); @@ -143,6 +145,7 @@ sub take_job { configfile => $tmpfile, outdir => $outdir, logpath => $logpath, + valgrind => $valgrind, cv => $activate_cv ); @@ -190,7 +193,7 @@ sub take_job { my $output; open(my $spool, '>', \$output); 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, merge => 1, }); diff --git a/testcases/lib/SocketActivation.pm b/testcases/lib/SocketActivation.pm index 1ecfb2aa..4da2029c 100644 --- a/testcases/lib/SocketActivation.pm +++ b/testcases/lib/SocketActivation.pm @@ -78,6 +78,13 @@ sub activate_i3 { # the interactive signalhandler to make it crash immediately instead. 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 # run multiple times in one testcase. my $cmd = "exec $i3cmd -c $args{configfile} >>$args{logpath} 2>&1"; diff --git a/testcases/lib/i3test.pm b/testcases/lib/i3test.pm index 563837df..7473b617 100644 --- a/testcases/lib/i3test.pm +++ b/testcases/lib/i3test.pm @@ -435,6 +435,7 @@ sub launch_with_config { configfile => $tmpfile, outdir => $ENV{OUTDIR}, logpath => $ENV{LOGPATH}, + valgrind => $ENV{VALGRIND}, cv => $cv, ); -- 2.39.5