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