}
my $coverage_testing = 0;
+my $valgrind = 0;
my @displays = ();
my $result = GetOptions(
"coverage-testing" => \$coverage_testing,
+ "valgrind" => \$valgrind,
"display=s" => \@displays,
);
configfile => $tmpfile,
outdir => $outdir,
logpath => $logpath,
+ valgrind => $valgrind,
cv => $activate_cv
);
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,
});
# 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";