X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=testcases%2Fcomplete-run.pl;h=020e2f90b737ab3499be140f58af4c6fb6c95c44;hb=8b55b2c24cff88aebaad1882e93ec49b9c2396af;hp=cb7b5c8c107fb4bb83ff29746afc027b61a4a036;hpb=4412ccbe5a4fad8a4cd594e6f10f937515a4d37c;p=i3%2Fi3 diff --git a/testcases/complete-run.pl b/testcases/complete-run.pl index cb7b5c8c..020e2f90 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, @@ -70,7 +73,9 @@ my @testfiles = @ARGV; my $numtests = scalar @testfiles; # No displays specified, let’s start some Xdummy instances. -@displays = start_xdummy($parallel, $numtests) if @displays == 0; +if (@displays == 0) { + @displays = start_xdummy($parallel, $numtests); +} # 1: create an output directory for this test-run my $outdir = "testsuite-"; @@ -87,7 +92,7 @@ symlink("$outdir", "latest") or die "Could not symlink latest to $outdir"; # 2: keep the connection open so that i3 is not the only client. this prevents # the X server from exiting (Xdummy will restart it, but not quick enough # sometimes) -my @worker; +my @single_worker; for my $display (@displays) { my $screen; my $x = X11::XCB::Connection->new(display => $display); @@ -95,7 +100,7 @@ for my $display (@displays) { die "Could not connect to display $display\n"; } else { # start a TestWorker for each display - push @worker, worker($display, $x, $outdir); + push @single_worker, worker($display, $x, $outdir, \%options); } } @@ -132,13 +137,16 @@ $aggregator->start(); status_init(displays => \@displays, tests => $num); -my $cv = AE::cv; +my $single_cv = AE::cv; # We start tests concurrently: For each display, one test gets started. Every # test starts another test after completing. -for (@worker) { $cv->begin; take_job($_) } +for (@single_worker) { + $single_cv->begin; + take_job($_, $single_cv, \@testfiles); +} -$cv->recv; +$single_cv->recv; $aggregator->stop(); @@ -198,9 +206,9 @@ exit 0; # triggered to finish testing. # sub take_job { - my ($worker) = @_; + my ($worker, $cv, $tests) = @_; - my $test = shift @testfiles + my $test = shift @$tests or return $cv->end; my $display = $worker->{display}; @@ -269,7 +277,7 @@ sub take_job { push @done, [ $test, $output ]; undef $w; - take_job($worker); + take_job($worker, $cv, $tests); } ); }