From 53c1a7e46091ef337dea64f1e8695d8ce779d476 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 31 Jul 2021 10:08:56 +0300 Subject: test: sleep for a second before running docgen Sponsored-by: author --- check | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/check b/check index c0f26fb..1220ad8 100755 --- a/check +++ b/check @@ -4,6 +4,7 @@ import argparse import glob import os import sys +import time from subprocess import PIPE, DEVNULL, STDOUT @@ -121,6 +122,20 @@ class Runcmd: def docgen(self, md, output, **kwargs): """Run the Subplot document generator""" + + # GitLab CI, and other CI engines, runs tests under Docker, which uses + # an overlay file system, which at least sometimes only has full-second + # time stamps in file meta data, and sometimes that seems to happen + # when the kernel needs to flush its inode cache, and so it's not very + # deterministic. This leads to occasional test failures. To prevent + # such flaky tests, we wait for a second to make sure the time stamp of + # the output will be newer than the input has. + # + # This is an ugly kluge. It would be possible to check if the sleep is + # needed, but that kind of code is going to be tricky. Best avoid + # tricky code in test suites. Test code should be obviously correct. + time.sleep(1) + self.cargo( [ "run", -- cgit v1.2.1