changeset 50220:35ea3c139104 stable

dirstate: cover each dirstate version when testing for status race Previously we were only testing it with the default (dirstate-v1 currently). Now we explicitly test each variant.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 24 Feb 2023 01:15:45 +0100
parents 72104dd91f2b
children 1891086f6c7f
files tests/test-dirstate-status-write-race.t
diffstat 1 files changed, 25 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-dirstate-status-write-race.t	Fri Feb 24 01:09:11 2023 +0100
+++ b/tests/test-dirstate-status-write-race.t	Fri Feb 24 01:15:45 2023 +0100
@@ -2,6 +2,8 @@
 Check potential race conditions between a status and other operations
 =====================================================================
 
+#testcases dirstate-v1 dirstate-v2
+
 The `hg status` command can run without the wlock, however it might end up
 having to update the on-disk dirstate files, for example to mark ambiguous
 files as clean, or to update directory caches information with dirstate-v2.
@@ -23,6 +25,23 @@
 Setup
 =====
 
+  $ cat >> $HGRCPATH << EOF
+  > [storage]
+  > dirstate-v2.slow-path=allow
+  > EOF
+
+#if dirstate-v2
+  $ cat >> $HGRCPATH << EOF
+  > [format]
+  > use-dirstate-v2=yes
+  > EOF
+#else
+  $ cat >> $HGRCPATH << EOF
+  > [format]
+  > use-dirstate-v2=no
+  > EOF
+#endif
+
   $ directories="dir dir/nested dir2"
   $ first_files="dir/nested/a dir/b dir/c dir/d dir2/e f"
   $ second_files="g dir/nested/h dir/i dir/j dir2/k dir2/l dir/nested/m"
@@ -217,10 +236,11 @@
 
   $ hg status
   A dir/n (no-rhg !)
-  A dir/n (missing-correct-output rhg !)
+  A dir/n (rhg no-dirstate-v1 !)
+  A dir/n (missing-correct-output rhg dirstate-v1 !)
   A dir/o
   R dir/nested/m
-  ? dir/n (known-bad-output rhg !)
+  ? dir/n (known-bad-output rhg dirstate-v1 !)
   ? p
   ? q
 
@@ -233,6 +253,7 @@
   ? p
   ? q
   $ cat $TESTTMP/status-race-lock.log
+  abort: when writing $TESTTMP/race-with-add/.hg/dirstate.*: $ENOENT$ (glob) (known-bad-output rhg dirstate-v2 !)
 
 final cleanup
 
@@ -301,6 +322,7 @@
   ? p
   ? q
   $ cat $TESTTMP/status-race-lock.log
+  abort: when removing $TESTTMP/race-with-commit/.hg/dirstate.*: $ENOENT$ (glob) (known-bad-output rhg dirstate-v2 !)
 
 final cleanup
 
@@ -403,6 +425,7 @@
   ? p
   ? q
   $ cat $TESTTMP/status-race-lock.log
+  abort: when removing $TESTTMP/race-with-status/.hg/dirstate.*: $ENOENT$ (glob) (known-bad-output rhg dirstate-v2 !)
 
 final cleanup