tests: adjust hooks for Windows stable
authorMatt Harbison <matt_harbison@yahoo.com>
Fri, 20 Oct 2017 23:01:56 -0400
branchstable
changeset 34938 aa05b95949fe
parent 34937 af924308110a
child 34939 2c80a864e83e
tests: adjust hooks for Windows I'm not sure why these weren't working on Windows. The failures were generally in the style of: - remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: 1 -> 0 + remote: "phase-move: $HG_NODE: $HG_OLDPHASE -> $HG_PHASE" and - abort: pretxnclose-bookmark.force-forward hook exited with status 1 - [255] + abort: pretxnclose-bookmark.force-public hook exited with status 255 + [255] These failures originated in ee5f0d047b41::f6d17075608f.
tests/test-bookmarks-pushpull.t
tests/test-bookmarks.t
tests/test-phases.t
tests/test-push-http.t
--- a/tests/test-bookmarks-pushpull.t	Fri Oct 20 21:29:15 2017 -0400
+++ b/tests/test-bookmarks-pushpull.t	Fri Oct 20 23:01:56 2017 -0400
@@ -10,7 +10,10 @@
   > evolution.exchange=True
   > EOF
 
-  $ TESTHOOK='hooks.txnclose-bookmark.test=echo "test-hook-bookmark: $HG_BOOKMARK:  $HG_OLDNODE -> $HG_NODE"'
+  $ cat > $TESTTMP/hook.sh <<'EOF'
+  > echo "test-hook-bookmark: $HG_BOOKMARK:  $HG_OLDNODE -> $HG_NODE"
+  > EOF
+  $ TESTHOOK="hooks.txnclose-bookmark.test=sh $TESTTMP/hook.sh"
 
 initialize
 
--- a/tests/test-bookmarks.t	Fri Oct 20 21:29:15 2017 -0400
+++ b/tests/test-bookmarks.t	Fri Oct 20 23:01:56 2017 -0400
@@ -2,7 +2,10 @@
   $ hg init repo
   $ cd repo
 
-  $ TESTHOOK='hooks.txnclose-bookmark.test=echo "test-hook-bookmark: $HG_BOOKMARK:  $HG_OLDNODE -> $HG_NODE"'
+  $ cat > $TESTTMP/hook.sh <<'EOF'
+  > echo "test-hook-bookmark: $HG_BOOKMARK:  $HG_OLDNODE -> $HG_NODE"
+  > EOF
+  $ TESTHOOK="hooks.txnclose-bookmark.test=sh $TESTTMP/hook.sh"
 
 no bookmarks
 
@@ -1074,8 +1077,8 @@
 
   $ cat << EOF >> .hg/hgrc
   > [hooks]
-  > pretxnclose-bookmark.force-public  = (echo \$HG_BOOKMARK| grep -v NEW > /dev/null) || [ -z "\$HG_NODE" ] || (hg log -r "\$HG_NODE" -T '{phase}' | grep public > /dev/null)
-  > pretxnclose-bookmark.force-forward = (echo \$HG_BOOKMARK| grep -v NEW > /dev/null) || [ -z "\$HG_NODE" ] || (hg log -r "max(\$HG_OLDNODE::\$HG_NODE)" -T 'MATCH' | grep MATCH > /dev/null)
+  > pretxnclose-bookmark.force-public  = sh -c "(echo \$HG_BOOKMARK| grep -v NEW > /dev/null) || [ -z \"\$HG_NODE\" ] || (hg log -r \"\$HG_NODE\" -T '{phase}' | grep public > /dev/null)"
+  > pretxnclose-bookmark.force-forward = sh -c "(echo \$HG_BOOKMARK| grep -v NEW > /dev/null) || [ -z \"\$HG_NODE\" ] || (hg log -r \"max(\$HG_OLDNODE::\$HG_NODE)\" -T 'MATCH' | grep MATCH > /dev/null)"
   > EOF
 
   $ hg log -G -T phases
--- a/tests/test-phases.t	Fri Oct 20 21:29:15 2017 -0400
+++ b/tests/test-phases.t	Fri Oct 20 23:01:56 2017 -0400
@@ -1,9 +1,12 @@
+  $ cat > $TESTTMP/hook.sh << 'EOF'
+  > echo "test-hook-close-phase: $HG_NODE:  $HG_OLDPHASE -> $HG_PHASE"
+  > EOF
 
   $ cat >> $HGRCPATH << EOF
   > [extensions]
   > phasereport=$TESTDIR/testlib/ext-phase-report.py
   > [hooks]
-  > txnclose-phase.test = echo "test-hook-close-phase: \$HG_NODE:  \$HG_OLDPHASE -> \$HG_PHASE"
+  > txnclose-phase.test = sh $TESTTMP/hook.sh
   > EOF
 
   $ hglog() { hg log --template "{rev} {phaseidx} {desc}\n" $*; }
@@ -796,7 +799,7 @@
 
   $ cat >> .hg/hgrc << EOF
   > [hooks]
-  > pretxnclose-phase.nopublish_D = (echo \$HG_NODE| grep -v b3325c91a4d9>/dev/null) || [ 'public' != \$HG_PHASE ]
+  > pretxnclose-phase.nopublish_D = sh -c "(echo \$HG_NODE| grep -v b3325c91a4d9>/dev/null) || [ 'public' != \$HG_PHASE ]"
   > EOF
 
 Try various actions. only the draft move should succeed
--- a/tests/test-push-http.t	Fri Oct 20 21:29:15 2017 -0400
+++ b/tests/test-push-http.t	Fri Oct 20 23:01:56 2017 -0400
@@ -56,12 +56,16 @@
 
 expect success
 
+  $ cat > $TESTTMP/hook.sh <<'EOF'
+  > echo "phase-move: $HG_NODE:  $HG_OLDPHASE -> $HG_PHASE"
+  > EOF
+
   $ cat >> .hg/hgrc <<EOF
   > allow_push = *
   > [hooks]
   > changegroup = sh -c "printenv.py changegroup 0"
   > pushkey = sh -c "printenv.py pushkey 0"
-  > txnclose-phase.test = echo "phase-move: \$HG_NODE:  \$HG_OLDPHASE -> \$HG_PHASE"
+  > txnclose-phase.test = sh $TESTTMP/hook.sh 
   > EOF
   $ req
   pushing to http://localhost:$HGPORT/