##// END OF EJS Templates
tests: change blackbox test to work cross platform...
timeless -
r28024:142891ab default
parent child Browse files
Show More
@@ -1,147 +1,179 b''
1 setup
1 setup
2 $ cat >> $HGRCPATH <<EOF
2 $ cat >> $HGRCPATH <<EOF
3 > [extensions]
3 > [extensions]
4 > blackbox=
4 > blackbox=
5 > mock=$TESTDIR/mockblackbox.py
5 > mock=$TESTDIR/mockblackbox.py
6 > mq=
6 > mq=
7 > EOF
7 > EOF
8 $ hg init blackboxtest
8 $ hg init blackboxtest
9 $ cd blackboxtest
9 $ cd blackboxtest
10
10
11 command, exit codes, and duration
11 command, exit codes, and duration
12
12
13 $ echo a > a
13 $ echo a > a
14 $ hg add a
14 $ hg add a
15 $ hg blackbox
15 $ hg blackbox
16 1970/01/01 00:00:00 bob (*)> add a (glob)
16 1970/01/01 00:00:00 bob (*)> add a (glob)
17 1970/01/01 00:00:00 bob (*)> add a exited 0 after * seconds (glob)
17 1970/01/01 00:00:00 bob (*)> add a exited 0 after * seconds (glob)
18
18
19 incoming change tracking
19 incoming change tracking
20
20
21 create two heads to verify that we only see one change in the log later
21 create two heads to verify that we only see one change in the log later
22 $ hg commit -ma
22 $ hg commit -ma
23 $ hg up null
23 $ hg up null
24 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
24 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
25 $ echo b > b
25 $ echo b > b
26 $ hg commit -Amb
26 $ hg commit -Amb
27 adding b
27 adding b
28 created new head
28 created new head
29
29
30 clone, commit, pull
30 clone, commit, pull
31 $ hg clone . ../blackboxtest2
31 $ hg clone . ../blackboxtest2
32 updating to branch default
32 updating to branch default
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 $ echo c > c
34 $ echo c > c
35 $ hg commit -Amc
35 $ hg commit -Amc
36 adding c
36 adding c
37 $ cd ../blackboxtest2
37 $ cd ../blackboxtest2
38 $ hg pull
38 $ hg pull
39 pulling from $TESTTMP/blackboxtest (glob)
39 pulling from $TESTTMP/blackboxtest (glob)
40 searching for changes
40 searching for changes
41 adding changesets
41 adding changesets
42 adding manifests
42 adding manifests
43 adding file changes
43 adding file changes
44 added 1 changesets with 1 changes to 1 files
44 added 1 changesets with 1 changes to 1 files
45 (run 'hg update' to get a working copy)
45 (run 'hg update' to get a working copy)
46 $ hg blackbox -l 5
46 $ hg blackbox -l 5
47 1970/01/01 00:00:00 bob (*)> pull (glob)
47 1970/01/01 00:00:00 bob (*)> pull (glob)
48 1970/01/01 00:00:00 bob (*)> updated served branch cache in ?.???? seconds (glob)
48 1970/01/01 00:00:00 bob (*)> updated served branch cache in * seconds (glob)
49 1970/01/01 00:00:00 bob (*)> wrote served branch cache with 1 labels and 2 nodes (glob)
49 1970/01/01 00:00:00 bob (*)> wrote served branch cache with 1 labels and 2 nodes (glob)
50 1970/01/01 00:00:00 bob (*)> 1 incoming changes - new heads: d02f48003e62 (glob)
50 1970/01/01 00:00:00 bob (*)> 1 incoming changes - new heads: d02f48003e62 (glob)
51 1970/01/01 00:00:00 bob (*)> pull exited 0 after * seconds (glob)
51 1970/01/01 00:00:00 bob (*)> pull exited 0 after * seconds (glob)
52
52
53 we must not cause a failure if we cannot write to the log
53 we must not cause a failure if we cannot write to the log
54
54
55 $ hg rollback
55 $ hg rollback
56 repository tip rolled back to revision 1 (undo pull)
56 repository tip rolled back to revision 1 (undo pull)
57
57
58 #if unix-permissions no-root
58 $ mv .hg/blackbox.log .hg/blackbox.log-
59 $ chmod 000 .hg/blackbox.log
59 $ mkdir .hg/blackbox.log
60 $ hg --debug incoming
60 $ hg --debug incoming
61 warning: cannot write to blackbox.log: Permission denied
61 warning: cannot write to blackbox.log: * (glob)
62 comparing with $TESTTMP/blackboxtest (glob)
62 comparing with $TESTTMP/blackboxtest (glob)
63 query 1; heads
63 query 1; heads
64 searching for changes
64 searching for changes
65 all local heads known remotely
65 all local heads known remotely
66 changeset: 2:d02f48003e62c24e2659d97d30f2a83abe5d5d51
66 changeset: 2:d02f48003e62c24e2659d97d30f2a83abe5d5d51
67 tag: tip
67 tag: tip
68 phase: draft
68 phase: draft
69 parent: 1:6563da9dcf87b1949716e38ff3e3dfaa3198eb06
69 parent: 1:6563da9dcf87b1949716e38ff3e3dfaa3198eb06
70 parent: -1:0000000000000000000000000000000000000000
70 parent: -1:0000000000000000000000000000000000000000
71 manifest: 2:ab9d46b053ebf45b7996f2922b9893ff4b63d892
71 manifest: 2:ab9d46b053ebf45b7996f2922b9893ff4b63d892
72 user: test
72 user: test
73 date: Thu Jan 01 00:00:00 1970 +0000
73 date: Thu Jan 01 00:00:00 1970 +0000
74 files+: c
74 files+: c
75 extra: branch=default
75 extra: branch=default
76 description:
76 description:
77 c
77 c
78
78
79
79
80 #endif
81 $ hg pull
80 $ hg pull
82 pulling from $TESTTMP/blackboxtest (glob)
81 pulling from $TESTTMP/blackboxtest (glob)
83 searching for changes
82 searching for changes
84 adding changesets
83 adding changesets
85 adding manifests
84 adding manifests
86 adding file changes
85 adding file changes
87 added 1 changesets with 1 changes to 1 files
86 added 1 changesets with 1 changes to 1 files
88 (run 'hg update' to get a working copy)
87 (run 'hg update' to get a working copy)
89
88
90 a failure reading from the log is fine
89 a failure reading from the log is fatal
91 #if unix-permissions no-root
90
92 $ hg blackbox -l 3
91 $ hg blackbox -l 3
93 abort: Permission denied: $TESTTMP/blackboxtest2/.hg/blackbox.log
92 abort: *$TESTTMP/blackboxtest2/.hg/blackbox.log* (glob)
94 [255]
93 [255]
95
94
96 $ chmod 600 .hg/blackbox.log
95 $ rmdir .hg/blackbox.log
97 #endif
96 $ mv .hg/blackbox.log- .hg/blackbox.log
98
97
99 backup bundles get logged
98 backup bundles get logged
100
99
101 $ touch d
100 $ touch d
102 $ hg commit -Amd
101 $ hg commit -Amd
103 adding d
102 adding d
104 created new head
103 created new head
105 $ hg strip tip
104 $ hg strip tip
106 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
105 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
107 saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
106 saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
108 $ hg blackbox -l 5
107 $ hg blackbox -l 5
109 1970/01/01 00:00:00 bob (*)> strip tip (glob)
108 1970/01/01 00:00:00 bob (*)> strip tip (glob)
110 1970/01/01 00:00:00 bob (*)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
109 1970/01/01 00:00:00 bob (*)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
111 1970/01/01 00:00:00 bob (*)> updated base branch cache in ?.???? seconds (glob)
110 1970/01/01 00:00:00 bob (*)> updated base branch cache in * seconds (glob)
112 1970/01/01 00:00:00 bob (*)> wrote base branch cache with 1 labels and 2 nodes (glob)
111 1970/01/01 00:00:00 bob (*)> wrote base branch cache with 1 labels and 2 nodes (glob)
113 1970/01/01 00:00:00 bob (*)> strip tip exited 0 after * seconds (glob)
112 1970/01/01 00:00:00 bob (*)> strip tip exited 0 after * seconds (glob)
114
113
115 extension and python hooks - use the eol extension for a pythonhook
114 extension and python hooks - use the eol extension for a pythonhook
116
115
117 $ echo '[extensions]' >> .hg/hgrc
116 $ echo '[extensions]' >> .hg/hgrc
118 $ echo 'eol=' >> .hg/hgrc
117 $ echo 'eol=' >> .hg/hgrc
119 $ echo '[hooks]' >> .hg/hgrc
118 $ echo '[hooks]' >> .hg/hgrc
120 $ echo 'update = echo hooked' >> .hg/hgrc
119 $ echo 'update = echo hooked' >> .hg/hgrc
121 $ hg update
120 $ hg update
122 hooked
121 hooked
123 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
124 $ hg blackbox -l 5
123 $ hg blackbox -l 5
125 1970/01/01 00:00:00 bob (*)> update (glob)
124 1970/01/01 00:00:00 bob (*)> update (glob)
126 1970/01/01 00:00:00 bob (*)> writing .hg/cache/tags2-visible with 0 tags (glob)
125 1970/01/01 00:00:00 bob (*)> writing .hg/cache/tags2-visible with 0 tags (glob)
127 1970/01/01 00:00:00 bob (*)> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob)
126 1970/01/01 00:00:00 bob (*)> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob)
128 1970/01/01 00:00:00 bob (*)> exthook-update: echo hooked finished in * seconds (glob)
127 1970/01/01 00:00:00 bob (*)> exthook-update: echo hooked finished in * seconds (glob)
129 1970/01/01 00:00:00 bob (*)> update exited 0 after * seconds (glob)
128 1970/01/01 00:00:00 bob (*)> update exited 0 after * seconds (glob)
130
129
131 log rotation
130 log rotation
132
131
133 $ echo '[blackbox]' >> .hg/hgrc
132 $ echo '[blackbox]' >> .hg/hgrc
134 $ echo 'maxsize = 20 b' >> .hg/hgrc
133 $ echo 'maxsize = 20 b' >> .hg/hgrc
135 $ echo 'maxfiles = 3' >> .hg/hgrc
134 $ echo 'maxfiles = 3' >> .hg/hgrc
136 $ hg status
135 $ hg status
137 $ hg status
136 $ hg status
138 $ hg status
137 $ hg status
139 $ hg tip -q
138 $ hg tip -q
140 2:d02f48003e62
139 2:d02f48003e62
141 $ ls .hg/blackbox.log*
140 $ ls .hg/blackbox.log*
142 .hg/blackbox.log
141 .hg/blackbox.log
143 .hg/blackbox.log.1
142 .hg/blackbox.log.1
144 .hg/blackbox.log.2
143 .hg/blackbox.log.2
144 $ cd ..
145
146 $ hg init blackboxtest3
147 $ cd blackboxtest3
148 $ hg blackbox
149 $ mv .hg/blackbox.log .hg/blackbox.log-
150 $ mkdir .hg/blackbox.log
151 $ sed -e 's/\(.*test1.*\)/#\1/; s#\(.*commit2.*\)#os.rmdir(".hg/blackbox.log")\nos.rename(".hg/blackbox.log-", ".hg/blackbox.log")\n\1#' $TESTDIR/test-dispatch.py > ../test-dispatch.py
152 $ python ../test-dispatch.py
153 running: add foo
154 result: 0
155 running: commit -m commit1 -d 2000-01-01 foo
156 result: None
157 running: commit -m commit2 -d 2000-01-02 foo
158 result: None
159 running: log -r 0
160 changeset: 0:0e4634943879
161 user: test
162 date: Sat Jan 01 00:00:00 2000 +0000
163 summary: commit1
164
165 result: None
166 running: log -r tip
167 changeset: 1:45589e459b2e
168 tag: tip
169 user: test
170 date: Sun Jan 02 00:00:00 2000 +0000
171 summary: commit2
172
173 result: None
174 $ hg blackbox
175 1970/01/01 00:00:00 bob (*)> blackbox (glob)
176 1970/01/01 00:00:00 bob (*)> blackbox exited 0 after * seconds (glob)
145
177
146 cleanup
178 cleanup
147 $ cd ..
179 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now