Skip to content

Commit 904ec48

Browse files
pks-tgitster
authored andcommitted
t: fix cases where output breaks TAP format
The TAP format does not allow arbitrary output outside of a specific test case. If a test suite wants to print any such diagnostic output, then this output has to be prefixed with "#" to mark it accordingly. A bunch of our tests generate output outside of `test_expect_*` testcases anyway without such a mark, which breaks strict TAP parsers. Upon further inspection, all of the output generated by such tests is rather uninteresting. Refactor them so that we don't break the TAP format. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8613c2b commit 904ec48

12 files changed

+27
-36
lines changed

t/t0050-filesystem.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,18 @@ aumlcdiar=$(printf '\141\314\210')
1212

1313
if test_have_prereq CASE_INSENSITIVE_FS
1414
then
15-
say "will test on a case insensitive filesystem"
1615
test_case=test_expect_failure
1716
else
1817
test_case=test_expect_success
1918
fi
2019

2120
if test_have_prereq UTF8_NFD_TO_NFC
2221
then
23-
say "will test on a unicode corrupting filesystem"
2422
test_unicode=test_expect_failure
2523
else
2624
test_unicode=test_expect_success
2725
fi
2826

29-
test_have_prereq SYMLINKS ||
30-
say "will test on a filesystem lacking symbolic links"
31-
3227
if test_have_prereq CASE_INSENSITIVE_FS
3328
then
3429
test_expect_success "detection of case insensitive filesystem during repo init" '

t/t1007-hash-object.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ setup_repo() {
3030

3131
test_repo=test
3232
push_repo() {
33-
test_create_repo $test_repo
33+
test_create_repo $test_repo >/dev/null
3434
cd $test_repo
3535

3636
setup_repo

t/t3600-rm.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ test_expect_success 'Initialize test directory' '
1717
git commit -m "add normal files"
1818
'
1919

20-
if test_have_prereq !FUNNYNAMES
21-
then
22-
say 'Your filesystem does not allow tabs in filenames.'
23-
fi
24-
2520
test_expect_success FUNNYNAMES 'add files with funny names' '
2621
touch -- "tab embedded" "newline${LF}embedded" &&
2722
git add -- "tab embedded" "newline${LF}embedded" &&

t/t4000-diff-format.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test_expect_success 'git diff-files -p after editing work tree.' '
3636
# that's as far as it comes
3737
if [ "$(git config --get core.filemode)" = false ]
3838
then
39-
say 'filemode disabled on the filesystem'
39+
skip_all='filemode disabled on the filesystem'
4040
test_done
4141
fi
4242

t/t4041-diff-submodule-option.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ commit_file () {
4848
git commit "$@" -m "Commit $*" >/dev/null
4949
}
5050

51-
test_create_repo sm1 &&
51+
test_create_repo sm1 >/dev/null &&
5252
add_file . foo >/dev/null
5353

5454
head1=$(add_file sm1 foo1 foo2)
@@ -236,7 +236,7 @@ test_expect_success 'typechanged submodule(submodule->blob)' '
236236
'
237237

238238
rm -f sm1 &&
239-
test_create_repo sm1 &&
239+
test_create_repo sm1 >/dev/null &&
240240
head6=$(add_file sm1 foo6 foo7)
241241
fullhead6=$(cd sm1; git rev-parse --verify HEAD)
242242
test_expect_success 'nonexistent commit' '

t/t4060-diff-submodule-option-diff-format.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ test_expect_success 'typechanged submodule(submodule->blob)' '
364364
'
365365

366366
rm -f sm1 &&
367-
test_create_repo sm1 &&
367+
test_create_repo sm1 >/dev/null &&
368368
head6=$(add_file sm1 foo6 foo7)
369369
test_expect_success 'nonexistent commit' '
370370
git diff-index -p --submodule=diff HEAD >actual &&

t/t7401-submodule-summary.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ commit_file () {
3838
git commit "$@" -m "Commit $*" >/dev/null
3939
}
4040

41-
test_create_repo sm1 &&
41+
test_create_repo sm1 >/dev/null &&
4242
add_file . foo >/dev/null
4343

4444
head1=$(add_file sm1 foo1 foo2)
@@ -215,7 +215,7 @@ test_expect_success 'typechanged submodule(submodule->blob)' "
215215
"
216216

217217
rm -f sm1 &&
218-
test_create_repo sm1 &&
218+
test_create_repo sm1 >/dev/null &&
219219
head6=$(add_file sm1 foo6 foo7)
220220
test_expect_success 'nonexistent commit' "
221221
git submodule summary >actual &&

t/t9500-gitweb-standalone-no-errors.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -701,13 +701,13 @@ test_expect_success \
701701
# syntax highlighting
702702

703703

704-
highlight_version=$(highlight --version </dev/null 2>/dev/null)
705-
if [ $? -eq 127 ]; then
706-
say "Skipping syntax highlighting tests: 'highlight' not found"
707-
elif test -z "$highlight_version"; then
708-
say "Skipping syntax highlighting tests: incorrect 'highlight' found"
709-
else
710-
test_set_prereq HIGHLIGHT
704+
test_lazy_prereq HIGHLIGHT '
705+
highlight_version=$(highlight --version </dev/null 2>/dev/null) &&
706+
test -n "$highlight_version"
707+
'
708+
709+
if test_have_prereq HIGHLIGHT
710+
then
711711
cat >>gitweb_config.perl <<-\EOF
712712
our $highlight_bin = "highlight";
713713
$feature{'highlight'}{'override'} = 1;

t/t9822-git-p4-path-encoding.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ test_description='Clone repositories with non ASCII paths'
77
UTF8_ESCAPED="a-\303\244_o-\303\266_u-\303\274.txt"
88
ISO8859_ESCAPED="a-\344_o-\366_u-\374.txt"
99

10-
ISO8859="$(printf "$ISO8859_ESCAPED")" &&
11-
echo content123 >"$ISO8859" &&
12-
rm "$ISO8859" || {
10+
test_lazy_prereq FS_ACCEPTS_ISO_8859_1 '
11+
ISO8859="$(printf "$ISO8859_ESCAPED")" &&
12+
echo content123 >"$ISO8859" 2>/dev/null &&
13+
rm "$ISO8859"
14+
'
15+
16+
if ! test_have_prereq FS_ACCEPTS_ISO_8859_1
17+
then
1318
skip_all="fs does not accept ISO-8859-1 filenames"
1419
test_done
15-
}
20+
fi
1621

1722
test_expect_success 'start p4d' '
1823
start_p4d

t/t9835-git-p4-metadata-encoding-python2.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ failing, and produces maximally sane output in git.'
1515
# These tests are specific to Python 2. Write a custom script that executes
1616
# git-p4 directly with the Python 2 interpreter to ensure that we use that
1717
# version even if Git was compiled with Python 3.
18-
python_target_binary=$(which python2)
18+
python_target_binary=$(which python2 2>/dev/null)
1919
if test -n "$python_target_binary"
2020
then
2121
mkdir temp_python
@@ -28,7 +28,7 @@ then
2828
fi
2929

3030
git p4-python2 >err
31-
if ! grep 'valid commands' err
31+
if ! grep -q 'valid commands' err
3232
then
3333
skip_all="skipping python2 git p4 tests; python2 not available"
3434
test_done

0 commit comments

Comments
 (0)