From bed5c9e03a2c3e36e8d7e51ae24293d132a4f2c1 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 10 Sep 2017 19:41:49 +0200 Subject: [PATCH 1/3] tests: re-seed random number generator in workers --- testcases/lib/TestWorker.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testcases/lib/TestWorker.pm b/testcases/lib/TestWorker.pm index aee994f7..c56767c4 100644 --- a/testcases/lib/TestWorker.pm +++ b/testcases/lib/TestWorker.pm @@ -99,6 +99,11 @@ sub worker_wait { $0 = $file; + # Re-seed rand() so that File::Temp’s tempnam produces different + # results, making a TOCTOU between e.g. t/175-startup-notification.t + # and t/180-fd-leaks.t less likely. + srand(time ^ $$); + POSIX::dup2($ipc_fd, 0); POSIX::dup2($ipc_fd, 1); POSIX::dup2(1, 2); From 06e8f75d529e821690a816053268f76dd05b30a8 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 10 Sep 2017 20:06:49 +0200 Subject: [PATCH 2/3] tests: unflake t/263-edge-borders.t --- testcases/t/263-edge-borders.t | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testcases/t/263-edge-borders.t b/testcases/t/263-edge-borders.t index 0d14c65c..6da1dacd 100644 --- a/testcases/t/263-edge-borders.t +++ b/testcases/t/263-edge-borders.t @@ -147,6 +147,10 @@ ok(@{get_ws_content($tmp)} == 2, 'after split & new window, two containers'); $wscontent = get_ws($tmp); +# Ensure i3’s X11 requests are processed before our inquiry via +# $tilewindow->rect: +sync_with_i3; + @tiled = @{$wscontent->{nodes}}; ok(@tiled == 2, 'two tiled container opened in another container'); is($tiled[0]->{current_border_width}, -1, 'first tiled current border width set to -1'); From 1c94d189c3acb57b2e374375938cd813aba68fa6 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 10 Sep 2017 20:05:55 +0200 Subject: [PATCH 3/3] tests: run 533-randr15.t at the very end The test runs `xrandr setmonitor`, which will otherwise affect any test scheduled after 533-randr15.t, causing flakyness in t/217-NET_CURRENT_DESKTOP.t for example. --- testcases/complete-run.pl.in | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/testcases/complete-run.pl.in b/testcases/complete-run.pl.in index ba192469..ddd6ccad 100755 --- a/testcases/complete-run.pl.in +++ b/testcases/complete-run.pl.in @@ -177,11 +177,18 @@ my $timingsjson = slurp('.last_run_timings.json') if -e '.last_run_timings.json' map { [$_, $timings{$_} // 999] } @testfiles; # Run 000-load-deps.t first to bail out early when dependencies are missing. -my $loadtest = "t/000-load-deps.t"; -if ((scalar grep { $_ eq $loadtest } @testfiles) > 0) { +my ($loadtest) = grep { $_ =~ m,t/000-load-deps.t$, } @testfiles; +if (defined($loadtest)) { @testfiles = ($loadtest, grep { $_ ne $loadtest } @testfiles); } +# Run 533-randr15.t last because it destructively modifies the RandR +# configuration of the X session, interfering with any test started afterwards. +my ($randrtest) = grep { $_ =~ m,t/533-randr15.t$, } @testfiles; +if (defined($randrtest)) { + @testfiles = ((grep { $_ ne $randrtest } @testfiles), $randrtest); +} + printf("\nRough time estimate for this run: %.2f seconds\n\n", $timings{GLOBAL}) if exists($timings{GLOBAL});