git » summer » commit 1be10f1

test: Add mini-sleeps before changing files

author Alberto Bertogli
2023-08-05 01:00:06 UTC
committer Alberto Bertogli
2023-08-19 11:18:52 UTC
parent 8f1304d6dc13fe2b3b5e6a9c475e79e40bca14a0

test: Add mini-sleeps before changing files

On fast systems, the resolution of the filesystem mtimes may not be high
enough to distinguish between two file editions, even with summer runs
in between.

This causes tests to be flaky with false positives.

To fix this, we introduce very brief sleeps between changing files, just
long enough to ensure the mtime will have changed (on a reasonably modern
filesystem, under normal conditions).

test/basic.t +1 -0
test/dryrun_sqlite.t +1 -0
test/dryrun_xattr.t +1 -0

diff --git a/test/basic.t b/test/basic.t
index 0adf197..57aec88 100644
--- a/test/basic.t
+++ b/test/basic.t
@@ -17,6 +17,7 @@ Generate and verify.
 
 Check handling of new and updated files.
 
+  $ sleep 0.005
   $ echo trova > nueva
   $ touch empty
   $ summer verify .
diff --git a/test/dryrun_sqlite.t b/test/dryrun_sqlite.t
index c563f9c..d03f538 100644
--- a/test/dryrun_sqlite.t
+++ b/test/dryrun_sqlite.t
@@ -25,6 +25,7 @@ Now write data for real, so we can test modification.
 
 Check handling of new and updated files.
 
+  $ sleep 0.005
   $ echo trova > nueva
   $ touch empty
   $ summer -n -db=db.sqlite3 verify .
diff --git a/test/dryrun_xattr.t b/test/dryrun_xattr.t
index 99195ef..5b688e8 100644
--- a/test/dryrun_xattr.t
+++ b/test/dryrun_xattr.t
@@ -25,6 +25,7 @@ Now write data for real, so we can test modification.
 
 Check handling of new and updated files.
 
+  $ sleep 0.005
   $ echo trova > nueva
   $ touch empty
   $ summer -n verify .