changeset 2118:d0bc98161794

tests: move exchange utility in testlib We have a testlib directory now lets use it.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 21 Mar 2017 10:25:12 +0100
parents e9d5f54765a2
children e1c26c632b6d
files tests/_exc-util.sh tests/test-exchange-A1.t tests/test-exchange-A2.t tests/test-exchange-A3.t tests/test-exchange-A4.t tests/test-exchange-A5.t tests/test-exchange-A6.t tests/test-exchange-A7.t tests/test-exchange-B1.t tests/test-exchange-B2.t tests/test-exchange-B3.t tests/test-exchange-B4.t tests/test-exchange-B5.t tests/test-exchange-B6.t tests/test-exchange-B7.t tests/test-exchange-C1.t tests/test-exchange-C2.t tests/test-exchange-C3.t tests/test-exchange-C4.t tests/test-exchange-D1.t tests/test-exchange-D2.t tests/test-exchange-D3.t tests/test-exchange-D4.t tests/testlib/exchange-util.sh
diffstat 24 files changed, 132 insertions(+), 132 deletions(-) [+]
line wrap: on
line diff
--- a/tests/_exc-util.sh	Tue Mar 14 16:56:48 2017 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-#!/bin/sh
-
-cat >> $HGRCPATH <<EOF
-[web]
-push_ssl = false
-allow_push = *
-
-[ui]
-logtemplate ="{node|short} ({phase}): {desc}\n"
-
-[phases]
-publish=False
-
-[experimental]
-verbose-obsolescence-exchange=false
-bundle2-exp=true
-bundle2-output-capture=True
-
-[alias]
-debugobsolete=debugobsolete -d '0 0'
-
-[extensions]
-hgext.strip=
-EOF
-echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
-
-mkcommit() {
-   echo "$1" > "$1"
-   hg add "$1"
-   hg ci -m "$1"
-}
-getid() {
-   hg log --hidden --template '{node}\n' --rev "$1"
-}
-
-setuprepos() {
-    echo creating test repo for test case $1
-    mkdir $1
-    cd $1
-    echo - pulldest
-    hg init pushdest
-    cd pushdest
-    mkcommit O
-    hg phase --public .
-    cd ..
-    echo - main
-    hg clone -q pushdest main
-    echo - pushdest
-    hg clone -q main pulldest
-    echo 'cd into `main` and proceed with env setup'
-}
-
-dotest() {
-# dotest TESTNAME [TARGETNODE]
-
-    testcase=$1
-    shift
-    target="$1"
-    if [ $# -gt 0 ]; then
-        shift
-    fi
-    targetnode=""
-    desccall=""
-    cd $testcase
-    echo "## Running testcase $testcase"
-    if [ -n "$target" ]; then
-        desccall="desc("\'"$target"\'")"
-        targetnode="`hg -R main id -qr \"$desccall\"`"
-        echo "# testing echange of \"$target\" ($targetnode)"
-    fi
-    echo "## initial state"
-    echo "# obstore: main"
-    hg -R main     debugobsolete | sort
-    echo "# obstore: pushdest"
-    hg -R pushdest debugobsolete | sort
-    echo "# obstore: pulldest"
-    hg -R pulldest debugobsolete | sort
-
-    if [ -n "$target" ]; then
-        echo "## pushing \"$target\"" from main to pushdest
-        hg -R main push -r "$desccall" $@ pushdest
-    else
-        echo "## pushing from main to pushdest"
-        hg -R main push pushdest $@
-    fi
-    echo "## post push state"
-    echo "# obstore: main"
-    hg -R main     debugobsolete | sort
-    echo "# obstore: pushdest"
-    hg -R pushdest debugobsolete | sort
-    echo "# obstore: pulldest"
-    hg -R pulldest debugobsolete | sort
-    if [ -n "$target" ]; then
-        echo "## pulling \"$targetnode\"" from main into pulldest
-        hg -R pulldest pull -r $targetnode $@ main
-    else
-        echo "## pulling from main into pulldest"
-        hg -R pulldest pull main $@
-    fi
-    echo "## post pull state"
-    echo "# obstore: main"
-    hg -R main     debugobsolete | sort
-    echo "# obstore: pushdest"
-    hg -R pushdest debugobsolete | sort
-    echo "# obstore: pulldest"
-    hg -R pulldest debugobsolete | sort
-
-    cd ..
-
-}
--- a/tests/test-exchange-A1.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-A1.t	Tue Mar 21 10:25:12 2017 +0100
@@ -1,7 +1,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 ==== A.1.1 pushing a single head ====
 ..
--- a/tests/test-exchange-A2.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-A2.t	Tue Mar 21 10:25:12 2017 +0100
@@ -2,7 +2,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 === A.2 Two heads ===
 
--- a/tests/test-exchange-A3.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-A3.t	Tue Mar 21 10:25:12 2017 +0100
@@ -1,7 +1,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 === A.3 new branch created ===
 
--- a/tests/test-exchange-A4.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-A4.t	Tue Mar 21 10:25:12 2017 +0100
@@ -1,7 +1,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 
 === A.4 Push in the middle of the obsolescence chain ===
--- a/tests/test-exchange-A5.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-A5.t	Tue Mar 21 10:25:12 2017 +0100
@@ -2,7 +2,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 
 === A.5 partial reordering ===
--- a/tests/test-exchange-A6.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-A6.t	Tue Mar 21 10:25:12 2017 +0100
@@ -3,7 +3,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 
 === A.6 between existing changeset ===
--- a/tests/test-exchange-A7.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-A7.t	Tue Mar 21 10:25:12 2017 +0100
@@ -1,7 +1,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 === A.7 Non targeted common changeset ===
 
--- a/tests/test-exchange-B1.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-B1.t	Tue Mar 21 10:25:12 2017 +0100
@@ -1,7 +1,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 === B.1 Prune on non-targeted common changeset ===
 
--- a/tests/test-exchange-B2.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-B2.t	Tue Mar 21 10:25:12 2017 +0100
@@ -1,7 +1,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 === B.2 Pruned changeset on head: nothing pushed ===
 
--- a/tests/test-exchange-B3.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-B3.t	Tue Mar 21 10:25:12 2017 +0100
@@ -2,7 +2,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 === B.3 Pruned changeset on non-pushed part of the history ===
 
--- a/tests/test-exchange-B4.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-B4.t	Tue Mar 21 10:25:12 2017 +0100
@@ -1,7 +1,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 === B.4 Pruned changeset on common part of history ===
 
--- a/tests/test-exchange-B5.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-B5.t	Tue Mar 21 10:25:12 2017 +0100
@@ -3,7 +3,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 
 === B.5 Push of a children of changeset which successors is pruned ===
--- a/tests/test-exchange-B6.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-B6.t	Tue Mar 21 10:25:12 2017 +0100
@@ -4,7 +4,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 == B.6 Pruned changeset with ancestors not in pushed set ===
 
--- a/tests/test-exchange-B7.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-B7.t	Tue Mar 21 10:25:12 2017 +0100
@@ -1,7 +1,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 
 === B.7 Prune on non-targeted common changeset ===
--- a/tests/test-exchange-C1.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-C1.t	Tue Mar 21 10:25:12 2017 +0100
@@ -1,7 +1,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 === C.1 Multiple pruned changeset atop each other ===
 .. 
--- a/tests/test-exchange-C2.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-C2.t	Tue Mar 21 10:25:12 2017 +0100
@@ -2,7 +2,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 === C.2 Pruned changeset on precursors ===
 
--- a/tests/test-exchange-C3.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-C3.t	Tue Mar 21 10:25:12 2017 +0100
@@ -2,7 +2,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 
 === C.3 Pruned changeset on precursors of another pruned one ===
--- a/tests/test-exchange-C4.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-C4.t	Tue Mar 21 10:25:12 2017 +0100
@@ -2,7 +2,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 === C.4 multiple successors, one is pruned ===
 
--- a/tests/test-exchange-D1.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-D1.t	Tue Mar 21 10:25:12 2017 +0100
@@ -1,7 +1,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 === D.1 Pruned changeset based on missing precursor of something not present ===
 
--- a/tests/test-exchange-D2.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-D2.t	Tue Mar 21 10:25:12 2017 +0100
@@ -2,7 +2,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 === D.2 missing prune target (prune in "pushed set") ===
 
--- a/tests/test-exchange-D3.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-D3.t	Tue Mar 21 10:25:12 2017 +0100
@@ -3,7 +3,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 === D.2 missing prune target (prune in "pushed set") ===
 
--- a/tests/test-exchange-D4.t	Tue Mar 14 16:56:48 2017 -0700
+++ b/tests/test-exchange-D4.t	Tue Mar 21 10:25:12 2017 +0100
@@ -2,7 +2,7 @@
 
 Initial setup
 
-  $ . $TESTDIR/_exc-util.sh
+  $ . $TESTDIR/testlib/exchange-util.sh
 
 === D.4 Unknown changeset in between known one ===
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/testlib/exchange-util.sh	Tue Mar 21 10:25:12 2017 +0100
@@ -0,0 +1,110 @@
+#!/bin/sh
+
+cat >> $HGRCPATH <<EOF
+[web]
+push_ssl = false
+allow_push = *
+
+[ui]
+logtemplate ="{node|short} ({phase}): {desc}\n"
+
+[phases]
+publish=False
+
+[experimental]
+verbose-obsolescence-exchange=false
+bundle2-exp=true
+bundle2-output-capture=True
+
+[alias]
+debugobsolete=debugobsolete -d '0 0'
+
+[extensions]
+hgext.strip=
+EOF
+echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+
+mkcommit() {
+   echo "$1" > "$1"
+   hg add "$1"
+   hg ci -m "$1"
+}
+getid() {
+   hg log --hidden --template '{node}\n' --rev "$1"
+}
+
+setuprepos() {
+    echo creating test repo for test case $1
+    mkdir $1
+    cd $1
+    echo - pulldest
+    hg init pushdest
+    cd pushdest
+    mkcommit O
+    hg phase --public .
+    cd ..
+    echo - main
+    hg clone -q pushdest main
+    echo - pushdest
+    hg clone -q main pulldest
+    echo 'cd into `main` and proceed with env setup'
+}
+
+dotest() {
+# dotest TESTNAME [TARGETNODE]
+
+    testcase=$1
+    shift
+    target="$1"
+    if [ $# -gt 0 ]; then
+        shift
+    fi
+    targetnode=""
+    desccall=""
+    cd $testcase
+    echo "## Running testcase $testcase"
+    if [ -n "$target" ]; then
+        desccall="desc("\'"$target"\'")"
+        targetnode="`hg -R main id -qr \"$desccall\"`"
+        echo "# testing echange of \"$target\" ($targetnode)"
+    fi
+    echo "## initial state"
+    echo "# obstore: main"
+    hg -R main     debugobsolete | sort
+    echo "# obstore: pushdest"
+    hg -R pushdest debugobsolete | sort
+    echo "# obstore: pulldest"
+    hg -R pulldest debugobsolete | sort
+
+    if [ -n "$target" ]; then
+        echo "## pushing \"$target\"" from main to pushdest
+        hg -R main push -r "$desccall" $@ pushdest
+    else
+        echo "## pushing from main to pushdest"
+        hg -R main push pushdest $@
+    fi
+    echo "## post push state"
+    echo "# obstore: main"
+    hg -R main     debugobsolete | sort
+    echo "# obstore: pushdest"
+    hg -R pushdest debugobsolete | sort
+    echo "# obstore: pulldest"
+    hg -R pulldest debugobsolete | sort
+    if [ -n "$target" ]; then
+        echo "## pulling \"$targetnode\"" from main into pulldest
+        hg -R pulldest pull -r $targetnode $@ main
+    else
+        echo "## pulling from main into pulldest"
+        hg -R pulldest pull main $@
+    fi
+    echo "## post pull state"
+    echo "# obstore: main"
+    hg -R main     debugobsolete | sort
+    echo "# obstore: pushdest"
+    hg -R pushdest debugobsolete | sort
+    echo "# obstore: pulldest"
+    hg -R pulldest debugobsolete | sort
+
+    cd ..
+
+}