annotate tests/_exc-util.sh @ 1015:68d9c7e4a03d

evolve: rename `tr` variable (for troubled) to `tro` tro is usually dedicated to transaction.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 06 Aug 2014 16:07:53 -0700
parents f7f4a1fac6c0
children 59bc29c84ce0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
829
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
1 #!/bin/sh
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
2
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
3 cat >> $HGRCPATH <<EOF
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
4 [web]
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
5 push_ssl = false
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
6 allow_push = *
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
7 [ui]
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
8 logtemplate ="{node|short} ({phase}): {desc}\n"
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
9 [phases]
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
10 publish=False
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
11 [extensions]
848
001f8508910a exchange: add test case for D.1
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 832
diff changeset
12 hgext.strip=
829
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
13 hgext.rebase=
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
14 EOF
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
15 echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
16
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
17 mkcommit() {
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
18 echo "$1" > "$1"
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
19 hg add "$1"
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
20 hg ci -m "$1"
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
21 }
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
22 getid() {
1001
f7f4a1fac6c0 test: use `hg log` in the `getid` function
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 905
diff changeset
23 hg log --hidden --template '{node}\n' --rev "$1"
829
0943f327e2fb exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
24 }
830
f3b3a09ba312 exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 829
diff changeset
25
f3b3a09ba312 exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 829
diff changeset
26 setuprepos() {
f3b3a09ba312 exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 829
diff changeset
27 echo creating test repo for test case $1
f3b3a09ba312 exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 829
diff changeset
28 mkdir $1
f3b3a09ba312 exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 829
diff changeset
29 cd $1
f3b3a09ba312 exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 829
diff changeset
30 echo - pulldest
f3b3a09ba312 exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 829
diff changeset
31 hg init pushdest
f3b3a09ba312 exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 829
diff changeset
32 cd pushdest
f3b3a09ba312 exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 829
diff changeset
33 mkcommit O
f3b3a09ba312 exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 829
diff changeset
34 hg phase --public .
f3b3a09ba312 exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 829
diff changeset
35 cd ..
f3b3a09ba312 exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 829
diff changeset
36 echo - main
f3b3a09ba312 exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 829
diff changeset
37 hg clone -q pushdest main
f3b3a09ba312 exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 829
diff changeset
38 echo - pushdest
f3b3a09ba312 exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 829
diff changeset
39 hg clone -q main pulldest
f3b3a09ba312 exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 829
diff changeset
40 echo 'cd into `main` and proceed with env setup'
f3b3a09ba312 exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 829
diff changeset
41 }
831
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
42
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
43 dotest() {
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
44 # dotest TESTNAME [TARGETNODE]
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
45
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
46 testcase=$1
832
46e81a5d2d94 exchange: add test case for A.3
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 831
diff changeset
47 shift
46e81a5d2d94 exchange: add test case for A.3
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 831
diff changeset
48 target="$1"
46e81a5d2d94 exchange: add test case for A.3
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 831
diff changeset
49 if [ $# -gt 0 ]; then
46e81a5d2d94 exchange: add test case for A.3
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 831
diff changeset
50 shift
46e81a5d2d94 exchange: add test case for A.3
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 831
diff changeset
51 fi
831
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
52 targetnode=""
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
53 desccall=""
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
54 cd $testcase
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
55 echo "## Running testcase $testcase"
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
56 if [ -n "$target" ]; then
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
57 desccall="desc("\'"$target"\'")"
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
58 targetnode="`hg -R main id -qr \"$desccall\"`"
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
59 echo "# testing echange of \"$target\" ($targetnode)"
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
60 fi
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
61 echo "## initial state"
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
62 echo "# obstore: main"
905
b177fde040dd exchange: use fixed order for obstore content
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 848
diff changeset
63 hg -R main debugobsolete | sort
831
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
64 echo "# obstore: pushdest"
905
b177fde040dd exchange: use fixed order for obstore content
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 848
diff changeset
65 hg -R pushdest debugobsolete | sort
831
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
66 echo "# obstore: pulldest"
905
b177fde040dd exchange: use fixed order for obstore content
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 848
diff changeset
67 hg -R pulldest debugobsolete | sort
831
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
68
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
69 if [ -n "$target" ]; then
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
70 echo "## pushing \"$target\"" from main to pushdest
832
46e81a5d2d94 exchange: add test case for A.3
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 831
diff changeset
71 hg -R main push -r "$desccall" $@ pushdest
831
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
72 else
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
73 echo "## pushing from main to pushdest"
832
46e81a5d2d94 exchange: add test case for A.3
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 831
diff changeset
74 hg -R main push pushdest $@
831
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
75 fi
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
76 echo "## post push state"
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
77 echo "# obstore: main"
905
b177fde040dd exchange: use fixed order for obstore content
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 848
diff changeset
78 hg -R main debugobsolete | sort
831
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
79 echo "# obstore: pushdest"
905
b177fde040dd exchange: use fixed order for obstore content
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 848
diff changeset
80 hg -R pushdest debugobsolete | sort
831
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
81 echo "# obstore: pulldest"
905
b177fde040dd exchange: use fixed order for obstore content
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 848
diff changeset
82 hg -R pulldest debugobsolete | sort
831
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
83 if [ -n "$target" ]; then
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
84 echo "## pulling \"$targetnode\"" from main into pulldest
832
46e81a5d2d94 exchange: add test case for A.3
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 831
diff changeset
85 hg -R pulldest pull -r $targetnode $@ main
831
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
86 else
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
87 echo "## pulling from main into pulldest"
832
46e81a5d2d94 exchange: add test case for A.3
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 831
diff changeset
88 hg -R pulldest pull main $@
831
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
89 fi
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
90 echo "## post pull state"
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
91 echo "# obstore: main"
905
b177fde040dd exchange: use fixed order for obstore content
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 848
diff changeset
92 hg -R main debugobsolete | sort
831
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
93 echo "# obstore: pushdest"
905
b177fde040dd exchange: use fixed order for obstore content
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 848
diff changeset
94 hg -R pushdest debugobsolete | sort
831
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
95 echo "# obstore: pulldest"
905
b177fde040dd exchange: use fixed order for obstore content
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 848
diff changeset
96 hg -R pulldest debugobsolete | sort
831
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
97
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
98 cd ..
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
99
a6af6919888d exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 830
diff changeset
100 }