Skip to content

Commit b1dc2e7

Browse files
committed
Merge branch 'ps/meson-tap-parse'
Meson-based build/test framework now understands TAP output generated by our tests. * ps/meson-tap-parse: meson: parse TAP output generated by our tests meson: introduce kwargs variable for tests test-lib: fail on unexpectedly passing tests t7815: fix unexpectedly passing test on macOS t/test-lib: fix TAP format for BASH_XTRACEFD warning t/test-lib: don't print shell traces to stdout t983*: use prereq to check for Python-specific git-p4(1) support t9822: use prereq to check for ISO-8859-1 support t: silence output from `test_create_repo()` t: stop announcing prereqs
2 parents 2024ab3 + c1bc974 commit b1dc2e7

19 files changed

+133
-117
lines changed

contrib/credential/netrc/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ if get_option('tests')
1717
workdir: meson.current_source_dir(),
1818
env: credential_netrc_testenv,
1919
depends: test_dependencies + bin_wrappers + [credential_netrc],
20-
timeout: 0,
20+
kwargs: test_kwargs,
2121
)
2222
endif

contrib/subtree/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if get_option('tests')
2121
env: subtree_test_environment,
2222
workdir: meson.current_source_dir() / 't',
2323
depends: test_dependencies + bin_wrappers + [ git_subtree ],
24-
timeout: 0,
24+
kwargs: test_kwargs,
2525
)
2626
endif
2727

meson.build

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,6 +2054,18 @@ subdir('templates')
20542054
# can properly set up test dependencies. The bin-wrappers themselves are set up
20552055
# at configuration time, so these are fine.
20562056
if get_option('tests')
2057+
test_kwargs = {
2058+
'timeout': 0,
2059+
}
2060+
2061+
# The TAP protocol was already understood by previous versions of Meson, but
2062+
# it was incompatible with the `meson test --interactive` flag.
2063+
if meson.version().version_compare('>=1.8.0')
2064+
test_kwargs += {
2065+
'protocol': 'tap',
2066+
}
2067+
endif
2068+
20572069
subdir('t')
20582070
endif
20592071

t/meson.build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ clar_unit_tests = executable('unit-tests',
5151
sources: clar_sources + clar_test_suites,
5252
dependencies: [libgit_commonmain],
5353
)
54-
test('unit-tests', clar_unit_tests)
54+
test('unit-tests', clar_unit_tests, kwargs: test_kwargs)
5555

5656
unit_test_programs = [
5757
'unit-tests/t-reftable-basics.c',
@@ -76,7 +76,7 @@ foreach unit_test_program : unit_test_programs
7676
)
7777
test(unit_test_name, unit_test,
7878
workdir: meson.current_source_dir(),
79-
timeout: 0,
79+
kwargs: test_kwargs,
8080
)
8181
endforeach
8282

@@ -1212,7 +1212,7 @@ foreach integration_test : integration_tests
12121212
workdir: meson.current_source_dir(),
12131213
env: test_environment,
12141214
depends: test_dependencies + bin_wrappers,
1215-
timeout: 0,
1215+
kwargs: test_kwargs,
12161216
)
12171217
endforeach
12181218

t/t0000-basic.sh

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ test_expect_success 'subtest: a failing TODO test' '
130130
'
131131

132132
test_expect_success 'subtest: a passing TODO test' '
133-
write_and_run_sub_test_lib_test passing-todo <<-\EOF &&
133+
write_and_run_sub_test_lib_test_err passing-todo <<-\EOF &&
134134
test_expect_failure "pretend we have fixed a known breakage" "true"
135135
test_done
136136
EOF
@@ -142,7 +142,7 @@ test_expect_success 'subtest: a passing TODO test' '
142142
'
143143

144144
test_expect_success 'subtest: 2 TODO tests, one passin' '
145-
write_and_run_sub_test_lib_test partially-passing-todos <<-\EOF &&
145+
write_and_run_sub_test_lib_test_err partially-passing-todos <<-\EOF &&
146146
test_expect_failure "pretend we have a known breakage" "false"
147147
test_expect_success "pretend we have a passing test" "true"
148148
test_expect_failure "pretend we have fixed another known breakage" "true"
@@ -219,41 +219,44 @@ test_expect_success 'subtest: --verbose option' '
219219
test_expect_success "failing test" false
220220
test_done
221221
EOF
222-
mv t1234-verbose/out t1234-verbose/out+ &&
223-
grep -v "^Initialized empty" t1234-verbose/out+ >t1234-verbose/out &&
224-
check_sub_test_lib_test t1234-verbose <<-\EOF
225-
> expecting success of 1234.1 '\''passing test'\'': true
222+
mv t1234-verbose/err t1234-verbose/err+ &&
223+
grep -v "^Initialized empty" t1234-verbose/err+ >t1234-verbose/err &&
224+
check_sub_test_lib_test_err t1234-verbose \
225+
<<-\EOF_OUT 3<<-\EOF_ERR
226226
> ok 1 - passing test
227+
> ok 2 - test with output
228+
> not ok 3 - failing test
229+
> # false
230+
> # failed 1 among 3 test(s)
231+
> 1..3
232+
EOF_OUT
233+
> expecting success of 1234.1 '\''passing test'\'': true
227234
> Z
228235
> expecting success of 1234.2 '\''test with output'\'': echo foo
229236
> foo
230-
> ok 2 - test with output
231237
> Z
232238
> expecting success of 1234.3 '\''failing test'\'': false
233-
> not ok 3 - failing test
234-
> # false
235239
> Z
236-
> # failed 1 among 3 test(s)
237-
> 1..3
238-
EOF
240+
EOF_ERR
239241
'
240242

241243
test_expect_success 'subtest: --verbose-only option' '
242244
run_sub_test_lib_test_err \
243245
t1234-verbose \
244246
--verbose-only=2 &&
245-
check_sub_test_lib_test t1234-verbose <<-\EOF
247+
check_sub_test_lib_test_err t1234-verbose <<-\EOF_OUT 3<<-\EOF_ERR
246248
> ok 1 - passing test
247-
> Z
248-
> expecting success of 1234.2 '\''test with output'\'': echo foo
249-
> foo
250249
> ok 2 - test with output
251-
> Z
252250
> not ok 3 - failing test
253251
> # false
254252
> # failed 1 among 3 test(s)
255253
> 1..3
256-
EOF
254+
EOF_OUT
255+
> Z
256+
> expecting success of 1234.2 '\''test with output'\'': echo foo
257+
> foo
258+
> Z
259+
EOF_ERR
257260
'
258261

259262
test_expect_success 'subtest: skip one with GIT_SKIP_TESTS' '

t/t0050-filesystem.sh

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,53 +10,35 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1010
auml=$(printf '\303\244')
1111
aumlcdiar=$(printf '\141\314\210')
1212

13-
if test_have_prereq CASE_INSENSITIVE_FS
14-
then
15-
say "will test on a case insensitive filesystem"
16-
test_case=test_expect_failure
17-
else
18-
test_case=test_expect_success
19-
fi
20-
2113
if test_have_prereq UTF8_NFD_TO_NFC
2214
then
23-
say "will test on a unicode corrupting filesystem"
2415
test_unicode=test_expect_failure
2516
else
2617
test_unicode=test_expect_success
2718
fi
2819

29-
test_have_prereq SYMLINKS ||
30-
say "will test on a filesystem lacking symbolic links"
31-
32-
if test_have_prereq CASE_INSENSITIVE_FS
33-
then
34-
test_expect_success "detection of case insensitive filesystem during repo init" '
20+
test_expect_success CASE_INSENSITIVE_FS "detection of case insensitive filesystem during repo init" '
3521
test $(git config --bool core.ignorecase) = true
3622
'
37-
else
38-
test_expect_success "detection of case insensitive filesystem during repo init" '
23+
24+
test_expect_success !CASE_INSENSITIVE_FS "detection of case insensitive filesystem during repo init" '
3925
{
4026
test_must_fail git config --bool core.ignorecase >/dev/null ||
4127
test $(git config --bool core.ignorecase) = false
4228
}
4329
'
44-
fi
4530

46-
if test_have_prereq SYMLINKS
47-
then
48-
test_expect_success "detection of filesystem w/o symlink support during repo init" '
31+
test_expect_success SYMLINKS "detection of filesystem w/o symlink support during repo init" '
4932
{
5033
test_must_fail git config --bool core.symlinks ||
5134
test "$(git config --bool core.symlinks)" = true
5235
}
5336
'
54-
else
55-
test_expect_success "detection of filesystem w/o symlink support during repo init" '
37+
38+
test_expect_success !SYMLINKS "detection of filesystem w/o symlink support during repo init" '
5639
v=$(git config --bool core.symlinks) &&
5740
test "$v" = false
5841
'
59-
fi
6042

6143
test_expect_success "setup case tests" '
6244
git config core.ignorecase true &&

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+
git init --quiet $test_repo
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: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ commit_file () {
4848
git commit "$@" -m "Commit $*" >/dev/null
4949
}
5050

51-
test_create_repo sm1 &&
52-
add_file . foo >/dev/null
53-
54-
head1=$(add_file sm1 foo1 foo2)
55-
fullhead1=$(cd sm1; git rev-parse --verify HEAD)
51+
test_expect_success 'setup submodule' '
52+
git init sm1 &&
53+
add_file . foo &&
54+
head1=$(add_file sm1 foo1 foo2) &&
55+
fullhead1=$(cd sm1 && git rev-parse --verify HEAD)
56+
'
5657

5758
test_expect_success 'added submodule' '
5859
git add sm1 &&
@@ -235,10 +236,13 @@ test_expect_success 'typechanged submodule(submodule->blob)' '
235236
test_cmp expected actual
236237
'
237238

238-
rm -f sm1 &&
239-
test_create_repo sm1 &&
240-
head6=$(add_file sm1 foo6 foo7)
241-
fullhead6=$(cd sm1; git rev-parse --verify HEAD)
239+
test_expect_success 'setup submodule anew' '
240+
rm -f sm1 &&
241+
git init sm1 &&
242+
head6=$(add_file sm1 foo6 foo7) &&
243+
fullhead6=$(cd sm1 && git rev-parse --verify HEAD)
244+
'
245+
242246
test_expect_success 'nonexistent commit' '
243247
git diff-index -p --submodule=log HEAD >actual &&
244248
cat >expected <<-EOF &&

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,12 @@ test_expect_success 'typechanged submodule(submodule->blob)' '
363363
diff_cmp expected actual
364364
'
365365

366-
rm -f sm1 &&
367-
test_create_repo sm1 &&
368-
head6=$(add_file sm1 foo6 foo7)
366+
test_expect_success 'setup' '
367+
rm -f sm1 &&
368+
git init sm1 &&
369+
head6=$(add_file sm1 foo6 foo7)
370+
'
371+
369372
test_expect_success 'nonexistent commit' '
370373
git diff-index -p --submodule=diff HEAD >actual &&
371374
cat >expected <<-EOF &&

t/t7401-submodule-summary.sh

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

41-
test_create_repo sm1 &&
42-
add_file . foo >/dev/null
43-
44-
head1=$(add_file sm1 foo1 foo2)
41+
test_expect_success 'setup submodule' '
42+
git init sm1 &&
43+
add_file . foo &&
44+
head1=$(add_file sm1 foo1 foo2)
45+
'
4546

4647
test_expect_success 'added submodule' "
4748
git add sm1 &&
@@ -214,9 +215,12 @@ test_expect_success 'typechanged submodule(submodule->blob)' "
214215
test_cmp expected actual
215216
"
216217

217-
rm -f sm1 &&
218-
test_create_repo sm1 &&
219-
head6=$(add_file sm1 foo6 foo7)
218+
test_expect_success 'setup submodule' '
219+
rm -f sm1 &&
220+
git init sm1 &&
221+
head6=$(add_file sm1 foo6 foo7)
222+
'
223+
220224
test_expect_success 'nonexistent commit' "
221225
git submodule summary >actual &&
222226
cat >expected <<-EOF &&

t/t7815-grep-binary.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ test_expect_success 'git grep ile a' '
6363
git grep ile a
6464
'
6565

66-
test_expect_failure !CYGWIN 'git grep .fi a' '
66+
test_expect_failure !CYGWIN,!MACOS 'git grep .fi a' '
6767
git grep .fi a
6868
'
6969

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -700,19 +700,17 @@ test_expect_success \
700700
# ----------------------------------------------------------------------
701701
# syntax highlighting
702702

703+
test_lazy_prereq HIGHLIGHT '
704+
highlight_version=$(highlight --version </dev/null 2>/dev/null) &&
705+
test -n "$highlight_version"
706+
'
703707

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
708+
test_expect_success HIGHLIGHT '
711709
cat >>gitweb_config.perl <<-\EOF
712710
our $highlight_bin = "highlight";
713-
$feature{'highlight'}{'override'} = 1;
711+
$feature{"highlight"}{"override"} = 1;
714712
EOF
715-
fi
713+
'
716714

717715
test_expect_success HIGHLIGHT \
718716
'syntax highlighting (no highlight, unknown syntax)' \

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" &&
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

0 commit comments

Comments
 (0)