Page MenuHomePhabricator

tests: de-flake test-narrow-share.t by making dirstate predictable

Authored by martinvonz on Jan 10 2019, 7:45 PM.



test-narrow-share.t was sometimes (~0.5% on my machine) failing like this:

@@ -61,7 +61,7 @@
   A d3/g
   $ hg -R main debugdirstate --no-dates
   n 644          2 set                 d1/f
-  n 644          2 unset               d3/f
+  n 644          2 set                 d3/f
   a   0         -1 unset               d3/g
   n 644          2 set                 d5/f
   n 644          2 set                 d7/f

The timestamp for d3/f would get set if it was determined at some
point that it was clean. That check is usually done when the user runs
hg st. We don't do that before the failure in the test case, but it
happens at the end of the hg clone call. So if the file system's
time happens to roll over after the clone's working copy has been
written, but before its (final) dirstate has been written, we can end
up with a set timestamp there.

This patch makes it consistent by sleeping for 2 seconds so the
timestamp gets reliably set.

Diff Detail

rHG Mercurial
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.Jan 10 2019, 7:45 PM
This revision was automatically updated to reflect the committed changes.