Mercurial > evolve
annotate tests/_exc-util.sh @ 831:a6af6919888d
exchange: automate the testing process too
we now have: dotest TESTNAME [TARGETNODE]
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 03 Mar 2014 14:03:41 -0800 |
parents | f3b3a09ba312 |
children | 46e81a5d2d94 |
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] |
0943f327e2fb
exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
12 hgext.rebase= |
0943f327e2fb
exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
13 EOF |
0943f327e2fb
exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
14 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
|
15 |
0943f327e2fb
exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
16 mkcommit() { |
0943f327e2fb
exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
17 echo "$1" > "$1" |
0943f327e2fb
exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
18 hg add "$1" |
0943f327e2fb
exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
19 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
|
20 } |
0943f327e2fb
exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
21 getid() { |
0943f327e2fb
exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
22 hg id --hidden --debug -ir "$1" |
0943f327e2fb
exchance: add a common setup script for all test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
23 } |
830
f3b3a09ba312
exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
829
diff
changeset
|
24 |
f3b3a09ba312
exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
829
diff
changeset
|
25 setuprepos() { |
f3b3a09ba312
exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
829
diff
changeset
|
26 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
|
27 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
|
28 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
|
29 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
|
30 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
|
31 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
|
32 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
|
33 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
|
34 cd .. |
f3b3a09ba312
exchange: have a function doing all the common initial setup
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
829
diff
changeset
|
35 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
|
36 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
|
37 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
|
38 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
|
39 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
|
40 } |
831
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
41 |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
42 dotest() { |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
43 # dotest TESTNAME [TARGETNODE] |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
44 |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
45 testcase=$1 |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
46 target="$2" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
47 targetnode="" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
48 desccall="" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
49 cd $testcase |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
50 echo "## Running testcase $testcase" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
51 if [ -n "$target" ]; then |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
52 desccall="desc("\'"$target"\'")" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
53 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
|
54 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
|
55 fi |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
56 echo "## initial state" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
57 echo "# obstore: main" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
58 hg -R main debugobsolete |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
59 echo "# obstore: pushdest" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
60 hg -R pushdest debugobsolete |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
61 echo "# obstore: pulldest" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
62 hg -R pulldest debugobsolete |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
63 |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
64 if [ -n "$target" ]; then |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
65 echo "## pushing \"$target\"" from main to pushdest |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
66 hg -R main push -r "$desccall" pushdest |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
67 else |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
68 echo "## pushing from main to pushdest" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
69 hg -R main push pushdest |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
70 fi |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
71 echo "## post push state" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
72 echo "# obstore: main" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
73 hg -R main debugobsolete |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
74 echo "# obstore: pushdest" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
75 hg -R pushdest debugobsolete |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
76 echo "# obstore: pulldest" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
77 hg -R pulldest debugobsolete |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
78 if [ -n "$target" ]; then |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
79 echo "## pulling \"$targetnode\"" from main into pulldest |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
80 hg -R pulldest pull -r $targetnode main |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
81 else |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
82 echo "## pulling from main into pulldest" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
83 hg -R pulldest pull main |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
84 fi |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
85 echo "## post pull state" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
86 echo "# obstore: main" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
87 hg -R main debugobsolete |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
88 echo "# obstore: pushdest" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
89 hg -R pushdest debugobsolete |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
90 echo "# obstore: pulldest" |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
91 hg -R pulldest debugobsolete |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
92 |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
93 cd .. |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
94 |
a6af6919888d
exchange: automate the testing process too
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
830
diff
changeset
|
95 } |