Files
gio/cmd/gogio
Daniel Martí f38dbfca54 cmd/gogio: introduce retries with backoff to the e2e tests
Right now, this was badly needed for the wayland subtest, as it seems
like waiting for a frame to be ready wasn't enough for the screenshot to
show what we want. In practice, even if the machine was idle, it could
sometimes take a few extra milliseconds for the app to first appear on
the display.

This was worse when the machine is under stress, which is often the case
with CI. For example, the command below showed a ~20% failure rate on my
laptop with four cores:

	go test -c -o test && stress ./test -test.run EndToEnd/Wayland

Add a generic withRetries helper function, which allows us to keep
trying some action up to a timeout, with sleeps in between that start at
100ms and keep doubling until 2s. The function also logs before each
sleep, in case the user is confused why their test is stuck for
potentially may seconds at once.

Refactor the wantColors function into a separate function that returns
an error, as we can no longer directly report errors via *testing.T. It
still reports all the mismatches at once, which is useful. It can now be
used on to pof withRetries with a thin wrapper.

While at it, make the X11 subtest use withRetries to wait for the X
server to be ready. It was using a simpler method with a fixed number of
static sleeps. It's now more consistent, and a bit better overall.

With the changes above, the 'stress' command from earlier can get past
100 runs on my laptop with no failures at all.

Finally, fix a rogue log.Fatal call I had somehow missed.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
2020-02-10 18:31:53 +01:00
..
2019-12-12 00:48:31 +01:00
2020-01-27 17:34:43 +00:00
2019-09-18 22:46:47 +02:00
2019-09-18 22:46:47 +02:00