Show More
@@ -1,675 +1,680 b'' | |||
|
1 | 1 | This file tests the behavior of run-tests.py itself. |
|
2 | 2 | |
|
3 | 3 | Avoid interference from actual test env: |
|
4 | 4 | |
|
5 | 5 | $ unset HGTEST_JOBS |
|
6 | 6 | $ unset HGTEST_TIMEOUT |
|
7 | 7 | $ unset HGTEST_PORT |
|
8 | 8 | $ unset HGTEST_SHELL |
|
9 | 9 | |
|
10 | Smoke test | |
|
10 | Smoke test with install | |
|
11 | 11 | ============ |
|
12 | 12 | |
|
13 | $ run-tests.py $HGTEST_RUN_TESTS_PURE | |
|
13 | $ run-tests.py $HGTEST_RUN_TESTS_PURE -l | |
|
14 | 14 | |
|
15 | 15 | # Ran 0 tests, 0 skipped, 0 warned, 0 failed. |
|
16 | 16 | |
|
17 | Define a helper to avoid the install step | |
|
18 | ============= | |
|
19 | $ rt() | |
|
20 | > { | |
|
21 | > run-tests.py --with-hg=`which hg` "$@" | |
|
22 | > } | |
|
23 | ||
|
17 | 24 | a succesful test |
|
18 | 25 | ======================= |
|
19 | 26 | |
|
20 | 27 | $ cat > test-success.t << EOF |
|
21 | 28 | > $ echo babar |
|
22 | 29 | > babar |
|
23 | 30 | > $ echo xyzzy |
|
24 | 31 | > never happens (?) |
|
25 | 32 | > xyzzy |
|
26 | 33 | > nor this (?) |
|
27 | 34 | > EOF |
|
28 | 35 | |
|
29 | $ run-tests.py --with-hg=`which hg` | |
|
36 | $ rt | |
|
30 | 37 | . |
|
31 | 38 | # Ran 1 tests, 0 skipped, 0 warned, 0 failed. |
|
32 | 39 | |
|
33 | 40 | failing test |
|
34 | 41 | ================== |
|
35 | 42 | |
|
36 | 43 | $ cat > test-failure.t << EOF |
|
37 | 44 | > $ echo babar |
|
38 | 45 | > rataxes |
|
39 | 46 | > This is a noop statement so that |
|
40 | 47 | > this test is still more bytes than success. |
|
41 | 48 | > EOF |
|
42 | 49 | |
|
43 | 50 | >>> fh = open('test-failure-unicode.t', 'wb') |
|
44 | 51 | >>> fh.write(u' $ echo babar\u03b1\n'.encode('utf-8')) and None |
|
45 | 52 | >>> fh.write(u' l\u03b5\u03b5t\n'.encode('utf-8')) and None |
|
46 | 53 | |
|
47 | $ run-tests.py --with-hg=`which hg` | |
|
54 | $ rt | |
|
48 | 55 | |
|
49 | 56 | --- $TESTTMP/test-failure.t |
|
50 | 57 | +++ $TESTTMP/test-failure.t.err |
|
51 | 58 | @@ -1,4 +1,4 @@ |
|
52 | 59 | $ echo babar |
|
53 | 60 | - rataxes |
|
54 | 61 | + babar |
|
55 | 62 | This is a noop statement so that |
|
56 | 63 | this test is still more bytes than success. |
|
57 | 64 | |
|
58 | 65 | ERROR: test-failure.t output changed |
|
59 | 66 | !. |
|
60 | 67 | --- $TESTTMP/test-failure-unicode.t |
|
61 | 68 | +++ $TESTTMP/test-failure-unicode.t.err |
|
62 | 69 | @@ -1,2 +1,2 @@ |
|
63 | 70 | $ echo babar\xce\xb1 (esc) |
|
64 | 71 | - l\xce\xb5\xce\xb5t (esc) |
|
65 | 72 | + babar\xce\xb1 (esc) |
|
66 | 73 | |
|
67 | 74 | ERROR: test-failure-unicode.t output changed |
|
68 | 75 | ! |
|
69 | 76 | Failed test-failure.t: output changed |
|
70 | 77 | Failed test-failure-unicode.t: output changed |
|
71 | 78 | # Ran 3 tests, 0 skipped, 0 warned, 2 failed. |
|
72 | 79 | python hash seed: * (glob) |
|
73 | 80 | [1] |
|
74 | 81 | |
|
75 | 82 | test --xunit support |
|
76 |
$ r |
|
|
83 | $ rt --xunit=xunit.xml | |
|
77 | 84 | |
|
78 | 85 | --- $TESTTMP/test-failure.t |
|
79 | 86 | +++ $TESTTMP/test-failure.t.err |
|
80 | 87 | @@ -1,4 +1,4 @@ |
|
81 | 88 | $ echo babar |
|
82 | 89 | - rataxes |
|
83 | 90 | + babar |
|
84 | 91 | This is a noop statement so that |
|
85 | 92 | this test is still more bytes than success. |
|
86 | 93 | |
|
87 | 94 | ERROR: test-failure.t output changed |
|
88 | 95 | !. |
|
89 | 96 | --- $TESTTMP/test-failure-unicode.t |
|
90 | 97 | +++ $TESTTMP/test-failure-unicode.t.err |
|
91 | 98 | @@ -1,2 +1,2 @@ |
|
92 | 99 | $ echo babar\xce\xb1 (esc) |
|
93 | 100 | - l\xce\xb5\xce\xb5t (esc) |
|
94 | 101 | + babar\xce\xb1 (esc) |
|
95 | 102 | |
|
96 | 103 | ERROR: test-failure-unicode.t output changed |
|
97 | 104 | ! |
|
98 | 105 | Failed test-failure.t: output changed |
|
99 | 106 | Failed test-failure-unicode.t: output changed |
|
100 | 107 | # Ran 3 tests, 0 skipped, 0 warned, 2 failed. |
|
101 | 108 | python hash seed: * (glob) |
|
102 | 109 | [1] |
|
103 | 110 | $ cat xunit.xml |
|
104 | 111 | <?xml version="1.0" encoding="utf-8"?> |
|
105 | 112 | <testsuite errors="0" failures="2" name="run-tests" skipped="0" tests="3"> |
|
106 | 113 | <testcase name="test-success.t" time="*"/> (glob) |
|
107 | 114 | <testcase name="test-failure-unicode.t" time="*"> (glob) |
|
108 | 115 | <![CDATA[--- $TESTTMP/test-failure-unicode.t |
|
109 | 116 | +++ $TESTTMP/test-failure-unicode.t.err |
|
110 | 117 | @@ -1,2 +1,2 @@ |
|
111 | 118 | $ echo babar\xce\xb1 (esc) |
|
112 | 119 | - l\xce\xb5\xce\xb5t (esc) |
|
113 | 120 | + babar\xce\xb1 (esc) |
|
114 | 121 | ]]> </testcase> |
|
115 | 122 | <testcase name="test-failure.t" time="*"> (glob) |
|
116 | 123 | <![CDATA[--- $TESTTMP/test-failure.t |
|
117 | 124 | +++ $TESTTMP/test-failure.t.err |
|
118 | 125 | @@ -1,4 +1,4 @@ |
|
119 | 126 | $ echo babar |
|
120 | 127 | - rataxes |
|
121 | 128 | + babar |
|
122 | 129 | This is a noop statement so that |
|
123 | 130 | this test is still more bytes than success. |
|
124 | 131 | ]]> </testcase> |
|
125 | 132 | </testsuite> |
|
126 | 133 | |
|
127 | 134 | $ rm test-failure-unicode.t |
|
128 | 135 | |
|
129 | 136 | test for --retest |
|
130 | 137 | ==================== |
|
131 | 138 | |
|
132 | $ run-tests.py --with-hg=`which hg` --retest | |
|
139 | $ rt --retest | |
|
133 | 140 | |
|
134 | 141 | --- $TESTTMP/test-failure.t |
|
135 | 142 | +++ $TESTTMP/test-failure.t.err |
|
136 | 143 | @@ -1,4 +1,4 @@ |
|
137 | 144 | $ echo babar |
|
138 | 145 | - rataxes |
|
139 | 146 | + babar |
|
140 | 147 | This is a noop statement so that |
|
141 | 148 | this test is still more bytes than success. |
|
142 | 149 | |
|
143 | 150 | ERROR: test-failure.t output changed |
|
144 | 151 | ! |
|
145 | 152 | Failed test-failure.t: output changed |
|
146 | 153 | # Ran 2 tests, 1 skipped, 0 warned, 1 failed. |
|
147 | 154 | python hash seed: * (glob) |
|
148 | 155 | [1] |
|
149 | 156 | |
|
150 | 157 | Selecting Tests To Run |
|
151 | 158 | ====================== |
|
152 | 159 | |
|
153 | 160 | successful |
|
154 | 161 | |
|
155 | $ run-tests.py --with-hg=`which hg` test-success.t | |
|
162 | $ rt test-success.t | |
|
156 | 163 | . |
|
157 | 164 | # Ran 1 tests, 0 skipped, 0 warned, 0 failed. |
|
158 | 165 | |
|
159 | 166 | success w/ keyword |
|
160 | $ run-tests.py --with-hg=`which hg` -k xyzzy | |
|
167 | $ rt -k xyzzy | |
|
161 | 168 | . |
|
162 | 169 | # Ran 2 tests, 1 skipped, 0 warned, 0 failed. |
|
163 | 170 | |
|
164 | 171 | failed |
|
165 | 172 | |
|
166 | $ run-tests.py --with-hg=`which hg` test-failure.t | |
|
173 | $ rt test-failure.t | |
|
167 | 174 | |
|
168 | 175 | --- $TESTTMP/test-failure.t |
|
169 | 176 | +++ $TESTTMP/test-failure.t.err |
|
170 | 177 | @@ -1,4 +1,4 @@ |
|
171 | 178 | $ echo babar |
|
172 | 179 | - rataxes |
|
173 | 180 | + babar |
|
174 | 181 | This is a noop statement so that |
|
175 | 182 | this test is still more bytes than success. |
|
176 | 183 | |
|
177 | 184 | ERROR: test-failure.t output changed |
|
178 | 185 | ! |
|
179 | 186 | Failed test-failure.t: output changed |
|
180 | 187 | # Ran 1 tests, 0 skipped, 0 warned, 1 failed. |
|
181 | 188 | python hash seed: * (glob) |
|
182 | 189 | [1] |
|
183 | 190 | |
|
184 | 191 | failure w/ keyword |
|
185 | $ run-tests.py --with-hg=`which hg` -k rataxes | |
|
192 | $ rt -k rataxes | |
|
186 | 193 | |
|
187 | 194 | --- $TESTTMP/test-failure.t |
|
188 | 195 | +++ $TESTTMP/test-failure.t.err |
|
189 | 196 | @@ -1,4 +1,4 @@ |
|
190 | 197 | $ echo babar |
|
191 | 198 | - rataxes |
|
192 | 199 | + babar |
|
193 | 200 | This is a noop statement so that |
|
194 | 201 | this test is still more bytes than success. |
|
195 | 202 | |
|
196 | 203 | ERROR: test-failure.t output changed |
|
197 | 204 | ! |
|
198 | 205 | Failed test-failure.t: output changed |
|
199 | 206 | # Ran 2 tests, 1 skipped, 0 warned, 1 failed. |
|
200 | 207 | python hash seed: * (glob) |
|
201 | 208 | [1] |
|
202 | 209 | |
|
203 | 210 | Verify that when a process fails to start we show a useful message |
|
204 | 211 | ================================================================== |
|
205 | 212 | NOTE: there is currently a bug where this shows "2 failed" even though |
|
206 | 213 | it's actually the same test being reported for failure twice. |
|
207 | 214 | |
|
208 | 215 | $ cat > test-serve-fail.t <<EOF |
|
209 | 216 | > $ echo 'abort: child process failed to start blah' |
|
210 | 217 | > EOF |
|
211 |
$ r |
|
|
218 | $ rt test-serve-fail.t | |
|
212 | 219 | |
|
213 | 220 | ERROR: test-serve-fail.t output changed |
|
214 | 221 | ! |
|
215 | 222 | ERROR: test-serve-fail.t output changed |
|
216 | 223 | ! |
|
217 | 224 | Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob) |
|
218 | 225 | Failed test-serve-fail.t: output changed |
|
219 | 226 | # Ran 1 tests, 0 skipped, 0 warned, 2 failed. |
|
220 | 227 | python hash seed: * (glob) |
|
221 | 228 | [1] |
|
222 | 229 | $ rm test-serve-fail.t |
|
223 | 230 | |
|
224 | 231 | Running In Debug Mode |
|
225 | 232 | ====================== |
|
226 | 233 | |
|
227 |
$ r |
|
|
234 | $ rt --debug 2>&1 | grep -v pwd | |
|
228 | 235 | + echo *SALT* 0 0 (glob) |
|
229 | 236 | *SALT* 0 0 (glob) |
|
230 | 237 | + echo babar |
|
231 | 238 | babar |
|
232 | 239 | + echo *SALT* 4 0 (glob) |
|
233 | 240 | *SALT* 4 0 (glob) |
|
234 | 241 | .+ echo *SALT* 0 0 (glob) |
|
235 | 242 | *SALT* 0 0 (glob) |
|
236 | 243 | + echo babar |
|
237 | 244 | babar |
|
238 | 245 | + echo *SALT* 2 0 (glob) |
|
239 | 246 | *SALT* 2 0 (glob) |
|
240 | 247 | + echo xyzzy |
|
241 | 248 | xyzzy |
|
242 | 249 | + echo *SALT* 6 0 (glob) |
|
243 | 250 | *SALT* 6 0 (glob) |
|
244 | 251 | . |
|
245 | 252 | # Ran 2 tests, 0 skipped, 0 warned, 0 failed. |
|
246 | 253 | |
|
247 | 254 | Parallel runs |
|
248 | 255 | ============== |
|
249 | 256 | |
|
250 | 257 | (duplicate the failing test to get predictable output) |
|
251 | 258 | $ cp test-failure.t test-failure-copy.t |
|
252 | 259 | |
|
253 |
$ r |
|
|
260 | $ rt --jobs 2 test-failure*.t -n | |
|
254 | 261 | !! |
|
255 | 262 | Failed test-failure*.t: output changed (glob) |
|
256 | 263 | Failed test-failure*.t: output changed (glob) |
|
257 | 264 | # Ran 2 tests, 0 skipped, 0 warned, 2 failed. |
|
258 | 265 | python hash seed: * (glob) |
|
259 | 266 | [1] |
|
260 | 267 | |
|
261 | 268 | failures in parallel with --first should only print one failure |
|
262 | 269 | >>> f = open('test-nothing.t', 'w') |
|
263 | 270 | >>> f.write('foo\n' * 1024) and None |
|
264 | 271 | >>> f.write(' $ sleep 1') and None |
|
265 | $ run-tests.py --with-hg=`which hg` --jobs 2 --first | |
|
272 | $ rt --jobs 2 --first | |
|
266 | 273 | |
|
267 | 274 | --- $TESTTMP/test-failure*.t (glob) |
|
268 | 275 | +++ $TESTTMP/test-failure*.t.err (glob) |
|
269 | 276 | @@ -1,4 +1,4 @@ |
|
270 | 277 | $ echo babar |
|
271 | 278 | - rataxes |
|
272 | 279 | + babar |
|
273 | 280 | This is a noop statement so that |
|
274 | 281 | this test is still more bytes than success. |
|
275 | 282 | |
|
276 | 283 | Failed test-failure*.t: output changed (glob) |
|
277 | 284 | Failed test-nothing.t: output changed |
|
278 | 285 | # Ran 2 tests, 0 skipped, 0 warned, 2 failed. |
|
279 | 286 | python hash seed: * (glob) |
|
280 | 287 | [1] |
|
281 | 288 | |
|
282 | 289 | |
|
283 | 290 | (delete the duplicated test file) |
|
284 | 291 | $ rm test-failure-copy.t test-nothing.t |
|
285 | 292 | |
|
286 | 293 | |
|
287 | 294 | Interactive run |
|
288 | 295 | =============== |
|
289 | 296 | |
|
290 | 297 | (backup the failing test) |
|
291 | 298 | $ cp test-failure.t backup |
|
292 | 299 | |
|
293 | 300 | Refuse the fix |
|
294 | 301 | |
|
295 | $ echo 'n' | run-tests.py --with-hg=`which hg` -i | |
|
302 | $ echo 'n' | rt -i | |
|
296 | 303 | |
|
297 | 304 | --- $TESTTMP/test-failure.t |
|
298 | 305 | +++ $TESTTMP/test-failure.t.err |
|
299 | 306 | @@ -1,4 +1,4 @@ |
|
300 | 307 | $ echo babar |
|
301 | 308 | - rataxes |
|
302 | 309 | + babar |
|
303 | 310 | This is a noop statement so that |
|
304 | 311 | this test is still more bytes than success. |
|
305 | 312 | Accept this change? [n] |
|
306 | 313 | ERROR: test-failure.t output changed |
|
307 | 314 | !. |
|
308 | 315 | Failed test-failure.t: output changed |
|
309 | 316 | # Ran 2 tests, 0 skipped, 0 warned, 1 failed. |
|
310 | 317 | python hash seed: * (glob) |
|
311 | 318 | [1] |
|
312 | 319 | |
|
313 | 320 | $ cat test-failure.t |
|
314 | 321 | $ echo babar |
|
315 | 322 | rataxes |
|
316 | 323 | This is a noop statement so that |
|
317 | 324 | this test is still more bytes than success. |
|
318 | 325 | |
|
319 | 326 | Interactive with custom view |
|
320 | 327 | |
|
321 |
$ echo 'n' | r |
|
|
328 | $ echo 'n' | rt -i --view echo | |
|
322 | 329 | $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob) |
|
323 | 330 | Accept this change? [n]* (glob) |
|
324 | 331 | ERROR: test-failure.t output changed |
|
325 | 332 | !. |
|
326 | 333 | Failed test-failure.t: output changed |
|
327 | 334 | # Ran 2 tests, 0 skipped, 0 warned, 1 failed. |
|
328 | 335 | python hash seed: * (glob) |
|
329 | 336 | [1] |
|
330 | 337 | |
|
331 | 338 | View the fix |
|
332 | 339 | |
|
333 |
$ echo 'y' | r |
|
|
340 | $ echo 'y' | rt --view echo | |
|
334 | 341 | $TESTTMP/test-failure.t $TESTTMP/test-failure.t.err (glob) |
|
335 | 342 | |
|
336 | 343 | ERROR: test-failure.t output changed |
|
337 | 344 | !. |
|
338 | 345 | Failed test-failure.t: output changed |
|
339 | 346 | # Ran 2 tests, 0 skipped, 0 warned, 1 failed. |
|
340 | 347 | python hash seed: * (glob) |
|
341 | 348 | [1] |
|
342 | 349 | |
|
343 | 350 | Accept the fix |
|
344 | 351 | |
|
345 | 352 | $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t |
|
346 | 353 | $ echo " saved backup bundle to \$TESTTMP/foo.hg" >> test-failure.t |
|
347 | 354 | $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t |
|
348 | 355 | $ echo " saved backup bundle to \$TESTTMP/foo.hg (glob)" >> test-failure.t |
|
349 | 356 | $ echo " $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t |
|
350 | 357 | $ echo " saved backup bundle to \$TESTTMP/*.hg (glob)" >> test-failure.t |
|
351 | $ echo 'y' | run-tests.py --with-hg=`which hg` -i 2>&1 | \ | |
|
352 | > sed -e 's,(glob)$,&<,g' | |
|
358 | $ echo 'y' | rt -i 2>&1 | |
|
353 | 359 | |
|
354 | 360 | --- $TESTTMP/test-failure.t |
|
355 | 361 | +++ $TESTTMP/test-failure.t.err |
|
356 | 362 | @@ -1,9 +1,9 @@ |
|
357 | 363 | $ echo babar |
|
358 | 364 | - rataxes |
|
359 | 365 | + babar |
|
360 | 366 | This is a noop statement so that |
|
361 | 367 | this test is still more bytes than success. |
|
362 | 368 | $ echo 'saved backup bundle to $TESTTMP/foo.hg' |
|
363 | 369 | - saved backup bundle to $TESTTMP/foo.hg |
|
364 |
+ saved backup bundle to $TESTTMP/foo.hg (glob) |
|
|
370 | + saved backup bundle to $TESTTMP/foo.hg* (glob) | |
|
365 | 371 | $ echo 'saved backup bundle to $TESTTMP/foo.hg' |
|
366 |
saved backup bundle to $TESTTMP/foo.hg (glob) |
|
|
372 | saved backup bundle to $TESTTMP/foo.hg* (glob) | |
|
367 | 373 | $ echo 'saved backup bundle to $TESTTMP/foo.hg' |
|
368 | 374 | Accept this change? [n] .. |
|
369 | 375 | # Ran 2 tests, 0 skipped, 0 warned, 0 failed. |
|
370 | 376 | |
|
371 | 377 | $ sed -e 's,(glob)$,&<,g' test-failure.t |
|
372 | 378 | $ echo babar |
|
373 | 379 | babar |
|
374 | 380 | This is a noop statement so that |
|
375 | 381 | this test is still more bytes than success. |
|
376 | 382 | $ echo 'saved backup bundle to $TESTTMP/foo.hg' |
|
377 | 383 | saved backup bundle to $TESTTMP/foo.hg (glob)< |
|
378 | 384 | $ echo 'saved backup bundle to $TESTTMP/foo.hg' |
|
379 | 385 | saved backup bundle to $TESTTMP/foo.hg (glob)< |
|
380 | 386 | $ echo 'saved backup bundle to $TESTTMP/foo.hg' |
|
381 | 387 | saved backup bundle to $TESTTMP/*.hg (glob)< |
|
382 | 388 | |
|
383 | 389 | (reinstall) |
|
384 | 390 | $ mv backup test-failure.t |
|
385 | 391 | |
|
386 | 392 | No Diff |
|
387 | 393 | =============== |
|
388 | 394 | |
|
389 | $ run-tests.py --with-hg=`which hg` --nodiff | |
|
395 | $ rt --nodiff | |
|
390 | 396 | !. |
|
391 | 397 | Failed test-failure.t: output changed |
|
392 | 398 | # Ran 2 tests, 0 skipped, 0 warned, 1 failed. |
|
393 | 399 | python hash seed: * (glob) |
|
394 | 400 | [1] |
|
395 | 401 | |
|
396 | 402 | test --tmpdir support |
|
397 |
$ r |
|
|
403 | $ rt --tmpdir=$TESTTMP/keep test-success.t | |
|
398 | 404 | |
|
399 | 405 | Keeping testtmp dir: $TESTTMP/keep/child1/test-success.t (glob) |
|
400 | 406 | Keeping threadtmp dir: $TESTTMP/keep/child1 (glob) |
|
401 | 407 | . |
|
402 | 408 | # Ran 1 tests, 0 skipped, 0 warned, 0 failed. |
|
403 | 409 | |
|
404 | 410 | timeouts |
|
405 | 411 | ======== |
|
406 | 412 | $ cat > test-timeout.t <<EOF |
|
407 | 413 | > $ sleep 2 |
|
408 | 414 | > $ echo pass |
|
409 | 415 | > pass |
|
410 | 416 | > EOF |
|
411 | 417 | > echo '#require slow' > test-slow-timeout.t |
|
412 | 418 | > cat test-timeout.t >> test-slow-timeout.t |
|
413 | $ run-tests.py --with-hg=`which hg` --timeout=1 --slowtimeout=3 \ | |
|
414 | > test-timeout.t test-slow-timeout.t | |
|
419 | $ rt --timeout=1 --slowtimeout=3 test-timeout.t test-slow-timeout.t | |
|
415 | 420 | st |
|
416 | 421 | Skipped test-slow-timeout.t: skipped |
|
417 | 422 | Failed test-timeout.t: timed out |
|
418 | 423 | # Ran 1 tests, 1 skipped, 0 warned, 1 failed. |
|
419 | 424 | python hash seed: * (glob) |
|
420 | 425 | [1] |
|
421 |
$ r |
|
|
426 | $ rt --timeout=1 --slowtimeout=3 \ | |
|
422 | 427 | > test-timeout.t test-slow-timeout.t --allow-slow-tests |
|
423 | 428 | .t |
|
424 | 429 | Failed test-timeout.t: timed out |
|
425 | 430 | # Ran 2 tests, 0 skipped, 0 warned, 1 failed. |
|
426 | 431 | python hash seed: * (glob) |
|
427 | 432 | [1] |
|
428 | 433 | $ rm test-timeout.t test-slow-timeout.t |
|
429 | 434 | |
|
430 | 435 | test for --time |
|
431 | 436 | ================== |
|
432 | 437 | |
|
433 |
$ r |
|
|
438 | $ rt test-success.t --time | |
|
434 | 439 | . |
|
435 | 440 | # Ran 1 tests, 0 skipped, 0 warned, 0 failed. |
|
436 | 441 | # Producing time report |
|
437 | 442 | start end cuser csys real Test |
|
438 | 443 | \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re) |
|
439 | 444 | |
|
440 | 445 | test for --time with --job enabled |
|
441 | 446 | ==================================== |
|
442 | 447 | |
|
443 |
$ r |
|
|
448 | $ rt test-success.t --time --jobs 2 | |
|
444 | 449 | . |
|
445 | 450 | # Ran 1 tests, 0 skipped, 0 warned, 0 failed. |
|
446 | 451 | # Producing time report |
|
447 | 452 | start end cuser csys real Test |
|
448 | 453 | \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} \s*[\d\.]{5} test-success.t (re) |
|
449 | 454 | |
|
450 | 455 | Skips |
|
451 | 456 | ================ |
|
452 | 457 | $ cat > test-skip.t <<EOF |
|
453 | 458 | > $ echo xyzzy |
|
454 | 459 | > #require false |
|
455 | 460 | > EOF |
|
456 | $ run-tests.py --with-hg=`which hg` --nodiff | |
|
461 | $ rt --nodiff | |
|
457 | 462 | !.s |
|
458 | 463 | Skipped test-skip.t: skipped |
|
459 | 464 | Failed test-failure.t: output changed |
|
460 | 465 | # Ran 2 tests, 1 skipped, 0 warned, 1 failed. |
|
461 | 466 | python hash seed: * (glob) |
|
462 | 467 | [1] |
|
463 | 468 | |
|
464 | $ run-tests.py --with-hg=`which hg` --keyword xyzzy | |
|
469 | $ rt --keyword xyzzy | |
|
465 | 470 | .s |
|
466 | 471 | Skipped test-skip.t: skipped |
|
467 | 472 | # Ran 2 tests, 2 skipped, 0 warned, 0 failed. |
|
468 | 473 | |
|
469 | 474 | Skips with xml |
|
470 |
$ r |
|
|
475 | $ rt --keyword xyzzy \ | |
|
471 | 476 | > --xunit=xunit.xml |
|
472 | 477 | .s |
|
473 | 478 | Skipped test-skip.t: skipped |
|
474 | 479 | # Ran 2 tests, 2 skipped, 0 warned, 0 failed. |
|
475 | 480 | $ cat xunit.xml |
|
476 | 481 | <?xml version="1.0" encoding="utf-8"?> |
|
477 | 482 | <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="2"> |
|
478 | 483 | <testcase name="test-success.t" time="*"/> (glob) |
|
479 | 484 | </testsuite> |
|
480 | 485 | |
|
481 | 486 | Missing skips or blacklisted skips don't count as executed: |
|
482 | 487 | $ echo test-failure.t > blacklist |
|
483 |
$ r |
|
|
488 | $ rt --blacklist=blacklist \ | |
|
484 | 489 | > test-failure.t test-bogus.t |
|
485 | 490 | ss |
|
486 | 491 | Skipped test-bogus.t: Doesn't exist |
|
487 | 492 | Skipped test-failure.t: blacklisted |
|
488 | 493 | # Ran 0 tests, 2 skipped, 0 warned, 0 failed. |
|
489 | 494 | |
|
490 | 495 | #if json |
|
491 | 496 | |
|
492 | 497 | test for --json |
|
493 | 498 | ================== |
|
494 | 499 | |
|
495 | $ run-tests.py --with-hg=`which hg` --json | |
|
500 | $ rt --json | |
|
496 | 501 | |
|
497 | 502 | --- $TESTTMP/test-failure.t |
|
498 | 503 | +++ $TESTTMP/test-failure.t.err |
|
499 | 504 | @@ -1,4 +1,4 @@ |
|
500 | 505 | $ echo babar |
|
501 | 506 | - rataxes |
|
502 | 507 | + babar |
|
503 | 508 | This is a noop statement so that |
|
504 | 509 | this test is still more bytes than success. |
|
505 | 510 | |
|
506 | 511 | ERROR: test-failure.t output changed |
|
507 | 512 | !.s |
|
508 | 513 | Skipped test-skip.t: skipped |
|
509 | 514 | Failed test-failure.t: output changed |
|
510 | 515 | # Ran 2 tests, 1 skipped, 0 warned, 1 failed. |
|
511 | 516 | python hash seed: * (glob) |
|
512 | 517 | [1] |
|
513 | 518 | |
|
514 | 519 | $ cat report.json |
|
515 | 520 | testreport ={ |
|
516 | 521 | "test-failure.t": [\{] (re) |
|
517 | 522 | "csys": "\s*[\d\.]{4,5}", ? (re) |
|
518 | 523 | "cuser": "\s*[\d\.]{4,5}", ? (re) |
|
519 | 524 | "end": "\s*[\d\.]{4,5}", ? (re) |
|
520 | 525 | "result": "failure", ? (re) |
|
521 | 526 | "start": "\s*[\d\.]{4,5}", ? (re) |
|
522 | 527 | "time": "\s*[\d\.]{4,5}" (re) |
|
523 | 528 | }, ? (re) |
|
524 | 529 | "test-skip.t": { |
|
525 | 530 | "csys": "\s*[\d\.]{4,5}", ? (re) |
|
526 | 531 | "cuser": "\s*[\d\.]{4,5}", ? (re) |
|
527 | 532 | "end": "\s*[\d\.]{4,5}", ? (re) |
|
528 | 533 | "result": "skip", ? (re) |
|
529 | 534 | "start": "\s*[\d\.]{4,5}", ? (re) |
|
530 | 535 | "time": "\s*[\d\.]{4,5}" (re) |
|
531 | 536 | }, ? (re) |
|
532 | 537 | "test-success.t": [\{] (re) |
|
533 | 538 | "csys": "\s*[\d\.]{4,5}", ? (re) |
|
534 | 539 | "cuser": "\s*[\d\.]{4,5}", ? (re) |
|
535 | 540 | "end": "\s*[\d\.]{4,5}", ? (re) |
|
536 | 541 | "result": "success", ? (re) |
|
537 | 542 | "start": "\s*[\d\.]{4,5}", ? (re) |
|
538 | 543 | "time": "\s*[\d\.]{4,5}" (re) |
|
539 | 544 | } |
|
540 | 545 | } (no-eol) |
|
541 | 546 | |
|
542 | 547 | Test that failed test accepted through interactive are properly reported: |
|
543 | 548 | |
|
544 | 549 | $ cp test-failure.t backup |
|
545 |
$ echo y | r |
|
|
550 | $ echo y | rt --json -i | |
|
546 | 551 | |
|
547 | 552 | --- $TESTTMP/test-failure.t |
|
548 | 553 | +++ $TESTTMP/test-failure.t.err |
|
549 | 554 | @@ -1,4 +1,4 @@ |
|
550 | 555 | $ echo babar |
|
551 | 556 | - rataxes |
|
552 | 557 | + babar |
|
553 | 558 | This is a noop statement so that |
|
554 | 559 | this test is still more bytes than success. |
|
555 | 560 | Accept this change? [n] ..s |
|
556 | 561 | Skipped test-skip.t: skipped |
|
557 | 562 | # Ran 2 tests, 1 skipped, 0 warned, 0 failed. |
|
558 | 563 | |
|
559 | 564 | $ cat report.json |
|
560 | 565 | testreport ={ |
|
561 | 566 | "test-failure.t": [\{] (re) |
|
562 | 567 | "csys": "\s*[\d\.]{4,5}", ? (re) |
|
563 | 568 | "cuser": "\s*[\d\.]{4,5}", ? (re) |
|
564 | 569 | "end": "\s*[\d\.]{4,5}", ? (re) |
|
565 | 570 | "result": "success", ? (re) |
|
566 | 571 | "start": "\s*[\d\.]{4,5}", ? (re) |
|
567 | 572 | "time": "\s*[\d\.]{4,5}" (re) |
|
568 | 573 | }, ? (re) |
|
569 | 574 | "test-skip.t": { |
|
570 | 575 | "csys": "\s*[\d\.]{4,5}", ? (re) |
|
571 | 576 | "cuser": "\s*[\d\.]{4,5}", ? (re) |
|
572 | 577 | "end": "\s*[\d\.]{4,5}", ? (re) |
|
573 | 578 | "result": "skip", ? (re) |
|
574 | 579 | "start": "\s*[\d\.]{4,5}", ? (re) |
|
575 | 580 | "time": "\s*[\d\.]{4,5}" (re) |
|
576 | 581 | }, ? (re) |
|
577 | 582 | "test-success.t": [\{] (re) |
|
578 | 583 | "csys": "\s*[\d\.]{4,5}", ? (re) |
|
579 | 584 | "cuser": "\s*[\d\.]{4,5}", ? (re) |
|
580 | 585 | "end": "\s*[\d\.]{4,5}", ? (re) |
|
581 | 586 | "result": "success", ? (re) |
|
582 | 587 | "start": "\s*[\d\.]{4,5}", ? (re) |
|
583 | 588 | "time": "\s*[\d\.]{4,5}" (re) |
|
584 | 589 | } |
|
585 | 590 | } (no-eol) |
|
586 | 591 | $ mv backup test-failure.t |
|
587 | 592 | |
|
588 | 593 | #endif |
|
589 | 594 | |
|
590 | 595 | backslash on end of line with glob matching is handled properly |
|
591 | 596 | |
|
592 | 597 | $ cat > test-glob-backslash.t << EOF |
|
593 | 598 | > $ echo 'foo bar \\' |
|
594 | 599 | > foo * \ (glob) |
|
595 | 600 | > EOF |
|
596 | 601 | |
|
597 |
$ r |
|
|
602 | $ rt test-glob-backslash.t | |
|
598 | 603 | . |
|
599 | 604 | # Ran 1 tests, 0 skipped, 0 warned, 0 failed. |
|
600 | 605 | |
|
601 | 606 | $ rm -f test-glob-backslash.t |
|
602 | 607 | |
|
603 | 608 | Test reusability for third party tools |
|
604 | 609 | ====================================== |
|
605 | 610 | |
|
606 | 611 | $ mkdir "$TESTTMP"/anothertests |
|
607 | 612 | $ cd "$TESTTMP"/anothertests |
|
608 | 613 | |
|
609 | 614 | test that `run-tests.py` can execute hghave, even if it runs not in |
|
610 | 615 | Mercurial source tree. |
|
611 | 616 | |
|
612 | 617 | $ cat > test-hghave.t <<EOF |
|
613 | 618 | > #require true |
|
614 | 619 | > $ echo foo |
|
615 | 620 | > foo |
|
616 | 621 | > EOF |
|
617 |
$ r |
|
|
622 | $ rt $HGTEST_RUN_TESTS_PURE test-hghave.t | |
|
618 | 623 | . |
|
619 | 624 | # Ran 1 tests, 0 skipped, 0 warned, 0 failed. |
|
620 | 625 | |
|
621 | 626 | test that RUNTESTDIR refers the directory, in which `run-tests.py` now |
|
622 | 627 | running is placed. |
|
623 | 628 | |
|
624 | 629 | $ cat > test-runtestdir.t <<EOF |
|
625 | 630 | > - $TESTDIR, in which test-run-tests.t is placed |
|
626 | 631 | > - \$TESTDIR, in which test-runtestdir.t is placed (expanded at runtime) |
|
627 | 632 | > - \$RUNTESTDIR, in which run-tests.py is placed (expanded at runtime) |
|
628 | 633 | > |
|
629 | 634 | > #if windows |
|
630 | 635 | > $ test "\$TESTDIR" = "$TESTTMP\anothertests" |
|
631 | 636 | > #else |
|
632 | 637 | > $ test "\$TESTDIR" = "$TESTTMP"/anothertests |
|
633 | 638 | > #endif |
|
634 | 639 | > $ test "\$RUNTESTDIR" = "$TESTDIR" |
|
635 | 640 | > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py |
|
636 | 641 | > #!/usr/bin/env python |
|
637 | 642 | > # |
|
638 | 643 | > # check-code - a style and portability checker for Mercurial |
|
639 | 644 | > EOF |
|
640 |
$ r |
|
|
645 | $ rt $HGTEST_RUN_TESTS_PURE test-runtestdir.t | |
|
641 | 646 | . |
|
642 | 647 | # Ran 1 tests, 0 skipped, 0 warned, 0 failed. |
|
643 | 648 | |
|
644 | 649 | #if execbit |
|
645 | 650 | |
|
646 | 651 | test that TESTDIR is referred in PATH |
|
647 | 652 | |
|
648 | 653 | $ cat > custom-command.sh <<EOF |
|
649 | 654 | > #!/bin/sh |
|
650 | 655 | > echo "hello world" |
|
651 | 656 | > EOF |
|
652 | 657 | $ chmod +x custom-command.sh |
|
653 | 658 | $ cat > test-testdir-path.t <<EOF |
|
654 | 659 | > $ custom-command.sh |
|
655 | 660 | > hello world |
|
656 | 661 | > EOF |
|
657 |
$ r |
|
|
662 | $ rt $HGTEST_RUN_TESTS_PURE test-testdir-path.t | |
|
658 | 663 | . |
|
659 | 664 | # Ran 1 tests, 0 skipped, 0 warned, 0 failed. |
|
660 | 665 | |
|
661 | 666 | #endif |
|
662 | 667 | |
|
663 | 668 | test support for --allow-slow-tests |
|
664 | 669 | $ cat > test-very-slow-test.t <<EOF |
|
665 | 670 | > #require slow |
|
666 | 671 | > $ echo pass |
|
667 | 672 | > pass |
|
668 | 673 | > EOF |
|
669 |
$ r |
|
|
674 | $ rt $HGTEST_RUN_TESTS_PURE test-very-slow-test.t | |
|
670 | 675 | s |
|
671 | 676 | Skipped test-very-slow-test.t: skipped |
|
672 | 677 | # Ran 0 tests, 1 skipped, 0 warned, 0 failed. |
|
673 |
$ r |
|
|
678 | $ rt $HGTEST_RUN_TESTS_PURE --allow-slow-tests test-very-slow-test.t | |
|
674 | 679 | . |
|
675 | 680 | # Ran 1 tests, 0 skipped, 0 warned, 0 failed. |
General Comments 0
You need to be logged in to leave comments.
Login now