tests: stabilize `test-transaction-wc-rollback-race.t` on Windows
authorMatt Harbison <matt_harbison@yahoo.com>
Wed, 02 Oct 2024 18:19:59 -0400
changeset 51946 d7e61891ab5a
parent 51945 4ee2505f9f65
child 51947 9cfc95e901ec
tests: stabilize `test-transaction-wc-rollback-race.t` on Windows MSYS has a tendency to munge C:\Dir\SubDir\File into C:DirSubDirFile unless it is quoted, and that's what was happening here- there were a lot of these failures: file not created after 5 seconds: $TESTTMP/transaction-waiting I suspect quoting is only needed in the hook script that is generated (the catting of the log file pointed me in the right direction here), but I missed a spot and trial and error got me here. The quoting elsewhere doesn't harm anything and it was taking 7+ minutes to run this test when things were timing out, so I don't feel like reducing the quoting to the minimum required.
tests/test-transaction-wc-rollback-race.t
--- a/tests/test-transaction-wc-rollback-race.t	Wed Oct 02 16:34:33 2024 -0400
+++ b/tests/test-transaction-wc-rollback-race.t	Wed Oct 02 18:19:59 2024 -0400
@@ -107,14 +107,15 @@
   
 
   $ cat << EOF >> ../txn-close.sh
-  > rm -f $TESTTMP/transaction-continue
-  > $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/transaction-continue $TESTTMP/transaction-waiting
-  > rm -f $TESTTMP/transaction-waiting
+  > rm -f "$TESTTMP/transaction-continue"
+  > "$RUNTESTDIR/testlib/wait-on-file" 5 "$TESTTMP/transaction-continue" "$TESTTMP/transaction-waiting"
+  > rm -f "$TESTTMP/transaction-waiting"
   > exit 1
   > EOF
+
   $ cat << EOF >> .hg/hgrc
   > [hooks]
-  > pretxnclose.test = sh $TESTTMP/txn-close.sh
+  > pretxnclose.test = sh "$TESTTMP/txn-close.sh"
   > EOF
 
 Check the overall logic is working, the transaction is holding the `lock` , but
@@ -129,7 +130,7 @@
   $ echo y | hg --config ui.interactive=yes debuglock --set-lock
   abort: lock is already held
   [255]
-  $ touch $TESTTMP/transaction-continue
+  $ touch "$TESTTMP/transaction-continue"
   $ wait
   $ hg phase --rev 0
   0: draft
@@ -144,11 +145,11 @@
 
   $ hg status
   $ hg phase --public --rev 0 2> ../log.err &
-  $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/transaction-waiting
+  $ "$RUNTESTDIR/testlib/wait-on-file" 5 "$TESTTMP/transaction-waiting"
   $ hg forget default_a
   $ hg status
   R default_a
-  $ touch $TESTTMP/transaction-continue
+  $ touch "$TESTTMP/transaction-continue"
   $ wait
   $ hg status
   R default_a
@@ -160,12 +161,12 @@
   $ hg branch
   default
   $ hg phase --public --rev 0 2> ../log.err &
-  $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/transaction-waiting
+  $ "$RUNTESTDIR/testlib/wait-on-file" 5 "$TESTTMP/transaction-waiting"
   $ hg branch celeste
   marked working directory as branch celeste
   $ hg branch
   celeste
-  $ touch $TESTTMP/transaction-continue
+  $ touch "$TESTTMP/transaction-continue"
   $ wait
   $ hg branch
   celeste
@@ -177,12 +178,12 @@
   $ hg branch
   babar
   $ hg phase --public --rev 0 2> ../log.err &
-  $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/transaction-waiting
+  $ "$RUNTESTDIR/testlib/wait-on-file" 5 "$TESTTMP/transaction-waiting"
   $ hg branch celeste
   marked working directory as branch celeste
   $ hg branch
   celeste
-  $ touch $TESTTMP/transaction-continue
+  $ touch "$TESTTMP/transaction-continue"
   $ wait
   $ hg branch
   celeste
@@ -194,12 +195,12 @@
   $ hg log --rev . -T '{desc}\n'
   babar_m
   $ hg phase --public --rev 0 2> ../log.err &
-  $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/transaction-waiting
+  $ $RUNTESTDIR/testlib/wait-on-file 5 "$TESTTMP/transaction-waiting"
   $ hg update "parents(.)" --quiet
   $ hg log --rev . -T '{desc}\n'
   babar_l
   $ hg st
-  $ touch $TESTTMP/transaction-continue
+  $ touch "$TESTTMP/transaction-continue"
   $ wait
   $ hg log --rev . -T '{desc}\n'
   babar_l
@@ -234,13 +235,13 @@
   $ hg log -r . -T '= {activebookmark} =\n'
   =  =
   $ hg phase --public --rev 0 2> ../log.err &
-  $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/transaction-waiting
+  $ $RUNTESTDIR/testlib/wait-on-file 5 "$TESTTMP/transaction-waiting"
   $ hg up bar
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark bar)
   $ hg log -r . -T '= {activebookmark} =\n'
   = bar =
-  $ touch $TESTTMP/transaction-continue
+  $ touch "$TESTTMP/transaction-continue"
   $ wait
   $ hg log -r . -T '= {activebookmark} =\n'
   = bar =
@@ -251,13 +252,13 @@
   $ hg log -r . -T '= {activebookmark} =\n'
   = bar =
   $ hg phase --public --rev 0 2> ../log.err &
-  $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/transaction-waiting
+  $ $RUNTESTDIR/testlib/wait-on-file 5 "$TESTTMP/transaction-waiting"
   $ hg up .
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (leaving bookmark bar)
   $ hg log -r . -T '= {activebookmark} =\n'
   =  =
-  $ touch $TESTTMP/transaction-continue
+  $ touch "$TESTTMP/transaction-continue"
   $ wait
   $ hg log -r . -T '= {activebookmark} =\n'
   =  =