changeset 47324:b1ce93dcdf3c

tests: fix test-transaction-safety.t on Windows Mostly this is about `C:\dir\sub` style paths being turned into `C:dirsub` by MSYS, and not being about to execute shell scripts in hooks directly. See also a12819559ccb::9e3979a25bfe. Differential Revision: https://phab.mercurial-scm.org/D10762
author Matt Harbison <matt_harbison@yahoo.com>
date Thu, 20 May 2021 19:30:56 -0400
parents 7ea39d633cf3
children 93fc0a13b7e8
files tests/test-transaction-safety.t
diffstat 1 files changed, 8 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-transaction-safety.t	Wed May 19 19:57:55 2021 +0200
+++ b/tests/test-transaction-safety.t	Thu May 20 19:30:56 2021 -0400
@@ -54,17 +54,15 @@
   $ export HG_TEST_FILE_EXT_DONE
   $ cat << EOF > script/external.sh
   > #!/bin/sh
-  > $RUNTESTDIR/testlib/wait-on-file 5 $HG_TEST_FILE_EXT_UNLOCK $HG_TEST_FILE_EXT_WAITING
-  > hg log --rev 'tip' -T 'external: {rev} {desc}\n' > $TESTTMP/output/external.out
-  > touch $HG_TEST_FILE_EXT_DONE
+  > "$RUNTESTDIR/testlib/wait-on-file" 5 "$HG_TEST_FILE_EXT_UNLOCK" "$HG_TEST_FILE_EXT_WAITING"
+  > hg log --rev 'tip' -T 'external: {rev} {desc}\n' > "$TESTTMP/output/external.out"
+  > touch "$HG_TEST_FILE_EXT_DONE"
   > EOF
-  $ chmod +x script/external.sh
   $ cat << EOF > script/internal.sh
   > #!/bin/sh
-  > hg log --rev 'tip' -T 'internal: {rev} {desc}\n' > $TESTTMP/output/internal.out
-  > $RUNTESTDIR/testlib/wait-on-file 5 $HG_TEST_FILE_EXT_DONE $HG_TEST_FILE_EXT_UNLOCK
+  > hg log --rev 'tip' -T 'internal: {rev} {desc}\n' > "$TESTTMP/output/internal.out"
+  > "$RUNTESTDIR/testlib/wait-on-file" 5 "$HG_TEST_FILE_EXT_DONE" "$HG_TEST_FILE_EXT_UNLOCK"
   > EOF
-  $ chmod +x script/internal.sh
 
 
 Automated commands:
@@ -74,7 +72,7 @@
   > rm -f $TESTTMP/output/*
   > hg log --rev 'tip' -T 'pre-commit: {rev} {desc}\n'
   > echo x >> a
-  > $TESTTMP/script/external.sh & hg commit -m "$1"
+  > sh $TESTTMP/script/external.sh & hg commit -m "$1"
   > cat $TESTTMP/output/external.out
   > cat $TESTTMP/output/internal.out
   > hg log --rev 'tip' -T 'post-tr:  {rev} {desc}\n'
@@ -86,7 +84,7 @@
   > rm -f $TESTTMP/output/*
   > hg log --rev 'tip' -T 'pre-commit: {rev} {desc}\n'
   > echo x >> a
-  > $TESTTMP/script/external.sh & hg pull ../other-repo/ --rev "$1" --force --quiet
+  > sh $TESTTMP/script/external.sh & hg pull ../other-repo/ --rev "$1" --force --quiet
   > cat $TESTTMP/output/external.out
   > cat $TESTTMP/output/internal.out
   > hg log --rev 'tip' -T 'post-tr:  {rev} {desc}\n'
@@ -122,7 +120,7 @@
   > [extensions]
   > small_inline=$TESTTMP/ext/small_inline.py
   > [hooks]
-  > pretxnclose = $TESTTMP/script/internal.sh
+  > pretxnclose = sh $TESTTMP/script/internal.sh
   > EOF
 
 check this is true for the initial commit (inline → inline)