@matheusbsbs / matheus-bagliano / commits / 41ac414ea2
Fork 0

Sane use of test_expect_failure

Originally, test_expect_failure was designed to be the opposite of test_expect_success, but this was a bad decision. Most tests run a series of commands that leads to the single command that needs to be tested, like this: test_expect_{success,failure} 'test title' ' setup1 && setup2 && setup3 && what is to be tested ' And expecting a failure exit from the whole sequence misses the point of writing tests. Your setup$N that are supposed to succeed may have failed without even reaching what you are trying to test. The only valid use of test_expect_failure is to check a trivial single command that is expected to fail, which is a minority in tests of Porcelain-ish commands. This large-ish patch rewrites all uses of test_expect_failure to use test_expect_success and rewrites the condition of what is tested, like this: test_expect_success 'test title' ' setup1 && setup2 && setup3 && ! this command should fail ' test_expect_failure is redefined to serve as a reminder that that test *should* succeed but due to a known breakage in git it currently does not pass. So if git-foo command should create a file 'bar' but you discovered a bug that it doesn't, you can write a test like this: test_expect_failure 'git-foo should create bar' ' rm -f bar && git foo && test -f bar ' This construct acts similar to test_expect_success, but instead of reporting "ok/FAIL" like test_expect_success does, the outcome is reported as "FIXED/still broken". Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Feb 1, 2008 at 01:50 UTC 41ac414ea2bef81af94474cbef25a38868b4788e
48 files changed +498 -427
t/README
+6 -8
@@ -160,14 +160,12 @@ library for your script to use.
160
161 - test_expect_failure <message> <script>
162
163 - This is the opposite of test_expect_success. If <script>
164 - yields success, test is considered a failure.
165 -
166 - Example:
167 -
168 - test_expect_failure \
169 - 'git-update-index without --add should fail adding.' \
170 - 'git-update-index should-be-empty'
163 + This is NOT the opposite of test_expect_success, but is used
164 + to mark a test that demonstrates a known breakage. Unlike
165 + the usual test_expect_success tests, which say "ok" on
166 + success and "FAIL" on failure, this will say "FIXED" on
167 + success and "still broken" on failure. Failures from these
168 + tests won't cause -i (immediate) to stop.
169
170 - test_debug <script>
171
t/t0000-basic.sh
+21 -9
@@ -46,13 +46,25 @@ test_expect_success \
46 '.git/objects should have 3 subdirectories.' \
47 'test $(wc -l < full-of-directories) = 3'
48
49 +################################################################
50 +# Test harness
51 +test_expect_success 'success is reported like this' '
52 + :
53 +'
54 +test_expect_failure 'pretend we have a known breakage' '
55 + false
56 +'
57 +test_expect_failure 'pretend we have fixed a known breakage' '
58 + :
59 +'
60 +
61 ################################################################
62 # Basics of the basics
63
64 # updating a new file without --add should fail.
53 -test_expect_failure \
54 - 'git update-index without --add should fail adding.' \
55 - 'git update-index should-be-empty'
65 +test_expect_success 'git update-index without --add should fail adding.' '
66 + ! git update-index should-be-empty
67 +'
68
69 # and with --add it should succeed, even if it is empty (it used to fail).
70 test_expect_success \
@@ -70,9 +82,9 @@ test_expect_success \
82
83 # Removing paths.
84 rm -f should-be-empty full-of-directories
73 -test_expect_failure \
74 - 'git update-index without --remove should fail removing.' \
75 - 'git update-index should-be-empty'
85 +test_expect_success 'git update-index without --remove should fail removing.' '
86 + ! git update-index should-be-empty
87 +'
88
89 test_expect_success \
90 'git update-index with --remove should be able to remove.' \
@@ -204,9 +216,9 @@ test_expect_success \
216 'put invalid objects into the index.' \
217 'git update-index --index-info < badobjects'
218
207 -test_expect_failure \
208 - 'writing this tree without --missing-ok.' \
209 - 'git write-tree'
219 +test_expect_success 'writing this tree without --missing-ok.' '
220 + ! git write-tree
221 +'
222
223 test_expect_success \
224 'writing this tree with --missing-ok.' \
t/t0030-stripspace.sh
+20 -20
@@ -243,14 +243,14 @@ test_expect_success \
243 test `printf "$ttt$sss$sss$sss" | git stripspace | wc -l` -gt 0
244 '
245
246 -test_expect_failure \
246 +test_expect_success \
247 'text plus spaces without newline at end should not show spaces' '
248 - printf "$ttt$sss" | git stripspace | grep -q " " ||
249 - printf "$ttt$ttt$sss" | git stripspace | grep -q " " ||
250 - printf "$ttt$ttt$ttt$sss" | git stripspace | grep -q " " ||
251 - printf "$ttt$sss$sss" | git stripspace | grep -q " " ||
252 - printf "$ttt$ttt$sss$sss" | git stripspace | grep -q " " ||
253 - printf "$ttt$sss$sss$sss" | git stripspace | grep -q " "
248 + ! (printf "$ttt$sss" | git stripspace | grep -q " ") &&
249 + ! (printf "$ttt$ttt$sss" | git stripspace | grep -q " ") &&
250 + ! (printf "$ttt$ttt$ttt$sss" | git stripspace | grep -q " ") &&
251 + ! (printf "$ttt$sss$sss" | git stripspace | grep -q " ") &&
252 + ! (printf "$ttt$ttt$sss$sss" | git stripspace | grep -q " ") &&
253 + ! (printf "$ttt$sss$sss$sss" | git stripspace | grep -q " ")
254 '
255
256 test_expect_success \
@@ -280,14 +280,14 @@ test_expect_success \
280 git diff expect actual
281 '
282
283 -test_expect_failure \
283 +test_expect_success \
284 'text plus spaces at end should not show spaces' '
285 - echo "$ttt$sss" | git stripspace | grep -q " " ||
286 - echo "$ttt$ttt$sss" | git stripspace | grep -q " " ||
287 - echo "$ttt$ttt$ttt$sss" | git stripspace | grep -q " " ||
288 - echo "$ttt$sss$sss" | git stripspace | grep -q " " ||
289 - echo "$ttt$ttt$sss$sss" | git stripspace | grep -q " " ||
290 - echo "$ttt$sss$sss$sss" | git stripspace | grep -q " "
285 + ! (echo "$ttt$sss" | git stripspace | grep -q " ") &&
286 + ! (echo "$ttt$ttt$sss" | git stripspace | grep -q " ") &&
287 + ! (echo "$ttt$ttt$ttt$sss" | git stripspace | grep -q " ") &&
288 + ! (echo "$ttt$sss$sss" | git stripspace | grep -q " ") &&
289 + ! (echo "$ttt$ttt$sss$sss" | git stripspace | grep -q " ") &&
290 + ! (echo "$ttt$sss$sss$sss" | git stripspace | grep -q " ")
291 '
292
293 test_expect_success \
@@ -339,13 +339,13 @@ test_expect_success \
339 git diff expect actual
340 '
341
342 -test_expect_failure \
342 +test_expect_success \
343 'spaces without newline at end should not show spaces' '
344 - printf "" | git stripspace | grep -q " " ||
345 - printf "$sss" | git stripspace | grep -q " " ||
346 - printf "$sss$sss" | git stripspace | grep -q " " ||
347 - printf "$sss$sss$sss" | git stripspace | grep -q " " ||
348 - printf "$sss$sss$sss$sss" | git stripspace | grep -q " "
344 + ! (printf "" | git stripspace | grep -q " ") &&
345 + ! (printf "$sss" | git stripspace | grep -q " ") &&
346 + ! (printf "$sss$sss" | git stripspace | grep -q " ") &&
347 + ! (printf "$sss$sss$sss" | git stripspace | grep -q " ") &&
348 + ! (printf "$sss$sss$sss$sss" | git stripspace | grep -q " ")
349 '
350
351 test_expect_success \
t/t0040-parse-options.sh
+2 -2
@@ -87,9 +87,9 @@ test_expect_success 'unambiguously abbreviated option with "="' '
87 git diff expect output
88 '
89
90 -test_expect_failure 'ambiguously abbreviated option' '
90 +test_expect_success 'ambiguously abbreviated option' '
91 test-parse-options --strin 123;
92 - test $? != 129
92 + test $? = 129
93 '
94
95 cat > expect << EOF
t/t1000-read-tree-m-3way.sh
+89 -72
@@ -210,12 +210,12 @@ DF (file) when tree B require DF to be a directory by having DF/DF
210
211 END_OF_CASE_TABLE
212
213 -test_expect_failure \
214 - '1 - must not have an entry not in A.' \
215 - "rm -f .git/index XX &&
213 +test_expect_success '1 - must not have an entry not in A.' "
214 + rm -f .git/index XX &&
215 echo XX >XX &&
216 git update-index --add XX &&
218 - git read-tree -m $tree_O $tree_A $tree_B"
217 + ! git read-tree -m $tree_O $tree_A $tree_B
218 +"
219
220 test_expect_success \
221 '2 - must match B in !O && !A && B case.' \
@@ -248,13 +248,14 @@ test_expect_success \
248 echo extra >>AN &&
249 git read-tree -m $tree_O $tree_A $tree_B"
250
251 -test_expect_failure \
252 - '3 (fail) - must match A in !O && A && !B case.' \
253 - "rm -f .git/index AN &&
251 +test_expect_success \
252 + '3 (fail) - must match A in !O && A && !B case.' "
253 + rm -f .git/index AN &&
254 cp .orig-A/AN AN &&
255 echo extra >>AN &&
256 git update-index --add AN &&
257 - git read-tree -m $tree_O $tree_A $tree_B"
257 + ! git read-tree -m $tree_O $tree_A $tree_B
258 +"
259
260 test_expect_success \
261 '4 - must match and be up-to-date in !O && A && B && A!=B case.' \
@@ -264,21 +265,23 @@ test_expect_success \
265 git read-tree -m $tree_O $tree_A $tree_B &&
266 check_result"
267
267 -test_expect_failure \
268 - '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' \
269 - "rm -f .git/index AA &&
268 +test_expect_success \
269 + '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' "
270 + rm -f .git/index AA &&
271 cp .orig-A/AA AA &&
272 git update-index --add AA &&
273 echo extra >>AA &&
273 - git read-tree -m $tree_O $tree_A $tree_B"
274 + ! git read-tree -m $tree_O $tree_A $tree_B
275 +"
276
275 -test_expect_failure \
276 - '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' \
277 - "rm -f .git/index AA &&
277 +test_expect_success \
278 + '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' "
279 + rm -f .git/index AA &&
280 cp .orig-A/AA AA &&
281 echo extra >>AA &&
282 git update-index --add AA &&
281 - git read-tree -m $tree_O $tree_A $tree_B"
283 + ! git read-tree -m $tree_O $tree_A $tree_B
284 +"
285
286 test_expect_success \
287 '5 - must match in !O && A && B && A==B case.' \
@@ -297,34 +300,38 @@ test_expect_success \
300 git read-tree -m $tree_O $tree_A $tree_B &&
301 check_result"
302
300 -test_expect_failure \
301 - '5 (fail) - must match A in !O && A && B && A==B case.' \
302 - "rm -f .git/index LL &&
303 +test_expect_success \
304 + '5 (fail) - must match A in !O && A && B && A==B case.' "
305 + rm -f .git/index LL &&
306 cp .orig-A/LL LL &&
307 echo extra >>LL &&
308 git update-index --add LL &&
306 - git read-tree -m $tree_O $tree_A $tree_B"
309 + ! git read-tree -m $tree_O $tree_A $tree_B
310 +"
311
308 -test_expect_failure \
309 - '6 - must not exist in O && !A && !B case' \
310 - "rm -f .git/index DD &&
312 +test_expect_success \
313 + '6 - must not exist in O && !A && !B case' "
314 + rm -f .git/index DD &&
315 echo DD >DD
316 git update-index --add DD &&
313 - git read-tree -m $tree_O $tree_A $tree_B"
317 + ! git read-tree -m $tree_O $tree_A $tree_B
318 +"
319
315 -test_expect_failure \
316 - '7 - must not exist in O && !A && B && O!=B case' \
317 - "rm -f .git/index DM &&
320 +test_expect_success \
321 + '7 - must not exist in O && !A && B && O!=B case' "
322 + rm -f .git/index DM &&
323 cp .orig-B/DM DM &&
324 git update-index --add DM &&
320 - git read-tree -m $tree_O $tree_A $tree_B"
325 + ! git read-tree -m $tree_O $tree_A $tree_B
326 +"
327
322 -test_expect_failure \
323 - '8 - must not exist in O && !A && B && O==B case' \
324 - "rm -f .git/index DN &&
328 +test_expect_success \
329 + '8 - must not exist in O && !A && B && O==B case' "
330 + rm -f .git/index DN &&
331 cp .orig-B/DN DN &&
332 git update-index --add DN &&
327 - git read-tree -m $tree_O $tree_A $tree_B"
333 + ! git read-tree -m $tree_O $tree_A $tree_B
334 +"
335
336 test_expect_success \
337 '9 - must match and be up-to-date in O && A && !B && O!=A case' \
@@ -334,21 +341,23 @@ test_expect_success \
341 git read-tree -m $tree_O $tree_A $tree_B &&
342 check_result"
343
337 -test_expect_failure \
338 - '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' \
339 - "rm -f .git/index MD &&
344 +test_expect_success \
345 + '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' "
346 + rm -f .git/index MD &&
347 cp .orig-A/MD MD &&
348 git update-index --add MD &&
349 echo extra >>MD &&
343 - git read-tree -m $tree_O $tree_A $tree_B"
350 + ! git read-tree -m $tree_O $tree_A $tree_B
351 +"
352
345 -test_expect_failure \
346 - '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' \
347 - "rm -f .git/index MD &&
353 +test_expect_success \
354 + '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' "
355 + rm -f .git/index MD &&
356 cp .orig-A/MD MD &&
357 echo extra >>MD &&
358 git update-index --add MD &&
351 - git read-tree -m $tree_O $tree_A $tree_B"
359 + ! git read-tree -m $tree_O $tree_A $tree_B
360 +"
361
362 test_expect_success \
363 '10 - must match and be up-to-date in O && A && !B && O==A case' \
@@ -358,21 +367,23 @@ test_expect_success \
367 git read-tree -m $tree_O $tree_A $tree_B &&
368 check_result"
369
361 -test_expect_failure \
362 - '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' \
363 - "rm -f .git/index ND &&
370 +test_expect_success \
371 + '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' "
372 + rm -f .git/index ND &&
373 cp .orig-A/ND ND &&
374 git update-index --add ND &&
375 echo extra >>ND &&
367 - git read-tree -m $tree_O $tree_A $tree_B"
376 + ! git read-tree -m $tree_O $tree_A $tree_B
377 +"
378
369 -test_expect_failure \
370 - '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' \
371 - "rm -f .git/index ND &&
379 +test_expect_success \
380 + '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' "
381 + rm -f .git/index ND &&
382 cp .orig-A/ND ND &&
383 echo extra >>ND &&
384 git update-index --add ND &&
375 - git read-tree -m $tree_O $tree_A $tree_B"
385 + ! git read-tree -m $tree_O $tree_A $tree_B
386 +"
387
388 test_expect_success \
389 '11 - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \
@@ -382,21 +393,23 @@ test_expect_success \
393 git read-tree -m $tree_O $tree_A $tree_B &&
394 check_result"
395
385 -test_expect_failure \
386 - '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \
387 - "rm -f .git/index MM &&
396 +test_expect_success \
397 + '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' "
398 + rm -f .git/index MM &&
399 cp .orig-A/MM MM &&
400 git update-index --add MM &&
401 echo extra >>MM &&
391 - git read-tree -m $tree_O $tree_A $tree_B"
402 + ! git read-tree -m $tree_O $tree_A $tree_B
403 +"
404
393 -test_expect_failure \
394 - '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \
395 - "rm -f .git/index MM &&
405 +test_expect_success \
406 + '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' "
407 + rm -f .git/index MM &&
408 cp .orig-A/MM MM &&
409 echo extra >>MM &&
410 git update-index --add MM &&
399 - git read-tree -m $tree_O $tree_A $tree_B"
411 + ! git read-tree -m $tree_O $tree_A $tree_B
412 +"
413
414 test_expect_success \
415 '12 - must match A in O && A && B && O!=A && A==B case' \
@@ -415,13 +428,14 @@ test_expect_success \
428 git read-tree -m $tree_O $tree_A $tree_B &&
429 check_result"
430
418 -test_expect_failure \
419 - '12 (fail) - must match A in O && A && B && O!=A && A==B case' \
420 - "rm -f .git/index SS &&
431 +test_expect_success \
432 + '12 (fail) - must match A in O && A && B && O!=A && A==B case' "
433 + rm -f .git/index SS &&
434 cp .orig-A/SS SS &&
435 echo extra >>SS &&
436 git update-index --add SS &&
424 - git read-tree -m $tree_O $tree_A $tree_B"
437 + ! git read-tree -m $tree_O $tree_A $tree_B
438 +"
439
440 test_expect_success \
441 '13 - must match A in O && A && B && O!=A && O==B case' \
@@ -457,21 +471,23 @@ test_expect_success \
471 git read-tree -m $tree_O $tree_A $tree_B &&
472 check_result"
473
460 -test_expect_failure \
461 - '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' \
462 - "rm -f .git/index NM &&
474 +test_expect_success \
475 + '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' "
476 + rm -f .git/index NM &&
477 cp .orig-A/NM NM &&
478 git update-index --add NM &&
479 echo extra >>NM &&
466 - git read-tree -m $tree_O $tree_A $tree_B"
480 + ! git read-tree -m $tree_O $tree_A $tree_B
481 +"
482
468 -test_expect_failure \
469 - '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' \
470 - "rm -f .git/index NM &&
483 +test_expect_success \
484 + '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' "
485 + rm -f .git/index NM &&
486 cp .orig-A/NM NM &&
487 echo extra >>NM &&
488 git update-index --add NM &&
474 - git read-tree -m $tree_O $tree_A $tree_B"
489 + ! git read-tree -m $tree_O $tree_A $tree_B
490 +"
491
492 test_expect_success \
493 '15 - must match A in O && A && B && O==A && O==B case' \
@@ -490,13 +506,14 @@ test_expect_success \
506 git read-tree -m $tree_O $tree_A $tree_B &&
507 check_result"
508
493 -test_expect_failure \
494 - '15 (fail) - must match A in O && A && B && O==A && O==B case' \
495 - "rm -f .git/index NN &&
509 +test_expect_success \
510 + '15 (fail) - must match A in O && A && B && O==A && O==B case' "
511 + rm -f .git/index NN &&
512 cp .orig-A/NN NN &&
513 echo extra >>NN &&
514 git update-index --add NN &&
499 - git read-tree -m $tree_O $tree_A $tree_B"
515 + ! git read-tree -m $tree_O $tree_A $tree_B
516 +"
517
518 # #16
519 test_expect_success \
t/t1200-tutorial.sh
+5 -3
@@ -101,8 +101,8 @@ echo "Play, play, play" >>hello
101 echo "Lots of fun" >>example
102 git commit -m 'Some fun.' -i hello example
103
104 -test_expect_failure 'git resolve now fails' '
105 - git merge -m "Merge work in mybranch" mybranch
104 +test_expect_success 'git resolve now fails' '
105 + ! git merge -m "Merge work in mybranch" mybranch
106 '
107
108 cat > hello << EOF
@@ -156,6 +156,8 @@ test_expect_success 'git show-branch' 'cmp show-branch2.expect show-branch2.outp
156
157 test_expect_success 'git repack' 'git repack'
158 test_expect_success 'git prune-packed' 'git prune-packed'
159 -test_expect_failure '-> only packed objects' 'find -type f .git/objects/[0-9a-f][0-9a-f]'
159 +test_expect_success '-> only packed objects' '
160 + ! find -type f .git/objects/[0-9a-f][0-9a-f]
161 +'
162
163 test_done
t/t1300-repo-config.sh
+23 -16
@@ -181,8 +181,9 @@ test_expect_success 'non-match' \
181 test_expect_success 'non-match value' \
182 'test wow = $(git config --get nextsection.nonewline !for)'
183
184 -test_expect_failure 'ambiguous get' \
185 - 'git config --get nextsection.nonewline'
184 +test_expect_success 'ambiguous get' '
185 + ! git config --get nextsection.nonewline
186 +'
187
188 test_expect_success 'get multivar' \
189 'git config --get-all nextsection.nonewline'
@@ -202,13 +203,17 @@ EOF
203
204 test_expect_success 'multivar replace' 'cmp .git/config expect'
205
205 -test_expect_failure 'ambiguous value' 'git config nextsection.nonewline'
206 +test_expect_success 'ambiguous value' '
207 + ! git config nextsection.nonewline
208 +'
209
207 -test_expect_failure 'ambiguous unset' \
208 - 'git config --unset nextsection.nonewline'
210 +test_expect_success 'ambiguous unset' '
211 + ! git config --unset nextsection.nonewline
212 +'
213
210 -test_expect_failure 'invalid unset' \
211 - 'git config --unset somesection.nonewline'
214 +test_expect_success 'invalid unset' '
215 + ! git config --unset somesection.nonewline
216 +'
217
218 git config --unset nextsection.nonewline "wow3$"
219
@@ -224,7 +229,7 @@ EOF
229
230 test_expect_success 'multivar unset' 'cmp .git/config expect'
231
227 -test_expect_failure 'invalid key' 'git config inval.2key blabla'
232 +test_expect_success 'invalid key' '! git config inval.2key blabla'
233
234 test_expect_success 'correct key' 'git config 123456.a123 987'
235
@@ -382,8 +387,9 @@ EOF
387
388 test_expect_success "rename succeeded" "git diff expect .git/config"
389
385 -test_expect_failure "rename non-existing section" \
386 - 'git config --rename-section branch."world domination" branch.drei'
390 +test_expect_success "rename non-existing section" '
391 + ! git config --rename-section branch."world domination" branch.drei
392 +'
393
394 test_expect_success "rename succeeded" "git diff expect .git/config"
395
@@ -494,14 +500,14 @@ test_expect_success bool '
500 done &&
501 cmp expect result'
502
497 -test_expect_failure 'invalid bool (--get)' '
503 +test_expect_success 'invalid bool (--get)' '
504
505 git config bool.nobool foobar &&
500 - git config --bool --get bool.nobool'
506 + ! git config --bool --get bool.nobool'
507
502 -test_expect_failure 'invalid bool (set)' '
508 +test_expect_success 'invalid bool (set)' '
509
504 - git config --bool bool.nobool foobar'
510 + ! git config --bool bool.nobool foobar'
511
512 rm .git/config
513
@@ -562,8 +568,9 @@ EOF
568
569 test_expect_success 'quoting' 'cmp .git/config expect'
570
565 -test_expect_failure 'key with newline' 'git config key.with\\\
566 -newline 123'
571 +test_expect_success 'key with newline' '
572 + ! git config "key.with
573 +newline" 123'
574
575 test_expect_success 'value with newline' 'git config key.sub value.with\\\
576 newline'
t/t1302-repo-version.sh
+3 -2
@@ -40,7 +40,8 @@ test_expect_success 'gitdir required mode on normal repos' '
40 (git apply --check --index test.patch &&
41 cd test && git apply --check --index ../test.patch)'
42
43 -test_expect_failure 'gitdir required mode on unsupported repo' '
44 - (cd test2 && git apply --check --index ../test.patch)'
43 +test_expect_success 'gitdir required mode on unsupported repo' '
44 + (cd test2 && ! git apply --check --index ../test.patch)
45 +'
46
47 test_done
t/t1400-update-ref.sh
+12 -12
@@ -51,23 +51,23 @@ test_expect_success \
51 test $B"' = $(cat .git/'"$m"')'
52 rm -f .git/$m
53
54 -test_expect_failure \
55 - '(not) create HEAD with old sha1' \
56 - "git update-ref HEAD $A $B"
57 -test_expect_failure \
58 - "(not) prior created .git/$m" \
59 - "test -f .git/$m"
54 +test_expect_success '(not) create HEAD with old sha1' "
55 + ! git update-ref HEAD $A $B
56 +"
57 +test_expect_success "(not) prior created .git/$m" "
58 + ! test -f .git/$m
59 +"
60 rm -f .git/$m
61
62 test_expect_success \
63 "create HEAD" \
64 "git update-ref HEAD $A"
65 -test_expect_failure \
66 - '(not) change HEAD with wrong SHA1' \
67 - "git update-ref HEAD $B $Z"
68 -test_expect_failure \
69 - "(not) changed .git/$m" \
70 - "test $B"' = $(cat .git/'"$m"')'
65 +test_expect_success '(not) change HEAD with wrong SHA1' "
66 + ! git update-ref HEAD $B $Z
67 +"
68 +test_expect_success "(not) changed .git/$m" "
69 + ! test $B"' = $(cat .git/'"$m"')
70 +'
71 rm -f .git/$m
72
73 : a repository with working tree always has reflog these days...
t/t2000-checkout-cache-clash.sh
+2 -2
@@ -36,9 +36,9 @@ mkdir path0
36 date >path0/file0
37 date >path1
38
39 -test_expect_failure \
39 +test_expect_success \
40 'git checkout-index without -f should fail on conflicting work tree.' \
41 - 'git checkout-index -a'
41 + '! git checkout-index -a'
42
43 test_expect_success \
44 'git checkout-index with -f should succeed.' \
t/t2002-checkout-cache-u.sh
+2 -2
@@ -16,12 +16,12 @@ echo frotz >path0 &&
16 git update-index --add path0 &&
17 t=$(git write-tree)'
18
19 -test_expect_failure \
19 +test_expect_success \
20 'without -u, git checkout-index smudges stat information.' '
21 rm -f path0 &&
22 git read-tree $t &&
23 git checkout-index -f -a &&
24 -git diff-files | diff - /dev/null'
24 +! git diff-files | diff - /dev/null'
25
26 test_expect_success \
27 'with -u, git checkout-index picks up stat information from new files.' '
t/t2008-checkout-subdir.sh
+8 -8
@@ -67,16 +67,16 @@ test_expect_success 'checkout with simple prefix' '
67
68 '
69
70 -test_expect_failure 'relative path outside tree should fail' \
71 - 'git checkout HEAD -- ../../Makefile'
70 +test_expect_success 'relative path outside tree should fail' \
71 + '! git checkout HEAD -- ../../Makefile'
72
73 -test_expect_failure 'incorrect relative path to file should fail (1)' \
74 - 'git checkout HEAD -- ../file0'
73 +test_expect_success 'incorrect relative path to file should fail (1)' \
74 + '! git checkout HEAD -- ../file0'
75
76 -test_expect_failure 'incorrect relative path should fail (2)' \
77 - '( cd dir1 && git checkout HEAD -- ./file0 )'
76 +test_expect_success 'incorrect relative path should fail (2)' \
77 + '( cd dir1 && ! git checkout HEAD -- ./file0 )'
78
79 -test_expect_failure 'incorrect relative path should fail (3)' \
80 - '( cd dir1 && git checkout HEAD -- ../../file0 )'
79 +test_expect_success 'incorrect relative path should fail (3)' \
80 + '( cd dir1 && ! git checkout HEAD -- ../../file0 )'
81
82 test_done
t/t2100-update-cache-badpath.sh
+2 -2
@@ -44,8 +44,8 @@ date >path1/file1
44
45 for p in path0/file0 path1/file1 path2 path3
46 do
47 - test_expect_failure \
47 + test_expect_success \
48 "git update-index to add conflicting path $p should fail." \
49 - "git update-index --add -- $p"
49 + "! git update-index --add -- $p"
50 done
51 test_done
t/t3020-ls-files-error-unmatch.sh
+2 -2
@@ -15,9 +15,9 @@ touch foo bar
15 git update-index --add foo bar
16 git-commit -m "add foo bar"
17
18 -test_expect_failure \
18 +test_expect_success \
19 'git ls-files --error-unmatch should fail with unmatched path.' \
20 - 'git ls-files --error-unmatch foo bar-does-not-match'
20 + '! git ls-files --error-unmatch foo bar-does-not-match'
21
22 test_expect_success \
23 'git ls-files --error-unmatch should succeed eith matched paths.' \
t/t3200-branch.sh
+19 -17
@@ -17,10 +17,11 @@ test_expect_success \
17 git-commit -m "Initial commit." &&
18 HEAD=$(git rev-parse --verify HEAD)'
19
20 -test_expect_failure \
21 - 'git branch --help should not have created a bogus branch' \
22 - 'git branch --help </dev/null >/dev/null 2>/dev/null || :
23 - test -f .git/refs/heads/--help'
20 +test_expect_success \
21 + 'git branch --help should not have created a bogus branch' '
22 + git branch --help </dev/null >/dev/null 2>/dev/null;
23 + ! test -f .git/refs/heads/--help
24 +'
25
26 test_expect_success \
27 'git branch abc should create a branch' \
@@ -71,17 +72,17 @@ test_expect_success \
72 git branch -m n/n n
73 test -f .git/logs/refs/heads/n'
74
74 -test_expect_failure \
75 - 'git branch -m o/o o should fail when o/p exists' \
76 - 'git branch o/o &&
75 +test_expect_success 'git branch -m o/o o should fail when o/p exists' '
76 + git branch o/o &&
77 git branch o/p &&
78 - git branch -m o/o o'
78 + ! git branch -m o/o o
79 +'
80
80 -test_expect_failure \
81 - 'git branch -m q r/q should fail when r exists' \
82 - 'git branch q &&
83 - git branch r &&
84 - git branch -m q r/q'
81 +test_expect_success 'git branch -m q r/q should fail when r exists' '
82 + git branch q &&
83 + git branch r &&
84 + ! git branch -m q r/q
85 +'
86
87 mv .git/config .git/config-saved
88
@@ -108,12 +109,13 @@ test_expect_success 'config information was renamed, too' \
109 "test $(git config branch.s.dummy) = Hello &&
110 ! git config branch.s/s/dummy"
111
111 -test_expect_failure \
112 - 'git branch -m u v should fail when the reflog for u is a symlink' \
113 - 'git branch -l u &&
112 +test_expect_success \
113 + 'git branch -m u v should fail when the reflog for u is a symlink' '
114 + git branch -l u &&
115 mv .git/logs/refs/heads/u real-u &&
116 ln -s real-u .git/logs/refs/heads/u &&
116 - git branch -m u v'
117 + ! git branch -m u v
118 +'
119
120 test_expect_success 'test tracking setup via --track' \
121 'git config remote.local.url . &&
t/t3210-pack-refs.sh
+13 -13
@@ -39,12 +39,12 @@ test_expect_success \
39 git show-ref b >result &&
40 diff expect result'
41
42 -test_expect_failure \
43 - 'git branch c/d should barf if branch c exists' \
44 - 'git branch c &&
42 +test_expect_success 'git branch c/d should barf if branch c exists' '
43 + git branch c &&
44 git pack-refs --all &&
46 - rm .git/refs/heads/c &&
47 - git branch c/d'
45 + rm -f .git/refs/heads/c &&
46 + ! git branch c/d
47 +'
48
49 test_expect_success \
50 'see if a branch still exists after git pack-refs --prune' \
@@ -54,11 +54,11 @@ test_expect_success \
54 git show-ref e >result &&
55 diff expect result'
56
57 -test_expect_failure \
58 - 'see if git pack-refs --prune remove ref files' \
59 - 'git branch f &&
57 +test_expect_success 'see if git pack-refs --prune remove ref files' '
58 + git branch f &&
59 git pack-refs --all --prune &&
61 - ls .git/refs/heads/f'
60 + ! test -f .git/refs/heads/f
61 +'
62
63 test_expect_success \
64 'git branch g should work when git branch g/h has been deleted' \
@@ -69,11 +69,11 @@ test_expect_success \
69 git pack-refs --all &&
70 git branch -d g'
71
72 -test_expect_failure \
73 - 'git branch i/j/k should barf if branch i exists' \
74 - 'git branch i &&
72 +test_expect_success 'git branch i/j/k should barf if branch i exists' '
73 + git branch i &&
74 git pack-refs --all --prune &&
76 - git branch i/j/k'
75 + ! git branch i/j/k
76 +'
77
78 test_expect_success \
79 'test git branch k after branch k/l/m and k/lm have been deleted' \
t/t3400-rebase.sh
+2 -2
@@ -42,9 +42,9 @@ test_expect_success \
42 test_expect_success 'rebase against master' '
43 git rebase master'
44
45 -test_expect_failure \
45 +test_expect_success \
46 'the rebase operation should not have destroyed author information' \
47 - 'git log | grep "Author:" | grep "<>"'
47 + '! git log | grep "Author:" | grep "<>"'
48
49 test_expect_success 'rebase after merge master' '
50 git reset --hard topic &&
t/t3403-rebase-skip.sh
+3 -3
@@ -31,8 +31,8 @@ test_expect_success setup '
31 git branch skip-merge skip-reference
32 '
33
34 -test_expect_failure 'rebase with git am -3 (default)' '
35 - git rebase master
34 +test_expect_success 'rebase with git am -3 (default)' '
35 + ! git rebase master
36 '
37
38 test_expect_success 'rebase --skip with am -3' '
@@ -53,7 +53,7 @@ test_expect_success 'rebase moves back to skip-reference' '
53
54 test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge'
55
56 -test_expect_failure 'rebase with --merge' 'git rebase --merge master'
56 +test_expect_success 'rebase with --merge' '! git rebase --merge master'
57
58 test_expect_success 'rebase --skip with --merge' '
59 git rebase --skip
t/t3600-rm.sh
+9 -8
@@ -59,15 +59,16 @@ test_expect_success \
59 echo "other content" > foo
60 git rm --cached foo'
61
62 -test_expect_failure \
63 - 'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' \
64 - 'echo content > foo
62 +test_expect_success \
63 + 'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' '
64 + echo content > foo
65 git add foo
66 git commit -m foo
67 echo "other content" > foo
68 git add foo
69 echo "yet another content" > foo
70 - git rm --cached foo'
70 + ! git rm --cached foo
71 +'
72
73 test_expect_success \
74 'Test that git rm --cached -f foo works in case where --cached only did not' \
@@ -106,9 +107,9 @@ embedded'"
107
108 if test "$test_failed_remove" = y; then
109 chmod a-w .
109 -test_expect_failure \
110 +test_expect_success \
111 'Test that "git rm -f" fails if its rm fails' \
111 - 'git rm -f baz'
112 + '! git rm -f baz'
113 chmod 775 .
114 else
115 test_expect_success 'skipping removal failure (perhaps running as root?)' :
@@ -212,8 +213,8 @@ test_expect_success 'Recursive with -r -f' '
213 ! test -d frotz
214 '
215
215 -test_expect_failure 'Remove nonexistent file returns nonzero exit status' '
216 - git rm nonexistent
216 +test_expect_success 'Remove nonexistent file returns nonzero exit status' '
217 + ! git rm nonexistent
218 '
219
220 test_done
t/t4103-apply-binary.sh
+36 -32
@@ -46,21 +46,25 @@ test_expect_success 'stat binary diff (copy) -- should not fail.' \
46 'git-checkout master
47 git apply --stat --summary C.diff'
48
49 -test_expect_failure 'check binary diff -- should fail.' \
50 - 'git-checkout master
51 - git apply --check B.diff'
52 -
53 -test_expect_failure 'check binary diff (copy) -- should fail.' \
54 - 'git-checkout master
55 - git apply --check C.diff'
56 -
57 -test_expect_failure 'check incomplete binary diff with replacement -- should fail.' \
58 - 'git-checkout master
59 - git apply --check --allow-binary-replacement B.diff'
49 +test_expect_success 'check binary diff -- should fail.' \
50 + 'git-checkout master &&
51 + ! git apply --check B.diff'
52 +
53 +test_expect_success 'check binary diff (copy) -- should fail.' \
54 + 'git-checkout master &&
55 + ! git apply --check C.diff'
56 +
57 +test_expect_success \
58 + 'check incomplete binary diff with replacement -- should fail.' '
59 + git-checkout master &&
60 + ! git apply --check --allow-binary-replacement B.diff
61 +'
62
61 -test_expect_failure 'check incomplete binary diff with replacement (copy) -- should fail.' \
62 - 'git-checkout master
63 - git apply --check --allow-binary-replacement C.diff'
63 +test_expect_success \
64 + 'check incomplete binary diff with replacement (copy) -- should fail.' '
65 + git-checkout master &&
66 + ! git apply --check --allow-binary-replacement C.diff
67 +'
68
69 test_expect_success 'check binary diff with replacement.' \
70 'git-checkout master
@@ -73,42 +77,42 @@ test_expect_success 'check binary diff with replacement (copy).' \
77 # Now we start applying them.
78
79 do_reset () {
76 - rm -f file?
77 - git-reset --hard
80 + rm -f file? &&
81 + git-reset --hard &&
82 git-checkout -f master
83 }
84
81 -test_expect_failure 'apply binary diff -- should fail.' \
82 - 'do_reset
83 - git apply B.diff'
85 +test_expect_success 'apply binary diff -- should fail.' \
86 + 'do_reset &&
87 + ! git apply B.diff'
88
85 -test_expect_failure 'apply binary diff -- should fail.' \
86 - 'do_reset
87 - git apply --index B.diff'
89 +test_expect_success 'apply binary diff -- should fail.' \
90 + 'do_reset &&
91 + ! git apply --index B.diff'
92
89 -test_expect_failure 'apply binary diff (copy) -- should fail.' \
90 - 'do_reset
91 - git apply C.diff'
93 +test_expect_success 'apply binary diff (copy) -- should fail.' \
94 + 'do_reset &&
95 + ! git apply C.diff'
96
93 -test_expect_failure 'apply binary diff (copy) -- should fail.' \
94 - 'do_reset
95 - git apply --index C.diff'
97 +test_expect_success 'apply binary diff (copy) -- should fail.' \
98 + 'do_reset &&
99 + ! git apply --index C.diff'
100
101 test_expect_success 'apply binary diff without replacement.' \
98 - 'do_reset
102 + 'do_reset &&
103 git apply BF.diff'
104
105 test_expect_success 'apply binary diff without replacement (copy).' \
102 - 'do_reset
106 + 'do_reset &&
107 git apply CF.diff'
108
109 test_expect_success 'apply binary diff.' \
106 - 'do_reset
110 + 'do_reset &&
111 git apply --allow-binary-replacement --index BF.diff &&
112 test -z "$(git diff --name-status binary)"'
113
114 test_expect_success 'apply binary diff (copy).' \
111 - 'do_reset
115 + 'do_reset &&
116 git apply --allow-binary-replacement --index CF.diff &&
117 test -z "$(git diff --name-status binary)"'
118
t/t4113-apply-ending.sh
+4 -4
@@ -29,8 +29,8 @@ test_expect_success setup \
29
30 # test
31
32 -test_expect_failure 'apply at the end' \
33 - 'git apply --index test-patch'
32 +test_expect_success 'apply at the end' \
33 + '! git apply --index test-patch'
34
35 cat >test-patch <<\EOF
36 diff a/file b/file
@@ -47,7 +47,7 @@ b
47 c'
48 git update-index file
49
50 -test_expect_failure 'apply at the beginning' \
51 - 'git apply --index test-patch'
50 +test_expect_success 'apply at the beginning' \
51 + '! git apply --index test-patch'
52
53 test_done
t/t5300-pack-object.sh
+2 -2
@@ -264,8 +264,8 @@ test_expect_success \
264 cp -f .git/objects/9d/235ed07cd19811a6ceb342de82f190e49c9f68 \
265 .git/objects/c8/2de19312b6c3695c0c18f70709a6c535682a67'
266
267 -test_expect_failure \
267 +test_expect_success \
268 'make sure index-pack detects the SHA1 collision' \
269 - 'git-index-pack -o bad.idx test-3.pack'
269 + '! git-index-pack -o bad.idx test-3.pack'
270
271 test_done
t/t5302-pack-index.sh
+16 -16
@@ -42,9 +42,9 @@ test_expect_success \
42 'both packs should be identical' \
43 'cmp "test-1-${pack1}.pack" "test-2-${pack2}.pack"'
44
45 -test_expect_failure \
45 +test_expect_success \
46 'index v1 and index v2 should be different' \
47 - 'cmp "test-1-${pack1}.idx" "test-2-${pack2}.idx"'
47 + '! cmp "test-1-${pack1}.idx" "test-2-${pack2}.idx"'
48
49 test_expect_success \
50 'index-pack with index version 1' \
@@ -78,9 +78,9 @@ test_expect_success \
78 'git verify-pack -v "test-3-${pack3}.pack"'
79
80 test "$have_64bits" &&
81 -test_expect_failure \
81 +test_expect_success \
82 '64-bit offsets: should be different from previous index v2 results' \
83 - 'cmp "test-2-${pack2}.idx" "test-3-${pack3}.idx"'
83 + '! cmp "test-2-${pack2}.idx" "test-3-${pack3}.idx"'
84
85 test "$have_64bits" &&
86 test_expect_success \
@@ -112,22 +112,22 @@ test_expect_success \
112 bs=1 count=20 conv=notrunc &&
113 git cat-file blob "$delta_sha1" > blob_2 )'
114
115 -test_expect_failure \
115 +test_expect_success \
116 '[index v1] 3) corrupted delta happily returned wrong data' \
117 - 'cmp blob_1 blob_2'
117 + '! cmp blob_1 blob_2'
118
119 -test_expect_failure \
119 +test_expect_success \
120 '[index v1] 4) confirm that the pack is actually corrupted' \
121 - 'git fsck --full $commit'
121 + '! git fsck --full $commit'
122
123 test_expect_success \
124 '[index v1] 5) pack-objects happily reuses corrupted data' \
125 'pack4=$(git pack-objects test-4 <obj-list) &&
126 test -f "test-4-${pack1}.pack"'
127
128 -test_expect_failure \
128 +test_expect_success \
129 '[index v1] 6) newly created pack is BAD !' \
130 - 'git verify-pack -v "test-4-${pack1}.pack"'
130 + '! git verify-pack -v "test-4-${pack1}.pack"'
131
132 test_expect_success \
133 '[index v2] 1) stream pack to repository' \
@@ -150,16 +150,16 @@ test_expect_success \
150 bs=1 count=20 conv=notrunc &&
151 git cat-file blob "$delta_sha1" > blob_4 )'
152
153 -test_expect_failure \
153 +test_expect_success \
154 '[index v2] 3) corrupted delta happily returned wrong data' \
155 - 'cmp blob_3 blob_4'
155 + '! cmp blob_3 blob_4'
156
157 -test_expect_failure \
157 +test_expect_success \
158 '[index v2] 4) confirm that the pack is actually corrupted' \
159 - 'git fsck --full $commit'
159 + '! git fsck --full $commit'
160
161 -test_expect_failure \
161 +test_expect_success \
162 '[index v2] 5) pack-objects refuses to reuse corrupted data' \
163 - 'git pack-objects test-5 <obj-list'
163 + '! git pack-objects test-5 <obj-list'
164
165 test_done
t/t5401-update-hooks.sh
+4 -4
@@ -60,8 +60,8 @@ echo STDERR post-update >&2
60 EOF
61 chmod u+x victim/.git/hooks/post-update
62
63 -test_expect_failure push '
64 - git-send-pack --force ./victim/.git master tofail >send.out 2>send.err
63 +test_expect_success push '
64 + ! git-send-pack --force ./victim/.git master tofail >send.out 2>send.err
65 '
66
67 test_expect_success 'updated as expected' '
@@ -112,8 +112,8 @@ test_expect_success 'all *-receive hook args are empty' '
112 ! test -s victim/.git/post-receive.args
113 '
114
115 -test_expect_failure 'send-pack produced no output' '
116 - test -s send.out
115 +test_expect_success 'send-pack produced no output' '
116 + ! test -s send.out
117 '
118
119 cat <<EOF >expect
t/t5402-post-merge-hook.sh
+2 -2
@@ -30,9 +30,9 @@ EOF
30 chmod u+x clone${clone}/.git/hooks/post-merge
31 done
32
33 -test_expect_failure 'post-merge does not run for up-to-date ' '
33 +test_expect_success 'post-merge does not run for up-to-date ' '
34 GIT_DIR=clone1/.git git merge $commit0 &&
35 - test -e clone1/.git/post-merge.args
35 + ! test -f clone1/.git/post-merge.args
36 '
37
38 test_expect_success 'post-merge runs as expected ' '
t/t5500-fetch-pack.sh
+2 -2
@@ -176,7 +176,7 @@ test_expect_success "deepening fetch in shallow repo" \
176 test_expect_success "clone shallow object count" \
177 "test \"count: 18\" = \"$(grep count count.shallow)\""
178
179 -test_expect_failure "pull in shallow repo with missing merge base" \
180 - "(cd shallow; git pull --depth 4 .. A)"
179 +test_expect_success "pull in shallow repo with missing merge base" \
180 + "(cd shallow && ! git pull --depth 4 .. A)"
181
182 test_done
t/t5510-fetch.sh
+6 -6
@@ -95,7 +95,7 @@ test_expect_success 'fetch following tags' '
95
96 '
97
98 -test_expect_failure 'fetch must not resolve short tag name' '
98 +test_expect_success 'fetch must not resolve short tag name' '
99
100 cd "$D" &&
101
@@ -103,11 +103,11 @@ test_expect_failure 'fetch must not resolve short tag name' '
103 cd five &&
104 git init &&
105
106 - git fetch .. anno:five
106 + ! git fetch .. anno:five
107
108 '
109
110 -test_expect_failure 'fetch must not resolve short remote name' '
110 +test_expect_success 'fetch must not resolve short remote name' '
111
112 cd "$D" &&
113 git-update-ref refs/remotes/six/HEAD HEAD
@@ -116,7 +116,7 @@ test_expect_failure 'fetch must not resolve short remote name' '
116 cd six &&
117 git init &&
118
119 - git fetch .. six:six
119 + ! git fetch .. six:six
120
121 '
122
@@ -139,10 +139,10 @@ test_expect_success 'create bundle 2' '
139 git bundle create bundle2 master~2..master
140 '
141
142 -test_expect_failure 'unbundle 1' '
142 +test_expect_success 'unbundle 1' '
143 cd "$D/bundle" &&
144 git checkout -b some-branch &&
145 - git fetch "$D/bundle1" master:master
145 + ! git fetch "$D/bundle1" master:master
146 '
147
148 test_expect_success 'bundle 1 has only 3 files ' '
t/t5530-upload-pack-error.sh
+6 -8
@@ -26,9 +26,8 @@ test_expect_success 'setup and corrupt repository' '
26
27 '
28
29 -test_expect_failure 'fsck fails' '
30 -
31 - git fsck
29 +test_expect_success 'fsck fails' '
30 + ! git fsck
31 '
32
33 test_expect_success 'upload-pack fails due to error in pack-objects' '
@@ -46,9 +45,8 @@ test_expect_success 'corrupt repo differently' '
45
46 '
47
49 -test_expect_failure 'fsck fails' '
50 -
51 - git fsck
48 +test_expect_success 'fsck fails' '
49 + ! git fsck
50 '
51 test_expect_success 'upload-pack fails due to error in rev-list' '
52
@@ -66,9 +64,9 @@ test_expect_success 'create empty repository' '
64
65 '
66
69 -test_expect_failure 'fetch fails' '
67 +test_expect_success 'fetch fails' '
68
71 - git fetch .. master
69 + ! git fetch .. master
70
71 '
72
t/t5600-clone-fail-cleanup.sh
+6 -6
@@ -11,13 +11,13 @@ remove the directory before attempting a clone again.'
11
12 . ./test-lib.sh
13
14 -test_expect_failure \
14 +test_expect_success \
15 'clone of non-existent source should fail' \
16 - 'git-clone foo bar'
16 + '! git-clone foo bar'
17
18 -test_expect_failure \
18 +test_expect_success \
19 'failed clone should not leave a directory' \
20 - 'cd bar'
20 + '! test -d bar'
21
22 # Need a repo to clone
23 test_create_repo foo
@@ -27,9 +27,9 @@ test_create_repo foo
27
28 # source repository given to git-clone should be relative to the
29 # current path not to the target dir
30 -test_expect_failure \
30 +test_expect_success \
31 'clone of non-existent (relative to $PWD) source should fail' \
32 - 'git-clone ../foo baz'
32 + '! git-clone ../foo baz'
33
34 test_expect_success \
35 'clone should work now that source exists' \
t/t5710-info-alternate.sh
+8 -6
@@ -87,10 +87,10 @@ test_valid_repo"
87
88 cd "$base_dir"
89
90 -test_expect_failure 'that info/alternates is necessary' \
90 +test_expect_success 'that info/alternates is necessary' \
91 'cd C &&
92 -rm .git/objects/info/alternates &&
93 -test_valid_repo'
92 +rm -f .git/objects/info/alternates &&
93 +! (test_valid_repo)'
94
95 cd "$base_dir"
96
@@ -101,9 +101,11 @@ test_valid_repo'
101
102 cd "$base_dir"
103
104 -test_expect_failure 'that relative alternate is only possible for current dir' \
105 -'cd D &&
106 -test_valid_repo'
104 +test_expect_success \
105 + 'that relative alternate is only possible for current dir' '
106 + cd D &&
107 + ! (test_valid_repo)
108 +'
109
110 cd "$base_dir"
111
t/t6023-merge-file.sh
+6 -6
@@ -66,8 +66,8 @@ test_expect_success "merge result added missing LF" \
66 "git diff test.txt test2.txt"
67
68 cp test.txt backup.txt
69 -test_expect_failure "merge with conflicts" \
70 - "git merge-file test.txt orig.txt new3.txt"
69 +test_expect_success "merge with conflicts" \
70 + "! git merge-file test.txt orig.txt new3.txt"
71
72 cat > expect.txt << EOF
73 <<<<<<< test.txt
@@ -89,8 +89,8 @@ EOF
89 test_expect_success "expected conflict markers" "git diff test.txt expect.txt"
90
91 cp backup.txt test.txt
92 -test_expect_failure "merge with conflicts, using -L" \
93 - "git merge-file -L 1 -L 2 test.txt orig.txt new3.txt"
92 +test_expect_success "merge with conflicts, using -L" \
93 + "! git merge-file -L 1 -L 2 test.txt orig.txt new3.txt"
94
95 cat > expect.txt << EOF
96 <<<<<<< 1
@@ -113,8 +113,8 @@ test_expect_success "expected conflict markers, with -L" \
113 "git diff test.txt expect.txt"
114
115 sed "s/ tu / TU /" < new1.txt > new5.txt
116 -test_expect_failure "conflict in removed tail" \
117 - "git merge-file -p orig.txt new1.txt new5.txt > out"
116 +test_expect_success "conflict in removed tail" \
117 + "! git merge-file -p orig.txt new1.txt new5.txt > out"
118
119 cat > expect << EOF
120 Dominus regit me,
t/t6024-recursive-merge.sh
+1 -1
@@ -60,7 +60,7 @@ git update-index a1 &&
60 GIT_AUTHOR_DATE="2006-12-12 23:00:08" git commit -m F
61 '
62
63 -test_expect_failure "combined merge conflicts" "git merge -m final G"
63 +test_expect_success "combined merge conflicts" "! git merge -m final G"
64
65 cat > expect << EOF
66 <<<<<<< HEAD:a1
t/t6025-merge-symlinks.sh
+10 -11
@@ -30,30 +30,29 @@ echo plain-file > symlink &&
30 git add symlink &&
31 git-commit -m b-file'
32
33 -test_expect_failure \
33 +test_expect_success \
34 'merge master into b-symlink, which has a different symbolic link' '
35 -! git-checkout b-symlink ||
36 -git-merge master'
35 +git-checkout b-symlink &&
36 +! git-merge master'
37
38 test_expect_success \
39 'the merge result must be a file' '
40 test -f symlink'
41
42 -test_expect_failure \
42 +test_expect_success \
43 'merge master into b-file, which has a file instead of a symbolic link' '
44 -! (git-reset --hard &&
45 -git-checkout b-file) ||
46 -git-merge master'
44 +git-reset --hard && git-checkout b-file &&
45 +! git-merge master'
46
47 test_expect_success \
48 'the merge result must be a file' '
49 test -f symlink'
50
52 -test_expect_failure \
51 +test_expect_success \
52 'merge b-file, which has a file instead of a symbolic link, into master' '
54 -! (git-reset --hard &&
55 -git-checkout master) ||
56 -git-merge b-file'
53 +git-reset --hard &&
54 +git-checkout master &&
55 +! git-merge b-file'
56
57 test_expect_success \
58 'the merge result must be a file' '
t/t6101-rev-parse-parents.sh
+1 -1
@@ -26,7 +26,7 @@ test_expect_success 'final^1^1^1 = final^^^' "test $(git rev-parse final^1^1^1)
26 test_expect_success 'final^1^2' "test $(git rev-parse start2) = $(git rev-parse final^1^2)"
27 test_expect_success 'final^1^2 != final^1^1' "test $(git rev-parse final^1^2) != $(git rev-parse final^1^1)"
28 test_expect_success 'final^1^3 not valid' "if git rev-parse --verify final^1^3; then false; else :; fi"
29 -test_expect_failure '--verify start2^1' 'git rev-parse --verify start2^1'
29 +test_expect_success '--verify start2^1' '! git rev-parse --verify start2^1'
30 test_expect_success '--verify start2^0' 'git rev-parse --verify start2^0'
31
32 test_expect_success 'repack for next test' 'git repack -a -d'
t/t6300-for-each-ref.sh
+4 -4
@@ -43,8 +43,8 @@ test_expect_success 'Check atom names are valid' '
43 test -z "$bad"
44 '
45
46 -test_expect_failure 'Check invalid atoms names are errors' '
47 - git-for-each-ref --format="%(INVALID)" refs/heads
46 +test_expect_success 'Check invalid atoms names are errors' '
47 + ! git-for-each-ref --format="%(INVALID)" refs/heads
48 '
49
50 test_expect_success 'Check format specifiers are ignored in naming date atoms' '
@@ -63,8 +63,8 @@ test_expect_success 'Check valid format specifiers for date fields' '
63 git-for-each-ref --format="%(authordate:rfc2822)" refs/heads
64 '
65
66 -test_expect_failure 'Check invalid format specifiers are errors' '
67 - git-for-each-ref --format="%(authordate:INVALID)" refs/heads
66 +test_expect_success 'Check invalid format specifiers are errors' '
67 + ! git-for-each-ref --format="%(authordate:INVALID)" refs/heads
68 '
69
70 cat >expected <<\EOF
t/t7001-mv.sh
+2 -2
@@ -78,9 +78,9 @@ test_expect_success \
78 git diff-tree -r -M --name-status HEAD^ HEAD | \
79 grep "^R100..*path2/README..*path1/path2/README"'
80
81 -test_expect_failure \
81 +test_expect_success \
82 'do not move directory over existing directory' \
83 - 'mkdir path0 && mkdir path0/path2 && git mv path2 path0'
83 + 'mkdir path0 && mkdir path0/path2 && ! git mv path2 path0'
84
85 test_expect_success \
86 'move into "."' \
t/t7002-grep.sh
+2 -2
@@ -107,8 +107,8 @@ do
107 diff expected actual
108 '
109
110 - test_expect_failure "grep -c $L (no /dev/null)" '
111 - git grep -c test $H | grep -q "/dev/null"
110 + test_expect_success "grep -c $L (no /dev/null)" '
111 + ! git grep -c test $H | grep -q /dev/null
112 '
113
114 done
t/t7004-tag.sh
+18 -18
@@ -26,8 +26,8 @@ test_expect_success 'listing all tags in an empty tree should output nothing' '
26 test `git-tag | wc -l` -eq 0
27 '
28
29 -test_expect_failure 'looking for a tag in an empty tree should fail' \
30 - 'tag_exists mytag'
29 +test_expect_success 'looking for a tag in an empty tree should fail' \
30 + '! (tag_exists mytag)'
31
32 test_expect_success 'creating a tag in an empty tree should fail' '
33 ! git-tag mynotag &&
@@ -83,9 +83,9 @@ test_expect_success \
83
84 # special cases for creating tags:
85
86 -test_expect_failure \
86 +test_expect_success \
87 'trying to create a tag with the name of one existing should fail' \
88 - 'git tag mytag'
88 + '! git tag mytag'
89
90 test_expect_success \
91 'trying to create a tag with a non-valid name should fail' '
@@ -146,8 +146,8 @@ test_expect_success \
146 ! tag_exists myhead
147 '
148
149 -test_expect_failure 'trying to delete an already deleted tag should fail' \
150 - 'git-tag -d mytag'
149 +test_expect_success 'trying to delete an already deleted tag should fail' \
150 + '! git-tag -d mytag'
151
152 # listing various tags with pattern matching:
153
@@ -265,16 +265,16 @@ test_expect_success \
265 test $(git rev-parse non-annotated-tag) = $(git rev-parse HEAD)
266 '
267
268 -test_expect_failure 'trying to verify an unknown tag should fail' \
269 - 'git-tag -v unknown-tag'
268 +test_expect_success 'trying to verify an unknown tag should fail' \
269 + '! git-tag -v unknown-tag'
270
271 -test_expect_failure \
271 +test_expect_success \
272 'trying to verify a non-annotated and non-signed tag should fail' \
273 - 'git-tag -v non-annotated-tag'
273 + '! git-tag -v non-annotated-tag'
274
275 -test_expect_failure \
275 +test_expect_success \
276 'trying to verify many non-annotated or unknown tags, should fail' \
277 - 'git-tag -v unknown-tag1 non-annotated-tag unknown-tag2'
277 + '! git-tag -v unknown-tag1 non-annotated-tag unknown-tag2'
278
279 # creating annotated tags:
280
@@ -1027,21 +1027,21 @@ test_expect_success \
1027
1028 # try to sign with bad user.signingkey
1029 git config user.signingkey BobTheMouse
1030 -test_expect_failure \
1030 +test_expect_success \
1031 'git-tag -s fails if gpg is misconfigured' \
1032 - 'git tag -s -m tail tag-gpg-failure'
1032 + '! git tag -s -m tail tag-gpg-failure'
1033 git config --unset user.signingkey
1034
1035 # try to verify without gpg:
1036
1037 rm -rf gpghome
1038 -test_expect_failure \
1038 +test_expect_success \
1039 'verify signed tag fails when public key is not present' \
1040 - 'git-tag -v signed-tag'
1040 + '! git-tag -v signed-tag'
1041
1042 -test_expect_failure \
1042 +test_expect_success \
1043 'git-tag -a fails if tag annotation is empty' '
1044 - GIT_EDITOR=cat git tag -a initial-comment
1044 + ! (GIT_EDITOR=cat git tag -a initial-comment)
1045 '
1046
1047 test_expect_success \
t/t7101-reset.sh
+12 -12
@@ -36,28 +36,28 @@ test_expect_success \
36 'test -d path0 &&
37 test -f path0/COPYING'
38
39 -test_expect_failure \
39 +test_expect_success \
40 'checking lack of path1/path2/COPYING' \
41 - 'test -f path1/path2/COPYING'
41 + '! test -f path1/path2/COPYING'
42
43 -test_expect_failure \
43 +test_expect_success \
44 'checking lack of path1/COPYING' \
45 - 'test -f path1/COPYING'
45 + '! test -f path1/COPYING'
46
47 -test_expect_failure \
47 +test_expect_success \
48 'checking lack of COPYING' \
49 - 'test -f COPYING'
49 + '! test -f COPYING'
50
51 -test_expect_failure \
51 +test_expect_success \
52 'checking checking lack of path1/COPYING-TOO' \
53 - 'test -f path0/COPYING-TOO'
53 + '! test -f path0/COPYING-TOO'
54
55 -test_expect_failure \
55 +test_expect_success \
56 'checking lack of path1/path2' \
57 - 'test -d path1/path2'
57 + '! test -d path1/path2'
58
59 -test_expect_failure \
59 +test_expect_success \
60 'checking lack of path1' \
61 - 'test -d path1'
61 + '! test -d path1'
62
63 test_done
t/t7501-commit.sh
+20 -20
@@ -17,49 +17,49 @@ test_expect_success \
17 git-add file && \
18 git-status | grep 'Initial commit'"
19
20 -test_expect_failure \
20 +test_expect_success \
21 "fail initial amend" \
22 - "git-commit --amend"
22 + "! git-commit --amend"
23
24 test_expect_success \
25 "initial commit" \
26 "git-commit -m initial"
27
28 -test_expect_failure \
28 +test_expect_success \
29 "invalid options 1" \
30 - "git-commit -m foo -m bar -F file"
30 + "! git-commit -m foo -m bar -F file"
31
32 -test_expect_failure \
32 +test_expect_success \
33 "invalid options 2" \
34 - "git-commit -C HEAD -m illegal"
34 + "! git-commit -C HEAD -m illegal"
35
36 -test_expect_failure \
36 +test_expect_success \
37 "using paths with -a" \
38 "echo King of the bongo >file &&
39 - git-commit -m foo -a file"
39 + ! git-commit -m foo -a file"
40
41 -test_expect_failure \
41 +test_expect_success \
42 "using paths with --interactive" \
43 "echo bong-o-bong >file &&
44 - echo 7 | git-commit -m foo --interactive file"
44 + ! echo 7 | git-commit -m foo --interactive file"
45
46 -test_expect_failure \
46 +test_expect_success \
47 "using invalid commit with -C" \
48 - "git-commit -C bogus"
48 + "! git-commit -C bogus"
49
50 -test_expect_failure \
50 +test_expect_success \
51 "testing nothing to commit" \
52 - "git-commit -m initial"
52 + "! git-commit -m initial"
53
54 test_expect_success \
55 "next commit" \
56 "echo 'bongo bongo bongo' >file \
57 git-commit -m next -a"
58
59 -test_expect_failure \
59 +test_expect_success \
60 "commit message from non-existing file" \
61 "echo 'more bongo: bongo bongo bongo bongo' >file && \
62 - git-commit -F gah -a"
62 + ! git-commit -F gah -a"
63
64 # Empty except stray tabs and spaces on a few lines.
65 sed -e 's/@$//' >msg <<EOF
@@ -68,9 +68,9 @@ sed -e 's/@$//' >msg <<EOF
68 @
69 Signed-off-by: hula
70 EOF
71 -test_expect_failure \
71 +test_expect_success \
72 "empty commit message" \
73 - "git-commit -F msg -a"
73 + "! git-commit -F msg -a"
74
75 test_expect_success \
76 "commit message from file" \
@@ -88,10 +88,10 @@ test_expect_success \
88 "amend commit" \
89 "VISUAL=./editor git-commit --amend"
90
91 -test_expect_failure \
91 +test_expect_success \
92 "passing -m and -F" \
93 "echo 'enough with the bongos' >file && \
94 - git-commit -F msg -m amending ."
94 + ! git-commit -F msg -m amending ."
95
96 test_expect_success \
97 "using message from other commit" \
t/t7503-pre-commit-hook.sh
+2 -2
@@ -52,11 +52,11 @@ cat > "$HOOK" <<EOF
52 exit 1
53 EOF
54
55 -test_expect_failure 'with failing hook' '
55 +test_expect_success 'with failing hook' '
56
57 echo "another" >> file &&
58 git add file &&
59 - git commit -m "another"
59 + ! git commit -m "another"
60
61 '
62
t/t7504-commit-msg-hook.sh
+4 -4
@@ -98,20 +98,20 @@ cat > "$HOOK" <<EOF
98 exit 1
99 EOF
100
101 -test_expect_failure 'with failing hook' '
101 +test_expect_success 'with failing hook' '
102
103 echo "another" >> file &&
104 git add file &&
105 - git commit -m "another"
105 + ! git commit -m "another"
106
107 '
108
109 -test_expect_failure 'with failing hook (editor)' '
109 +test_expect_success 'with failing hook (editor)' '
110
111 echo "more another" >> file &&
112 git add file &&
113 echo "more another" > FAKE_MSG &&
114 - GIT_EDITOR="$FAKE_EDITOR" git commit
114 + ! (GIT_EDITOR="$FAKE_EDITOR" git commit)
115
116 '
117
t/t9100-git-svn-basic.sh
+14 -14
@@ -56,19 +56,19 @@ test_expect_success "$name" "
56
57
58 name='detect node change from file to directory #1'
59 -test_expect_failure "$name" "
59 +test_expect_success "$name" "
60 mkdir dir/new_file &&
61 mv dir/file dir/new_file/file &&
62 mv dir/new_file dir/file &&
63 git update-index --remove dir/file &&
64 git update-index --add dir/file/file &&
65 - git commit -m '$name' &&
66 - git-svn set-tree --find-copies-harder --rmdir \
65 + git commit -m '$name' &&
66 + ! git-svn set-tree --find-copies-harder --rmdir \
67 remotes/git-svn..mybranch" || true
68
69
70 name='detect node change from directory to file #1'
71 -test_expect_failure "$name" "
71 +test_expect_success "$name" "
72 rm -rf dir '$GIT_DIR'/index &&
73 git checkout -f -b mybranch2 remotes/git-svn &&
74 mv bar/zzz zzz &&
@@ -77,12 +77,12 @@ test_expect_failure "$name" "
77 git update-index --remove -- bar/zzz &&
78 git update-index --add -- bar &&
79 git commit -m '$name' &&
80 - git-svn set-tree --find-copies-harder --rmdir \
80 + ! git-svn set-tree --find-copies-harder --rmdir \
81 remotes/git-svn..mybranch2" || true
82
83
84 name='detect node change from file to directory #2'
85 -test_expect_failure "$name" "
85 +test_expect_success "$name" "
86 rm -f '$GIT_DIR'/index &&
87 git checkout -f -b mybranch3 remotes/git-svn &&
88 rm bar/zzz &&
@@ -91,12 +91,12 @@ test_expect_failure "$name" "
91 echo yyy > bar/zzz/yyy &&
92 git update-index --add bar/zzz/yyy &&
93 git commit -m '$name' &&
94 - git-svn set-tree --find-copies-harder --rmdir \
94 + ! git-svn set-tree --find-copies-harder --rmdir \
95 remotes/git-svn..mybranch3" || true
96
97
98 name='detect node change from directory to file #2'
99 -test_expect_failure "$name" "
99 +test_expect_success "$name" "
100 rm -f '$GIT_DIR'/index &&
101 git checkout -f -b mybranch4 remotes/git-svn &&
102 rm -rf dir &&
@@ -105,7 +105,7 @@ test_expect_failure "$name" "
105 echo asdf > dir &&
106 git update-index --add -- dir &&
107 git commit -m '$name' &&
108 - git-svn set-tree --find-copies-harder --rmdir \
108 + ! git-svn set-tree --find-copies-harder --rmdir \
109 remotes/git-svn..mybranch4" || true
110
111
@@ -213,18 +213,18 @@ EOF
213
214 test_expect_success "$name" "git diff a expected"
215
216 -test_expect_failure 'exit if remote refs are ambigious' "
216 +test_expect_success 'exit if remote refs are ambigious' "
217 git config --add svn-remote.svn.fetch \
218 bar:refs/remotes/git-svn &&
219 - git-svn migrate
220 - "
219 + ! git-svn migrate
220 +"
221
222 -test_expect_failure 'exit if init-ing a would clobber a URL' "
222 +test_expect_success 'exit if init-ing a would clobber a URL' "
223 svnadmin create ${PWD}/svnrepo2 &&
224 svn mkdir -m 'mkdir bar' ${svnrepo}2/bar &&
225 git config --unset svn-remote.svn.fetch \
226 '^bar:refs/remotes/git-svn$' &&
227 - git-svn init ${svnrepo}2/bar
227 + ! git-svn init ${svnrepo}2/bar
228 "
229
230 test_expect_success \
t/t9106-git-svn-commit-diff-clobber.sh
+9 -9
@@ -24,11 +24,11 @@ test_expect_success 'commit change from svn side' "
24 rm -rf t.svn
25 "
26
27 -test_expect_failure 'commit conflicting change from git' "
27 +test_expect_success 'commit conflicting change from git' "
28 echo second line from git >> file &&
29 git commit -a -m 'second line from git' &&
30 - git-svn commit-diff -r1 HEAD~1 HEAD $svnrepo
31 - " || true
30 + ! git-svn commit-diff -r1 HEAD~1 HEAD $svnrepo
31 +"
32
33 test_expect_success 'commit complementing change from git' "
34 git reset --hard HEAD~1 &&
@@ -39,7 +39,7 @@ test_expect_success 'commit complementing change from git' "
39 git-svn commit-diff -r2 HEAD~1 HEAD $svnrepo
40 "
41
42 -test_expect_failure 'dcommit fails to commit because of conflict' "
42 +test_expect_success 'dcommit fails to commit because of conflict' "
43 git-svn init $svnrepo &&
44 git-svn fetch &&
45 git reset --hard refs/remotes/git-svn &&
@@ -52,8 +52,8 @@ test_expect_failure 'dcommit fails to commit because of conflict' "
52 rm -rf t.svn &&
53 echo 'fourth line from git' >> file &&
54 git commit -a -m 'fourth line from git' &&
55 - git-svn dcommit
56 - " || true
55 + ! git-svn dcommit
56 + "
57
58 test_expect_success 'dcommit does the svn equivalent of an index merge' "
59 git reset --hard refs/remotes/git-svn &&
@@ -76,15 +76,15 @@ test_expect_success 'commit another change from svn side' "
76 rm -rf t.svn
77 "
78
79 -test_expect_failure 'multiple dcommit from git-svn will not clobber svn' "
79 +test_expect_success 'multiple dcommit from git-svn will not clobber svn' "
80 git reset --hard refs/remotes/git-svn &&
81 echo new file >> new-file &&
82 git update-index --add new-file &&
83 git commit -a -m 'new file' &&
84 echo clobber > file &&
85 git commit -a -m 'clobber' &&
86 - git svn dcommit
87 - " || true
86 + ! git svn dcommit
87 + "
88
89
90 test_expect_success 'check that rebase really failed' 'test -d .dotest'
t/t9106-git-svn-dcommit-clobber-series.sh
+2 -2
@@ -54,10 +54,10 @@ test_expect_success 'change file but in unrelated area' "
54 test x\"\`sed -n -e 61p < file\`\" = x6611
55 "
56
57 -test_expect_failure 'attempt to dcommit with a dirty index' '
57 +test_expect_success 'attempt to dcommit with a dirty index' '
58 echo foo >>file &&
59 git add file &&
60 - git svn dcommit
60 + ! git svn dcommit
61 '
62
63 test_done
t/t9300-fast-import.sh
+12 -12
@@ -165,9 +165,9 @@ from refs/heads/master
165 M 755 0000000000000000000000000000000000000001 zero1
166
167 INPUT_END
168 -test_expect_failure \
169 - 'B: fail on invalid blob sha1' \
170 - 'git-fast-import <input'
168 +test_expect_success 'B: fail on invalid blob sha1' '
169 + ! git-fast-import <input
170 +'
171 rm -f .git/objects/pack_* .git/objects/index_*
172
173 cat >input <<INPUT_END
@@ -180,9 +180,9 @@ COMMIT
180 from refs/heads/master
181
182 INPUT_END
183 -test_expect_failure \
184 - 'B: fail on invalid branch name ".badbranchname"' \
185 - 'git-fast-import <input'
183 +test_expect_success 'B: fail on invalid branch name ".badbranchname"' '
184 + ! git-fast-import <input
185 +'
186 rm -f .git/objects/pack_* .git/objects/index_*
187
188 cat >input <<INPUT_END
@@ -195,9 +195,9 @@ COMMIT
195 from refs/heads/master
196
197 INPUT_END
198 -test_expect_failure \
199 - 'B: fail on invalid branch name "bad[branch]name"' \
200 - 'git-fast-import <input'
198 +test_expect_success 'B: fail on invalid branch name "bad[branch]name"' '
199 + ! git-fast-import <input
200 +'
201 rm -f .git/objects/pack_* .git/objects/index_*
202
203 cat >input <<INPUT_END
@@ -339,9 +339,9 @@ COMMIT
339 from refs/heads/branch^0
340
341 INPUT_END
342 -test_expect_failure \
343 - 'E: rfc2822 date, --date-format=raw' \
344 - 'git-fast-import --date-format=raw <input'
342 +test_expect_success 'E: rfc2822 date, --date-format=raw' '
343 + ! git-fast-import --date-format=raw <input
344 +'
345 test_expect_success \
346 'E: rfc2822 date, --date-format=rfc2822' \
347 'git-fast-import --date-format=rfc2822 <input'
t/t9400-git-cvsserver-server.sh
+18 -12
@@ -156,15 +156,19 @@ test_expect_success 'req_Root (strict paths)' \
156 'cat request-anonymous | git-cvsserver --strict-paths pserver $SERVERDIR >log 2>&1 &&
157 tail -n1 log | grep -q "^I LOVE YOU$"'
158
159 -test_expect_failure 'req_Root failure (strict-paths)' \
160 - 'cat request-anonymous | git-cvsserver --strict-paths pserver $WORKDIR >log 2>&1'
159 +test_expect_success 'req_Root failure (strict-paths)' '
160 + ! cat request-anonymous |
161 + git-cvsserver --strict-paths pserver $WORKDIR >log 2>&1
162 +'
163
164 test_expect_success 'req_Root (w/o strict-paths)' \
165 'cat request-anonymous | git-cvsserver pserver $WORKDIR/ >log 2>&1 &&
166 tail -n1 log | grep -q "^I LOVE YOU$"'
167
166 -test_expect_failure 'req_Root failure (w/o strict-paths)' \
167 - 'cat request-anonymous | git-cvsserver pserver $WORKDIR/gitcvs >log 2>&1'
168 +test_expect_success 'req_Root failure (w/o strict-paths)' '
169 + ! cat request-anonymous |
170 + git-cvsserver pserver $WORKDIR/gitcvs >log 2>&1
171 +'
172
173 cat >request-base <<EOF
174 BEGIN AUTH REQUEST
@@ -179,8 +183,10 @@ test_expect_success 'req_Root (base-path)' \
183 'cat request-base | git-cvsserver --strict-paths --base-path $WORKDIR/ pserver $SERVERDIR >log 2>&1 &&
184 tail -n1 log | grep -q "^I LOVE YOU$"'
185
182 -test_expect_failure 'req_Root failure (base-path)' \
183 - 'cat request-anonymous | git-cvsserver --strict-paths --base-path $WORKDIR pserver $SERVERDIR >log 2>&1'
186 +test_expect_success 'req_Root failure (base-path)' '
187 + ! cat request-anonymous |
188 + git-cvsserver --strict-paths --base-path $WORKDIR pserver $SERVERDIR >log 2>&1
189 +'
190
191 GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false || exit 1
192
@@ -188,9 +194,8 @@ test_expect_success 'req_Root (export-all)' \
194 'cat request-anonymous | git-cvsserver --export-all pserver $WORKDIR >log 2>&1 &&
195 tail -n1 log | grep -q "^I LOVE YOU$"'
196
191 -test_expect_failure 'req_Root failure (export-all w/o whitelist)' \
192 - 'cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 ||
193 - false'
197 +test_expect_success 'req_Root failure (export-all w/o whitelist)' \
198 + '! (cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 || false)'
199
200 test_expect_success 'req_Root (everything together)' \
201 'cat request-base | git-cvsserver --export-all --strict-paths --base-path $WORKDIR/ pserver $SERVERDIR >log 2>&1 &&
@@ -290,15 +295,16 @@ test_expect_success 'cvs update (update existing file)' \
295
296 cd "$WORKDIR"
297 #TODO: cvsserver doesn't support update w/o -d
293 -test_expect_failure "cvs update w/o -d doesn't create subdir (TODO)" \
294 - 'mkdir test &&
298 +test_expect_failure "cvs update w/o -d doesn't create subdir (TODO)" '
299 + mkdir test &&
300 echo >test/empty &&
301 git add test &&
302 git commit -q -m "Single Subdirectory" &&
303 git push gitcvs.git >/dev/null &&
304 cd cvswork &&
305 GIT_CONFIG="$git_config" cvs -Q update &&
301 - test ! -d test'
306 + test ! -d test
307 +'
308
309 cd "$WORKDIR"
310 test_expect_success 'cvs update (subdirectories)' \
t/test-lib.sh
+26 -4
@@ -139,6 +139,8 @@ fi
139
140 test_failure=0
141 test_count=0
142 +test_fixed=0
143 +test_broken=0
144
145 trap 'echo >&5 "FATAL: Unexpected exit with code $?"; exit 1' exit
146
@@ -171,6 +173,17 @@ test_failure_ () {
173 test "$immediate" = "" || { trap - exit; exit 1; }
174 }
175
176 +test_known_broken_ok_ () {
177 + test_count=$(expr "$test_count" + 1)
178 + test_fixed=$(($test_fixed+1))
179 + say_color "" " FIXED $test_count: $@"
180 +}
181 +
182 +test_known_broken_failure_ () {
183 + test_count=$(expr "$test_count" + 1)
184 + test_broken=$(($test_broken+1))
185 + say_color skip " still broken $test_count: $@"
186 +}
187
188 test_debug () {
189 test "$debug" = "" || eval "$1"
@@ -211,13 +224,13 @@ test_expect_failure () {
224 error "bug in the test script: not 2 parameters to test-expect-failure"
225 if ! test_skip "$@"
226 then
214 - say >&3 "expecting failure: $2"
227 + say >&3 "checking known breakage: $2"
228 test_run_ "$2"
216 - if [ "$?" = 0 -a "$eval_ret" != 0 -a "$eval_ret" -lt 129 ]
229 + if [ "$?" = 0 -a "$eval_ret" = 0 ]
230 then
218 - test_ok_ "$1"
231 + test_known_broken_ok_ "$1"
232 else
220 - test_failure_ "$@"
233 + test_known_broken_failure_ "$1"
234 fi
235 fi
236 echo >&3 ""
@@ -274,6 +287,15 @@ test_create_repo () {
287
288 test_done () {
289 trap - exit
290 +
291 + if test "$test_fixed" != 0
292 + then
293 + say_color pass "fixed $test_fixed known breakage(s)"
294 + fi
295 + if test "$test_broken" != 0
296 + then
297 + say_color error "still have $test_broken known breakage(s)"
298 + fi
299 case "$test_failure" in
300 0)
301 # We could: