diff --git a/testcases/complete-run.pl b/testcases/complete-run.pl index 3475a45c..15def35c 100755 --- a/testcases/complete-run.pl +++ b/testcases/complete-run.pl @@ -37,20 +37,23 @@ my $log; sub Log { say $log "@_" } my %timings; -my $coverage_testing = 0; -my $valgrind = 0; -my $strace = 0; my $help = 0; # Number of tests to run in parallel. Important to know how many Xdummy # instances we need to start (unless @displays are given). Defaults to # num_cores * 2. my $parallel = undef; my @displays = (); +my %options = ( + valgrind => 0, + strace => 0, + coverage => 0, + restart => 0, +); my $result = GetOptions( - "coverage-testing" => \$coverage_testing, - "valgrind" => \$valgrind, - "strace" => \$strace, + "coverage-testing" => \$options{coverage}, + "valgrind" => \$options{valgrind}, + "strace" => \$options{strace}, "display=s" => \@displays, "parallel=i" => \$parallel, "help|?" => \$help, @@ -104,7 +107,7 @@ for my $display (@displays) { die "Could not connect to display $display\n"; } else { # start a TestWorker for each display - push @single_worker, worker($display, $x, $outdir); + push @single_worker, worker($display, $x, $outdir, \%options); } } @@ -114,7 +117,7 @@ if (defined($multidpy)) { if ($x->has_error) { die "Could not connect to multi-monitor display $multidpy\n"; } else { - push @multi_worker, worker($multidpy, $x, $outdir); + push @multi_worker, worker($multidpy, $x, $outdir, \%options); } } diff --git a/testcases/lib/TestWorker.pm b/testcases/lib/TestWorker.pm index dcb39ebc..66f22bc0 100644 --- a/testcases/lib/TestWorker.pm +++ b/testcases/lib/TestWorker.pm @@ -13,13 +13,17 @@ our @EXPORT = qw(worker worker_next); use File::Basename qw(basename); my @x; +my $options; sub worker { - my ($display, $x, $outdir) = @_; + my ($display, $x, $outdir, $optref) = @_; # make sure $x hangs around push @x, $x; + # store the options hashref + $options = $optref; + socketpair(my $ipc_child, my $ipc, AF_UNIX, SOCK_DGRAM, PF_UNSPEC) or die "socketpair: $!"; @@ -102,7 +106,13 @@ sub worker_wait { $test->todo_output(\*STDOUT); @ENV{qw(DISPLAY TESTNAME OUTDIR VALGRIND STRACE COVERAGE RESTART)} - = ($self->{display}, basename($file), $outdir, 0, 0, 0, 0); + = ($self->{display}, + basename($file), + $outdir, + $options->{valgrind}, + $options->{strace}, + $options->{coverage}, + $options->{restart}); package main; local $@;