From 1c94d189c3acb57b2e374375938cd813aba68fa6 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <michael@stapelberg.de>
Date: Sun, 10 Sep 2017 20:05:55 +0200
Subject: [PATCH] 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});