Patchwork [3,of,4] tests: adjust hooks for Windows

login
register
mail settings
Submitter Matt Harbison
Date Oct. 29, 2017, 5:09 a.m.
Message ID <ba57926f2b4ccc2ded73.1509253784@Envy>
Download mbox | patch
Permalink /patch/25305/
State Accepted
Headers show

Comments

Matt Harbison - Oct. 29, 2017, 5:09 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1508554916 14400
#      Fri Oct 20 23:01:56 2017 -0400
# Branch stable
# Node ID ba57926f2b4ccc2ded732b60c7da40544d524eb3
# Parent  a716ac96572847d8cf721d08d10d967e26f5ef21
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.

Patch

diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -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
 
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -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
diff --git a/tests/test-phases.t b/tests/test-phases.t
--- a/tests/test-phases.t
+++ b/tests/test-phases.t
@@ -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
diff --git a/tests/test-push-http.t b/tests/test-push-http.t
--- a/tests/test-push-http.t
+++ b/tests/test-push-http.t
@@ -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/