t/gitweb-lib.sh: Ensure that errors are shown for --debug --immediate
Because '--immediate' stops test suite after first error, therefore in this mode test_debug 'cat gitweb.log' was never ran, thus in effect negating effect of '--debug' option. This made finidng the cause of errors in gitweb test sute difficult. Modify the gitweb_run test subroutine to run test_debug itself in the case of errors (and also remove "test_debug 'cat gitweb.log'" from gitweb tests). This makes it possible to run *gitweb tests* with --immediate ---debug combination of options; also it makes gitweb tests to not output spurious debug data that is not considered error. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Jakub Narębski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Feb 19, 2011 at 19:16 UTC
49151d8b2cde68bc110a8bb899b8610631430941
3 files changed
+6
-88
t/gitweb-lib.sh
+6
-1
@@ -82,7 +82,12 @@ gitweb_run () {
82
}
83
close O;
84
' gitweb.output &&
85
- if grep '^[[]' gitweb.log >/dev/null 2>&1; then false; else true; fi
85
+ if grep '^[[]' gitweb.log >/dev/null 2>&1; then
86
+ test_debug 'cat gitweb.log >&2' &&
87
+ false
88
+ else
89
+ true
90
+ fi
91
92
# gitweb.log is left for debugging
93
# gitweb.output is used to parse HTTP output
t/t9500-gitweb-standalone-no-errors.sh
-86
@@ -18,42 +18,34 @@ or warnings to log.'
18
test_expect_success \
19
'no commits: projects_list (implicit)' \
20
'gitweb_run'
21
-test_debug 'cat gitweb.log'
21
22
test_expect_success \
23
'no commits: projects_index' \
24
'gitweb_run "a=project_index"'
26
-test_debug 'cat gitweb.log'
25
26
test_expect_success \
27
'no commits: .git summary (implicit)' \
28
'gitweb_run "p=.git"'
31
-test_debug 'cat gitweb.log'
29
30
test_expect_success \
31
'no commits: .git commit (implicit HEAD)' \
32
'gitweb_run "p=.git;a=commit"'
36
-test_debug 'cat gitweb.log'
33
34
test_expect_success \
35
'no commits: .git commitdiff (implicit HEAD)' \
36
'gitweb_run "p=.git;a=commitdiff"'
41
-test_debug 'cat gitweb.log'
37
38
test_expect_success \
39
'no commits: .git tree (implicit HEAD)' \
40
'gitweb_run "p=.git;a=tree"'
46
-test_debug 'cat gitweb.log'
41
42
test_expect_success \
43
'no commits: .git heads' \
44
'gitweb_run "p=.git;a=heads"'
51
-test_debug 'cat gitweb.log'
45
46
test_expect_success \
47
'no commits: .git tags' \
48
'gitweb_run "p=.git;a=tags"'
56
-test_debug 'cat gitweb.log'
49
50
51
# ----------------------------------------------------------------------
@@ -69,52 +61,42 @@ test_expect_success \
61
test_expect_success \
62
'projects_list (implicit)' \
63
'gitweb_run'
72
-test_debug 'cat gitweb.log'
64
65
test_expect_success \
66
'projects_index' \
67
'gitweb_run "a=project_index"'
77
-test_debug 'cat gitweb.log'
68
69
test_expect_success \
70
'.git summary (implicit)' \
71
'gitweb_run "p=.git"'
82
-test_debug 'cat gitweb.log'
72
73
test_expect_success \
74
'.git commit (implicit HEAD)' \
75
'gitweb_run "p=.git;a=commit"'
87
-test_debug 'cat gitweb.log'
76
77
test_expect_success \
78
'.git commitdiff (implicit HEAD, root commit)' \
79
'gitweb_run "p=.git;a=commitdiff"'
92
-test_debug 'cat gitweb.log'
80
81
test_expect_success \
82
'.git commitdiff_plain (implicit HEAD, root commit)' \
83
'gitweb_run "p=.git;a=commitdiff_plain"'
97
-test_debug 'cat gitweb.log'
84
85
test_expect_success \
86
'.git commit (HEAD)' \
87
'gitweb_run "p=.git;a=commit;h=HEAD"'
102
-test_debug 'cat gitweb.log'
88
89
test_expect_success \
90
'.git tree (implicit HEAD)' \
91
'gitweb_run "p=.git;a=tree"'
107
-test_debug 'cat gitweb.log'
92
93
test_expect_success \
94
'.git blob (file)' \
95
'gitweb_run "p=.git;a=blob;f=file"'
112
-test_debug 'cat gitweb.log'
96
97
test_expect_success \
98
'.git blob_plain (file)' \
99
'gitweb_run "p=.git;a=blob_plain;f=file"'
117
-test_debug 'cat gitweb.log'
100
101
# ----------------------------------------------------------------------
102
# nonexistent objects
@@ -122,37 +104,30 @@ test_debug 'cat gitweb.log'
104
test_expect_success \
105
'.git commit (non-existent)' \
106
'gitweb_run "p=.git;a=commit;h=non-existent"'
125
-test_debug 'cat gitweb.log'
107
108
test_expect_success \
109
'.git commitdiff (non-existent)' \
110
'gitweb_run "p=.git;a=commitdiff;h=non-existent"'
130
-test_debug 'cat gitweb.log'
111
112
test_expect_success \
113
'.git commitdiff (non-existent vs HEAD)' \
114
'gitweb_run "p=.git;a=commitdiff;hp=non-existent;h=HEAD"'
135
-test_debug 'cat gitweb.log'
115
116
test_expect_success \
117
'.git tree (0000000000000000000000000000000000000000)' \
118
'gitweb_run "p=.git;a=tree;h=0000000000000000000000000000000000000000"'
140
-test_debug 'cat gitweb.log'
119
120
test_expect_success \
121
'.git tag (0000000000000000000000000000000000000000)' \
122
'gitweb_run "p=.git;a=tag;h=0000000000000000000000000000000000000000"'
145
-test_debug 'cat gitweb.log'
123
124
test_expect_success \
125
'.git blob (non-existent)' \
126
'gitweb_run "p=.git;a=blob;f=non-existent"'
150
-test_debug 'cat gitweb.log'
127
128
test_expect_success \
129
'.git blob_plain (non-existent)' \
130
'gitweb_run "p=.git;a=blob_plain;f=non-existent"'
155
-test_debug 'cat gitweb.log'
131
132
133
# ----------------------------------------------------------------------
@@ -161,7 +136,6 @@ test_debug 'cat gitweb.log'
136
test_expect_success \
137
'commitdiff(0): root' \
138
'gitweb_run "p=.git;a=commitdiff"'
164
-test_debug 'cat gitweb.log'
139
140
test_expect_success \
141
'commitdiff(0): file added' \
@@ -169,21 +143,18 @@ test_expect_success \
143
git add new_file &&
144
git commit -a -m "File added." &&
145
gitweb_run "p=.git;a=commitdiff"'
172
-test_debug 'cat gitweb.log'
146
147
test_expect_success \
148
'commitdiff(0): mode change' \
149
'test_chmod +x new_file &&
150
git commit -a -m "Mode changed." &&
151
gitweb_run "p=.git;a=commitdiff"'
179
-test_debug 'cat gitweb.log'
152
153
test_expect_success \
154
'commitdiff(0): file renamed' \
155
'git mv new_file renamed_file &&
156
git commit -a -m "File renamed." &&
157
gitweb_run "p=.git;a=commitdiff"'
186
-test_debug 'cat gitweb.log'
158
159
test_expect_success SYMLINKS \
160
'commitdiff(0): file to symlink' \
@@ -191,7 +162,6 @@ test_expect_success SYMLINKS \
162
ln -s file renamed_file &&
163
git commit -a -m "File to symlink." &&
164
gitweb_run "p=.git;a=commitdiff"'
194
-test_debug 'cat gitweb.log'
165
166
test_expect_success \
167
'commitdiff(0): file deleted' \
@@ -199,7 +169,6 @@ test_expect_success \
169
rm -f renamed_file &&
170
git commit -a -m "File removed." &&
171
gitweb_run "p=.git;a=commitdiff"'
202
-test_debug 'cat gitweb.log'
172
173
test_expect_success \
174
'commitdiff(0): file copied / new file' \
@@ -207,7 +176,6 @@ test_expect_success \
176
git add file2 &&
177
git commit -a -m "File copied." &&
178
gitweb_run "p=.git;a=commitdiff"'
210
-test_debug 'cat gitweb.log'
179
180
test_expect_success \
181
'commitdiff(0): mode change and modified' \
@@ -215,7 +183,6 @@ test_expect_success \
183
test_chmod +x file2 &&
184
git commit -a -m "Mode change and modification." &&
185
gitweb_run "p=.git;a=commitdiff"'
218
-test_debug 'cat gitweb.log'
186
187
test_expect_success \
188
'commitdiff(0): renamed and modified' \
@@ -233,7 +200,6 @@ EOF
200
echo "Propter nomen suum." >> file3 &&
201
git commit -a -m "File rename and modification." &&
202
gitweb_run "p=.git;a=commitdiff"'
236
-test_debug 'cat gitweb.log'
203
204
test_expect_success \
205
'commitdiff(0): renamed, mode change and modified' \
@@ -242,7 +208,6 @@ test_expect_success \
208
test_chmod +x file2 &&
209
git commit -a -m "File rename, mode change and modification." &&
210
gitweb_run "p=.git;a=commitdiff"'
245
-test_debug 'cat gitweb.log'
211
212
# ----------------------------------------------------------------------
213
# commitdiff testing (taken from t4114-apply-typechange.sh)
@@ -279,42 +244,34 @@ test_expect_success SYMLINKS 'setup typechange commits' '
244
test_expect_success \
245
'commitdiff(2): file renamed from foo to foo/baz' \
246
'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-baz-renamed-from-foo"'
282
-test_debug 'cat gitweb.log'
247
248
test_expect_success \
249
'commitdiff(2): file renamed from foo/baz to foo' \
250
'gitweb_run "p=.git;a=commitdiff;hp=foo-baz-renamed-from-foo;h=initial"'
287
-test_debug 'cat gitweb.log'
251
252
test_expect_success \
253
'commitdiff(2): directory becomes file' \
254
'gitweb_run "p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=initial"'
292
-test_debug 'cat gitweb.log'
255
256
test_expect_success \
257
'commitdiff(2): file becomes directory' \
258
'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-becomes-a-directory"'
297
-test_debug 'cat gitweb.log'
259
260
test_expect_success \
261
'commitdiff(2): file becomes symlink' \
262
'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-symlinked-to-bar"'
302
-test_debug 'cat gitweb.log'
263
264
test_expect_success \
265
'commitdiff(2): symlink becomes file' \
266
'gitweb_run "p=.git;a=commitdiff;hp=foo-symlinked-to-bar;h=foo-back-to-file"'
307
-test_debug 'cat gitweb.log'
267
268
test_expect_success \
269
'commitdiff(2): symlink becomes directory' \
270
'gitweb_run "p=.git;a=commitdiff;hp=foo-symlinked-to-bar;h=foo-becomes-a-directory"'
312
-test_debug 'cat gitweb.log'
271
272
test_expect_success \
273
'commitdiff(2): directory becomes symlink' \
274
'gitweb_run "p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=foo-symlinked-to-bar"'
317
-test_debug 'cat gitweb.log'
275
276
# ----------------------------------------------------------------------
277
# commit, commitdiff: merge, large
@@ -330,12 +287,10 @@ test_expect_success \
287
test_expect_success \
288
'commit(0): merge commit' \
289
'gitweb_run "p=.git;a=commit"'
333
-test_debug 'cat gitweb.log'
290
291
test_expect_success \
292
'commitdiff(0): merge commit' \
293
'gitweb_run "p=.git;a=commitdiff"'
338
-test_debug 'cat gitweb.log'
294
295
test_expect_success \
296
'Prepare large commit' \
@@ -371,12 +326,10 @@ test_expect_success \
326
test_expect_success \
327
'commit(1): large commit' \
328
'gitweb_run "p=.git;a=commit;h=b"'
374
-test_debug 'cat gitweb.log'
329
330
test_expect_success \
331
'commitdiff(1): large commit' \
332
'gitweb_run "p=.git;a=commitdiff;h=b"'
379
-test_debug 'cat gitweb.log'
333
334
# ----------------------------------------------------------------------
335
# tags testing
@@ -394,17 +347,14 @@ test_expect_success \
347
git tag lightweight/tag-tree HEAD^{tree} &&
348
git tag lightweight/tag-blob HEAD:file &&
349
gitweb_run "p=.git;a=tags"'
397
-test_debug 'cat gitweb.log'
350
351
test_expect_success \
352
'tag: Tag to commit object' \
353
'gitweb_run "p=.git;a=tag;h=tag-commit"'
402
-test_debug 'cat gitweb.log'
354
355
test_expect_success \
356
'tag: on lightweight tag (invalid)' \
357
'gitweb_run "p=.git;a=tag;h=lightweight/tag-commit"'
407
-test_debug 'cat gitweb.log'
358
359
# ----------------------------------------------------------------------
360
# logs
@@ -412,22 +362,18 @@ test_debug 'cat gitweb.log'
362
test_expect_success \
363
'logs: log (implicit HEAD)' \
364
'gitweb_run "p=.git;a=log"'
415
-test_debug 'cat gitweb.log'
365
366
test_expect_success \
367
'logs: shortlog (implicit HEAD)' \
368
'gitweb_run "p=.git;a=shortlog"'
420
-test_debug 'cat gitweb.log'
369
370
test_expect_success \
371
'logs: history (implicit HEAD, file)' \
372
'gitweb_run "p=.git;a=history;f=file"'
425
-test_debug 'cat gitweb.log'
373
374
test_expect_success \
375
'logs: history (implicit HEAD, non-existent file)' \
376
'gitweb_run "p=.git;a=history;f=non-existent"'
430
-test_debug 'cat gitweb.log'
377
378
test_expect_success \
379
'logs: history (implicit HEAD, deleted file)' \
@@ -438,55 +384,45 @@ test_expect_success \
384
git rm deleted_file &&
385
git commit -m "Delete file" &&
386
gitweb_run "p=.git;a=history;f=deleted_file"'
441
-test_debug 'cat gitweb.log'
387
388
# ----------------------------------------------------------------------
389
# path_info links
390
test_expect_success \
391
'path_info: project' \
392
'gitweb_run "" "/.git"'
448
-test_debug 'cat gitweb.log'
393
394
test_expect_success \
395
'path_info: project/branch' \
396
'gitweb_run "" "/.git/b"'
453
-test_debug 'cat gitweb.log'
397
398
test_expect_success \
399
'path_info: project/branch:file' \
400
'gitweb_run "" "/.git/master:file"'
458
-test_debug 'cat gitweb.log'
401
402
test_expect_success \
403
'path_info: project/branch:dir/' \
404
'gitweb_run "" "/.git/master:foo/"'
463
-test_debug 'cat gitweb.log'
405
406
test_expect_success \
407
'path_info: project/branch:file (non-existent)' \
408
'gitweb_run "" "/.git/master:non-existent"'
468
-test_debug 'cat gitweb.log'
409
410
test_expect_success \
411
'path_info: project/branch:dir/ (non-existent)' \
412
'gitweb_run "" "/.git/master:non-existent/"'
473
-test_debug 'cat gitweb.log'
413
414
415
test_expect_success \
416
'path_info: project/branch:/file' \
417
'gitweb_run "" "/.git/master:/file"'
479
-test_debug 'cat gitweb.log'
418
419
test_expect_success \
420
'path_info: project/:/file (implicit HEAD)' \
421
'gitweb_run "" "/.git/:/file"'
484
-test_debug 'cat gitweb.log'
422
423
test_expect_success \
424
'path_info: project/:/ (implicit HEAD, top tree)' \
425
'gitweb_run "" "/.git/:/"'
489
-test_debug 'cat gitweb.log'
426
427
428
# ----------------------------------------------------------------------
@@ -495,17 +431,14 @@ test_debug 'cat gitweb.log'
431
test_expect_success \
432
'feeds: OPML' \
433
'gitweb_run "a=opml"'
498
-test_debug 'cat gitweb.log'
434
435
test_expect_success \
436
'feed: RSS' \
437
'gitweb_run "p=.git;a=rss"'
503
-test_debug 'cat gitweb.log'
438
439
test_expect_success \
440
'feed: Atom' \
441
'gitweb_run "p=.git;a=atom"'
508
-test_debug 'cat gitweb.log'
442
443
# ----------------------------------------------------------------------
444
# encoding/decoding
@@ -517,7 +450,6 @@ test_expect_success \
450
git add file &&
451
git commit -F "$TEST_DIRECTORY"/t3900/1-UTF-8.txt &&
452
gitweb_run "p=.git;a=commit"'
520
-test_debug 'cat gitweb.log'
453
454
test_expect_success \
455
'encode(commit): iso-8859-1' \
@@ -528,12 +460,10 @@ test_expect_success \
460
git commit -F "$TEST_DIRECTORY"/t3900/ISO8859-1.txt &&
461
git config --unset i18n.commitencoding &&
462
gitweb_run "p=.git;a=commit"'
531
-test_debug 'cat gitweb.log'
463
464
test_expect_success \
465
'encode(log): utf-8 and iso-8859-1' \
466
'gitweb_run "p=.git;a=log"'
536
-test_debug 'cat gitweb.log'
467
468
# ----------------------------------------------------------------------
469
# extra options
@@ -541,27 +471,22 @@ test_debug 'cat gitweb.log'
471
test_expect_success \
472
'opt: log --no-merges' \
473
'gitweb_run "p=.git;a=log;opt=--no-merges"'
544
-test_debug 'cat gitweb.log'
474
475
test_expect_success \
476
'opt: atom --no-merges' \
477
'gitweb_run "p=.git;a=log;opt=--no-merges"'
549
-test_debug 'cat gitweb.log'
478
479
test_expect_success \
480
'opt: "file" history --no-merges' \
481
'gitweb_run "p=.git;a=history;f=file;opt=--no-merges"'
554
-test_debug 'cat gitweb.log'
482
483
test_expect_success \
484
'opt: log --no-such-option (invalid option)' \
485
'gitweb_run "p=.git;a=log;opt=--no-such-option"'
559
-test_debug 'cat gitweb.log'
486
487
test_expect_success \
488
'opt: tree --no-merges (invalid option for action)' \
489
'gitweb_run "p=.git;a=tree;opt=--no-merges"'
564
-test_debug 'cat gitweb.log'
490
491
# ----------------------------------------------------------------------
492
# testing config_to_multi / cloneurl
@@ -569,14 +494,12 @@ test_debug 'cat gitweb.log'
494
test_expect_success \
495
'URL: no project URLs, no base URL' \
496
'gitweb_run "p=.git;a=summary"'
572
-test_debug 'cat gitweb.log'
497
498
test_expect_success \
499
'URL: project URLs via gitweb.url' \
500
'git config --add gitweb.url git://example.com/git/trash.git &&
501
git config --add gitweb.url http://example.com/git/trash.git &&
502
gitweb_run "p=.git;a=summary"'
579
-test_debug 'cat gitweb.log'
503
504
cat >.git/cloneurl <<\EOF
505
git://example.com/git/trash.git
@@ -586,7 +509,6 @@ EOF
509
test_expect_success \
510
'URL: project URLs via cloneurl file' \
511
'gitweb_run "p=.git;a=summary"'
589
-test_debug 'cat gitweb.log'
512
513
# ----------------------------------------------------------------------
514
# gitweb config and repo config
@@ -604,12 +526,10 @@ EOF
526
test_expect_success \
527
'config override: projects list (implicit)' \
528
'gitweb_run'
607
-test_debug 'cat gitweb.log'
529
530
test_expect_success \
531
'config override: tree view, features not overridden in repo config' \
532
'gitweb_run "p=.git;a=tree"'
612
-test_debug 'cat gitweb.log'
533
534
test_expect_success \
535
'config override: tree view, features disabled in repo config' \
@@ -617,14 +537,12 @@ test_expect_success \
537
git config gitweb.snapshot none &&
538
git config gitweb.avatar gravatar &&
539
gitweb_run "p=.git;a=tree"'
620
-test_debug 'cat gitweb.log'
540
541
test_expect_success \
542
'config override: tree view, features enabled in repo config (1)' \
543
'git config gitweb.blame yes &&
544
git config gitweb.snapshot "zip,tgz, tbz2" &&
545
gitweb_run "p=.git;a=tree"'
627
-test_debug 'cat gitweb.log'
546
547
cat >.git/config <<\EOF
548
# testing noval and alternate separator
@@ -635,7 +553,6 @@ EOF
553
test_expect_success \
554
'config override: tree view, features enabled in repo config (2)' \
555
'gitweb_run "p=.git;a=tree"'
638
-test_debug 'cat gitweb.log'
556
557
# ----------------------------------------------------------------------
558
# non-ASCII in README.html
@@ -645,7 +562,6 @@ test_expect_success \
562
'echo "<b>UTF-8 example:</b><br />" > .git/README.html &&
563
cat "$TEST_DIRECTORY"/t3900/1-UTF-8.txt >> .git/README.html &&
564
gitweb_run "p=.git;a=summary"'
648
-test_debug 'cat gitweb.log'
565
566
# ----------------------------------------------------------------------
567
# syntax highlighting
@@ -666,7 +582,6 @@ test_expect_success HIGHLIGHT \
582
'syntax highlighting (no highlight, unknown syntax)' \
583
'git config gitweb.highlight yes &&
584
gitweb_run "p=.git;a=blob;f=file"'
669
-test_debug 'cat gitweb.log'
585
586
test_expect_success HIGHLIGHT \
587
'syntax highlighting (highlighted, shell script)' \
@@ -675,6 +590,5 @@ test_expect_success HIGHLIGHT \
590
git add test.sh &&
591
git commit -m "Add test.sh" &&
592
gitweb_run "p=.git;a=blob;f=test.sh"'
678
-test_debug 'cat gitweb.log'
593
594
test_done
t/t9501-gitweb-standalone-http-status.sh
-1
@@ -126,7 +126,6 @@ test_expect_success 'load checking: load too high (default action)' '
126
grep "Status: 503 Service Unavailable" gitweb.headers &&
127
grep "503 - The load average on the server is too high" gitweb.body
128
'
129
-test_debug 'cat gitweb.log' # just in case
129
test_debug 'cat gitweb.headers'
130
131
# turn off load checking