changeset 49681:3f34d800cc69 stable

dirstate: tests racing status with both dirstate-v2 append and rewrite The way the racing process touches the dirstate results in different challenges for the raced process. We now test each variant in the `test-dirstate-status-race.t` tests.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 24 Feb 2023 01:19:37 +0100
parents ecd28d89c29e
children e30b9e43be7e
files tests/test-dirstate-status-write-race.t
diffstat 1 files changed, 18 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-dirstate-status-write-race.t	Tue Feb 28 15:49:53 2023 +0100
+++ b/tests/test-dirstate-status-write-race.t	Fri Feb 24 01:19:37 2023 +0100
@@ -2,7 +2,7 @@
 Check potential race conditions between a status and other operations
 =====================================================================
 
-#testcases dirstate-v1 dirstate-v2
+#testcases dirstate-v1 dirstate-v2-append dirstate-v2-rewrite
 
 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
@@ -30,7 +30,7 @@
   > dirstate-v2.slow-path=allow
   > EOF
 
-#if dirstate-v2
+#if no-dirstate-v1
   $ cat >> $HGRCPATH << EOF
   > [format]
   > use-dirstate-v2=yes
@@ -42,6 +42,13 @@
   > EOF
 #endif
 
+#if dirstate-v2-rewrite
+  $ d2args="--config devel.dirstate.v2.data_update_mode=force-new"
+#endif
+#if dirstate-v2-append
+  $ d2args="--config devel.dirstate.v2.data_update_mode=force-append"
+#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"
@@ -228,7 +235,7 @@
 
 Add a file
 
-  $ hg add dir/n
+  $ hg $d2args add dir/n
   $ touch $TESTTMP/status-race-lock
   $ wait
 
@@ -236,11 +243,11 @@
 
   $ hg status
   A dir/n (no-rhg !)
-  A dir/n (rhg no-dirstate-v1 !)
+  A dir/n (rhg dirstate-v2-rewrite !)
   A dir/n (missing-correct-output rhg dirstate-v1 !)
   A dir/o
   R dir/nested/m
-  ? dir/n (known-bad-output rhg dirstate-v1 !)
+  ? dir/n (known-bad-output rhg no-dirstate-v2-rewrite !)
   ? p
   ? q
 
@@ -253,7 +260,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 !)
+  abort: when writing $TESTTMP/race-with-add/.hg/dirstate.*: $ENOENT$ (glob) (known-bad-output rhg dirstate-v2-rewrite !)
 
 final cleanup
 
@@ -277,7 +284,7 @@
 
 Add a file and force the data file rewrite
 
-  $ hg commit -m created-during-status dir/o
+  $ hg $d2args commit -m created-during-status dir/o
   $ touch $TESTTMP/status-race-lock
   $ wait
 
@@ -322,7 +329,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 !)
+  abort: when removing $TESTTMP/race-with-commit/.hg/dirstate.*: $ENOENT$ (glob) (known-bad-output rhg dirstate-v2-rewrite !)
 
 final cleanup
 
@@ -346,7 +353,7 @@
 
 Add a file and force the data file rewrite
 
-  $ hg update ".~1"
+  $ hg $d2args update ".~1"
   0 files updated, 0 files merged, 6 files removed, 0 files unresolved
   $ touch $TESTTMP/status-race-lock
   $ wait
@@ -400,7 +407,7 @@
 touch g
 
   $ touch -t 200001010025 g
-  $ hg status
+  $ hg $d2args status
   A dir/o
   R dir/nested/m
   ? dir/n
@@ -425,7 +432,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 !)
+  abort: when removing $TESTTMP/race-with-status/.hg/dirstate.*: $ENOENT$ (glob) (known-bad-output rhg dirstate-v2-rewrite !)
 
 final cleanup