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 prereqsmaint
commit
b1dc2e796e
|
@ -17,6 +17,6 @@ if get_option('tests')
|
|||
workdir: meson.current_source_dir(),
|
||||
env: credential_netrc_testenv,
|
||||
depends: test_dependencies + bin_wrappers + [credential_netrc],
|
||||
timeout: 0,
|
||||
kwargs: test_kwargs,
|
||||
)
|
||||
endif
|
||||
|
|
|
@ -21,7 +21,7 @@ if get_option('tests')
|
|||
env: subtree_test_environment,
|
||||
workdir: meson.current_source_dir() / 't',
|
||||
depends: test_dependencies + bin_wrappers + [ git_subtree ],
|
||||
timeout: 0,
|
||||
kwargs: test_kwargs,
|
||||
)
|
||||
endif
|
||||
|
||||
|
|
12
meson.build
12
meson.build
|
@ -2054,6 +2054,18 @@ subdir('templates')
|
|||
# can properly set up test dependencies. The bin-wrappers themselves are set up
|
||||
# at configuration time, so these are fine.
|
||||
if get_option('tests')
|
||||
test_kwargs = {
|
||||
'timeout': 0,
|
||||
}
|
||||
|
||||
# The TAP protocol was already understood by previous versions of Meson, but
|
||||
# it was incompatible with the `meson test --interactive` flag.
|
||||
if meson.version().version_compare('>=1.8.0')
|
||||
test_kwargs += {
|
||||
'protocol': 'tap',
|
||||
}
|
||||
endif
|
||||
|
||||
subdir('t')
|
||||
endif
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ clar_unit_tests = executable('unit-tests',
|
|||
sources: clar_sources + clar_test_suites,
|
||||
dependencies: [libgit_commonmain],
|
||||
)
|
||||
test('unit-tests', clar_unit_tests)
|
||||
test('unit-tests', clar_unit_tests, kwargs: test_kwargs)
|
||||
|
||||
unit_test_programs = [
|
||||
'unit-tests/t-reftable-basics.c',
|
||||
|
@ -76,7 +76,7 @@ foreach unit_test_program : unit_test_programs
|
|||
)
|
||||
test(unit_test_name, unit_test,
|
||||
workdir: meson.current_source_dir(),
|
||||
timeout: 0,
|
||||
kwargs: test_kwargs,
|
||||
)
|
||||
endforeach
|
||||
|
||||
|
@ -1212,7 +1212,7 @@ foreach integration_test : integration_tests
|
|||
workdir: meson.current_source_dir(),
|
||||
env: test_environment,
|
||||
depends: test_dependencies + bin_wrappers,
|
||||
timeout: 0,
|
||||
kwargs: test_kwargs,
|
||||
)
|
||||
endforeach
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ test_expect_success 'subtest: a failing TODO test' '
|
|||
'
|
||||
|
||||
test_expect_success 'subtest: a passing TODO test' '
|
||||
write_and_run_sub_test_lib_test passing-todo <<-\EOF &&
|
||||
write_and_run_sub_test_lib_test_err passing-todo <<-\EOF &&
|
||||
test_expect_failure "pretend we have fixed a known breakage" "true"
|
||||
test_done
|
||||
EOF
|
||||
|
@ -142,7 +142,7 @@ test_expect_success 'subtest: a passing TODO test' '
|
|||
'
|
||||
|
||||
test_expect_success 'subtest: 2 TODO tests, one passin' '
|
||||
write_and_run_sub_test_lib_test partially-passing-todos <<-\EOF &&
|
||||
write_and_run_sub_test_lib_test_err partially-passing-todos <<-\EOF &&
|
||||
test_expect_failure "pretend we have a known breakage" "false"
|
||||
test_expect_success "pretend we have a passing test" "true"
|
||||
test_expect_failure "pretend we have fixed another known breakage" "true"
|
||||
|
@ -219,41 +219,44 @@ test_expect_success 'subtest: --verbose option' '
|
|||
test_expect_success "failing test" false
|
||||
test_done
|
||||
EOF
|
||||
mv t1234-verbose/out t1234-verbose/out+ &&
|
||||
grep -v "^Initialized empty" t1234-verbose/out+ >t1234-verbose/out &&
|
||||
check_sub_test_lib_test t1234-verbose <<-\EOF
|
||||
> expecting success of 1234.1 '\''passing test'\'': true
|
||||
mv t1234-verbose/err t1234-verbose/err+ &&
|
||||
grep -v "^Initialized empty" t1234-verbose/err+ >t1234-verbose/err &&
|
||||
check_sub_test_lib_test_err t1234-verbose \
|
||||
<<-\EOF_OUT 3<<-\EOF_ERR
|
||||
> ok 1 - passing test
|
||||
> ok 2 - test with output
|
||||
> not ok 3 - failing test
|
||||
> # false
|
||||
> # failed 1 among 3 test(s)
|
||||
> 1..3
|
||||
EOF_OUT
|
||||
> expecting success of 1234.1 '\''passing test'\'': true
|
||||
> Z
|
||||
> expecting success of 1234.2 '\''test with output'\'': echo foo
|
||||
> foo
|
||||
> ok 2 - test with output
|
||||
> Z
|
||||
> expecting success of 1234.3 '\''failing test'\'': false
|
||||
> not ok 3 - failing test
|
||||
> # false
|
||||
> Z
|
||||
> # failed 1 among 3 test(s)
|
||||
> 1..3
|
||||
EOF
|
||||
EOF_ERR
|
||||
'
|
||||
|
||||
test_expect_success 'subtest: --verbose-only option' '
|
||||
run_sub_test_lib_test_err \
|
||||
t1234-verbose \
|
||||
--verbose-only=2 &&
|
||||
check_sub_test_lib_test t1234-verbose <<-\EOF
|
||||
check_sub_test_lib_test_err t1234-verbose <<-\EOF_OUT 3<<-\EOF_ERR
|
||||
> ok 1 - passing test
|
||||
> Z
|
||||
> expecting success of 1234.2 '\''test with output'\'': echo foo
|
||||
> foo
|
||||
> ok 2 - test with output
|
||||
> Z
|
||||
> not ok 3 - failing test
|
||||
> # false
|
||||
> # failed 1 among 3 test(s)
|
||||
> 1..3
|
||||
EOF
|
||||
EOF_OUT
|
||||
> Z
|
||||
> expecting success of 1234.2 '\''test with output'\'': echo foo
|
||||
> foo
|
||||
> Z
|
||||
EOF_ERR
|
||||
'
|
||||
|
||||
test_expect_success 'subtest: skip one with GIT_SKIP_TESTS' '
|
||||
|
|
|
@ -10,53 +10,35 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
|||
auml=$(printf '\303\244')
|
||||
aumlcdiar=$(printf '\141\314\210')
|
||||
|
||||
if test_have_prereq CASE_INSENSITIVE_FS
|
||||
then
|
||||
say "will test on a case insensitive filesystem"
|
||||
test_case=test_expect_failure
|
||||
else
|
||||
test_case=test_expect_success
|
||||
fi
|
||||
|
||||
if test_have_prereq UTF8_NFD_TO_NFC
|
||||
then
|
||||
say "will test on a unicode corrupting filesystem"
|
||||
test_unicode=test_expect_failure
|
||||
else
|
||||
test_unicode=test_expect_success
|
||||
fi
|
||||
|
||||
test_have_prereq SYMLINKS ||
|
||||
say "will test on a filesystem lacking symbolic links"
|
||||
|
||||
if test_have_prereq CASE_INSENSITIVE_FS
|
||||
then
|
||||
test_expect_success "detection of case insensitive filesystem during repo init" '
|
||||
test_expect_success CASE_INSENSITIVE_FS "detection of case insensitive filesystem during repo init" '
|
||||
test $(git config --bool core.ignorecase) = true
|
||||
'
|
||||
else
|
||||
test_expect_success "detection of case insensitive filesystem during repo init" '
|
||||
|
||||
test_expect_success !CASE_INSENSITIVE_FS "detection of case insensitive filesystem during repo init" '
|
||||
{
|
||||
test_must_fail git config --bool core.ignorecase >/dev/null ||
|
||||
test $(git config --bool core.ignorecase) = false
|
||||
}
|
||||
'
|
||||
fi
|
||||
|
||||
if test_have_prereq SYMLINKS
|
||||
then
|
||||
test_expect_success "detection of filesystem w/o symlink support during repo init" '
|
||||
test_expect_success SYMLINKS "detection of filesystem w/o symlink support during repo init" '
|
||||
{
|
||||
test_must_fail git config --bool core.symlinks ||
|
||||
test "$(git config --bool core.symlinks)" = true
|
||||
}
|
||||
'
|
||||
else
|
||||
test_expect_success "detection of filesystem w/o symlink support during repo init" '
|
||||
|
||||
test_expect_success !SYMLINKS "detection of filesystem w/o symlink support during repo init" '
|
||||
v=$(git config --bool core.symlinks) &&
|
||||
test "$v" = false
|
||||
'
|
||||
fi
|
||||
|
||||
test_expect_success "setup case tests" '
|
||||
git config core.ignorecase true &&
|
||||
|
|
|
@ -30,7 +30,7 @@ setup_repo() {
|
|||
|
||||
test_repo=test
|
||||
push_repo() {
|
||||
test_create_repo $test_repo
|
||||
git init --quiet $test_repo
|
||||
cd $test_repo
|
||||
|
||||
setup_repo
|
||||
|
|
|
@ -17,11 +17,6 @@ test_expect_success 'Initialize test directory' '
|
|||
git commit -m "add normal files"
|
||||
'
|
||||
|
||||
if test_have_prereq !FUNNYNAMES
|
||||
then
|
||||
say 'Your filesystem does not allow tabs in filenames.'
|
||||
fi
|
||||
|
||||
test_expect_success FUNNYNAMES 'add files with funny names' '
|
||||
touch -- "tab embedded" "newline${LF}embedded" &&
|
||||
git add -- "tab embedded" "newline${LF}embedded" &&
|
||||
|
|
|
@ -36,7 +36,7 @@ test_expect_success 'git diff-files -p after editing work tree.' '
|
|||
# that's as far as it comes
|
||||
if [ "$(git config --get core.filemode)" = false ]
|
||||
then
|
||||
say 'filemode disabled on the filesystem'
|
||||
skip_all='filemode disabled on the filesystem'
|
||||
test_done
|
||||
fi
|
||||
|
||||
|
|
|
@ -48,11 +48,12 @@ commit_file () {
|
|||
git commit "$@" -m "Commit $*" >/dev/null
|
||||
}
|
||||
|
||||
test_create_repo sm1 &&
|
||||
add_file . foo >/dev/null
|
||||
|
||||
head1=$(add_file sm1 foo1 foo2)
|
||||
fullhead1=$(cd sm1; git rev-parse --verify HEAD)
|
||||
test_expect_success 'setup submodule' '
|
||||
git init sm1 &&
|
||||
add_file . foo &&
|
||||
head1=$(add_file sm1 foo1 foo2) &&
|
||||
fullhead1=$(cd sm1 && git rev-parse --verify HEAD)
|
||||
'
|
||||
|
||||
test_expect_success 'added submodule' '
|
||||
git add sm1 &&
|
||||
|
@ -235,10 +236,13 @@ test_expect_success 'typechanged submodule(submodule->blob)' '
|
|||
test_cmp expected actual
|
||||
'
|
||||
|
||||
rm -f sm1 &&
|
||||
test_create_repo sm1 &&
|
||||
head6=$(add_file sm1 foo6 foo7)
|
||||
fullhead6=$(cd sm1; git rev-parse --verify HEAD)
|
||||
test_expect_success 'setup submodule anew' '
|
||||
rm -f sm1 &&
|
||||
git init sm1 &&
|
||||
head6=$(add_file sm1 foo6 foo7) &&
|
||||
fullhead6=$(cd sm1 && git rev-parse --verify HEAD)
|
||||
'
|
||||
|
||||
test_expect_success 'nonexistent commit' '
|
||||
git diff-index -p --submodule=log HEAD >actual &&
|
||||
cat >expected <<-EOF &&
|
||||
|
|
|
@ -363,9 +363,12 @@ test_expect_success 'typechanged submodule(submodule->blob)' '
|
|||
diff_cmp expected actual
|
||||
'
|
||||
|
||||
rm -f sm1 &&
|
||||
test_create_repo sm1 &&
|
||||
head6=$(add_file sm1 foo6 foo7)
|
||||
test_expect_success 'setup' '
|
||||
rm -f sm1 &&
|
||||
git init sm1 &&
|
||||
head6=$(add_file sm1 foo6 foo7)
|
||||
'
|
||||
|
||||
test_expect_success 'nonexistent commit' '
|
||||
git diff-index -p --submodule=diff HEAD >actual &&
|
||||
cat >expected <<-EOF &&
|
||||
|
|
|
@ -38,10 +38,11 @@ commit_file () {
|
|||
git commit "$@" -m "Commit $*" >/dev/null
|
||||
}
|
||||
|
||||
test_create_repo sm1 &&
|
||||
add_file . foo >/dev/null
|
||||
|
||||
head1=$(add_file sm1 foo1 foo2)
|
||||
test_expect_success 'setup submodule' '
|
||||
git init sm1 &&
|
||||
add_file . foo &&
|
||||
head1=$(add_file sm1 foo1 foo2)
|
||||
'
|
||||
|
||||
test_expect_success 'added submodule' "
|
||||
git add sm1 &&
|
||||
|
@ -214,9 +215,12 @@ test_expect_success 'typechanged submodule(submodule->blob)' "
|
|||
test_cmp expected actual
|
||||
"
|
||||
|
||||
rm -f sm1 &&
|
||||
test_create_repo sm1 &&
|
||||
head6=$(add_file sm1 foo6 foo7)
|
||||
test_expect_success 'setup submodule' '
|
||||
rm -f sm1 &&
|
||||
git init sm1 &&
|
||||
head6=$(add_file sm1 foo6 foo7)
|
||||
'
|
||||
|
||||
test_expect_success 'nonexistent commit' "
|
||||
git submodule summary >actual &&
|
||||
cat >expected <<-EOF &&
|
||||
|
|
|
@ -63,7 +63,7 @@ test_expect_success 'git grep ile a' '
|
|||
git grep ile a
|
||||
'
|
||||
|
||||
test_expect_failure !CYGWIN 'git grep .fi a' '
|
||||
test_expect_failure !CYGWIN,!MACOS 'git grep .fi a' '
|
||||
git grep .fi a
|
||||
'
|
||||
|
||||
|
|
|
@ -700,19 +700,17 @@ test_expect_success \
|
|||
# ----------------------------------------------------------------------
|
||||
# syntax highlighting
|
||||
|
||||
test_lazy_prereq HIGHLIGHT '
|
||||
highlight_version=$(highlight --version </dev/null 2>/dev/null) &&
|
||||
test -n "$highlight_version"
|
||||
'
|
||||
|
||||
highlight_version=$(highlight --version </dev/null 2>/dev/null)
|
||||
if [ $? -eq 127 ]; then
|
||||
say "Skipping syntax highlighting tests: 'highlight' not found"
|
||||
elif test -z "$highlight_version"; then
|
||||
say "Skipping syntax highlighting tests: incorrect 'highlight' found"
|
||||
else
|
||||
test_set_prereq HIGHLIGHT
|
||||
test_expect_success HIGHLIGHT '
|
||||
cat >>gitweb_config.perl <<-\EOF
|
||||
our $highlight_bin = "highlight";
|
||||
$feature{'highlight'}{'override'} = 1;
|
||||
$feature{"highlight"}{"override"} = 1;
|
||||
EOF
|
||||
fi
|
||||
'
|
||||
|
||||
test_expect_success HIGHLIGHT \
|
||||
'syntax highlighting (no highlight, unknown syntax)' \
|
||||
|
|
|
@ -7,12 +7,17 @@ test_description='Clone repositories with non ASCII paths'
|
|||
UTF8_ESCAPED="a-\303\244_o-\303\266_u-\303\274.txt"
|
||||
ISO8859_ESCAPED="a-\344_o-\366_u-\374.txt"
|
||||
|
||||
ISO8859="$(printf "$ISO8859_ESCAPED")" &&
|
||||
echo content123 >"$ISO8859" &&
|
||||
rm "$ISO8859" || {
|
||||
test_lazy_prereq FS_ACCEPTS_ISO_8859_1 '
|
||||
ISO8859="$(printf "$ISO8859_ESCAPED")" &&
|
||||
echo content123 >"$ISO8859" &&
|
||||
rm "$ISO8859"
|
||||
'
|
||||
|
||||
if ! test_have_prereq FS_ACCEPTS_ISO_8859_1
|
||||
then
|
||||
skip_all="fs does not accept ISO-8859-1 filenames"
|
||||
test_done
|
||||
}
|
||||
fi
|
||||
|
||||
test_expect_success 'start p4d' '
|
||||
start_p4d
|
||||
|
|
|
@ -12,23 +12,25 @@ failing, and produces maximally sane output in git.'
|
|||
## SECTION REPEATED IN t9836 ##
|
||||
###############################
|
||||
|
||||
EXTRA_PATH="$(pwd)/temp_python"
|
||||
mkdir "$EXTRA_PATH"
|
||||
PATH="$EXTRA_PATH:$PATH"
|
||||
export PATH
|
||||
|
||||
# These tests are specific to Python 2. Write a custom script that executes
|
||||
# git-p4 directly with the Python 2 interpreter to ensure that we use that
|
||||
# version even if Git was compiled with Python 3.
|
||||
python_target_binary=$(which python2)
|
||||
if test -n "$python_target_binary"
|
||||
then
|
||||
mkdir temp_python
|
||||
PATH="$(pwd)/temp_python:$PATH"
|
||||
export PATH
|
||||
|
||||
write_script temp_python/git-p4-python2 <<-EOF
|
||||
test_lazy_prereq P4_PYTHON2 '
|
||||
python_target_binary=$(which python2) &&
|
||||
test -n "$python_target_binary" &&
|
||||
write_script "$EXTRA_PATH"/git-p4-python2 <<-EOF &&
|
||||
exec "$python_target_binary" "$(git --exec-path)/git-p4" "\$@"
|
||||
EOF
|
||||
fi
|
||||
( git p4-python2 || true ) >err &&
|
||||
test_grep "valid commands" err
|
||||
'
|
||||
|
||||
git p4-python2 >err
|
||||
if ! grep 'valid commands' err
|
||||
if ! test_have_prereq P4_PYTHON2
|
||||
then
|
||||
skip_all="skipping python2 git p4 tests; python2 not available"
|
||||
test_done
|
||||
|
|
|
@ -12,23 +12,25 @@ failing, and produces maximally sane output in git.'
|
|||
## SECTION REPEATED IN t9835 ##
|
||||
###############################
|
||||
|
||||
EXTRA_PATH="$(pwd)/temp_python"
|
||||
mkdir "$EXTRA_PATH"
|
||||
PATH="$EXTRA_PATH:$PATH"
|
||||
export PATH
|
||||
|
||||
# These tests are specific to Python 3. Write a custom script that executes
|
||||
# git-p4 directly with the Python 3 interpreter to ensure that we use that
|
||||
# version even if Git was compiled with Python 2.
|
||||
python_target_binary=$(which python3)
|
||||
if test -n "$python_target_binary"
|
||||
then
|
||||
mkdir temp_python
|
||||
PATH="$(pwd)/temp_python:$PATH"
|
||||
export PATH
|
||||
|
||||
write_script temp_python/git-p4-python3 <<-EOF
|
||||
test_lazy_prereq P4_PYTHON3 '
|
||||
python_target_binary=$(which python3) &&
|
||||
test -n "$python_target_binary" &&
|
||||
write_script "$EXTRA_PATH"/git-p4-python3 <<-EOF &&
|
||||
exec "$python_target_binary" "$(git --exec-path)/git-p4" "\$@"
|
||||
EOF
|
||||
fi
|
||||
( git p4-python3 || true ) >err &&
|
||||
test_grep "valid commands" err
|
||||
'
|
||||
|
||||
git p4-python3 >err
|
||||
if ! grep 'valid commands' err
|
||||
if ! test_have_prereq P4_PYTHON3
|
||||
then
|
||||
skip_all="skipping python3 git p4 tests; python3 not available"
|
||||
test_done
|
||||
|
|
|
@ -66,10 +66,6 @@ test_expect_success 'prompt - unborn branch' '
|
|||
test_cmp expected "$actual"
|
||||
'
|
||||
|
||||
if test_have_prereq !FUNNYNAMES; then
|
||||
say 'Your filesystem does not allow newlines in filenames.'
|
||||
fi
|
||||
|
||||
test_expect_success FUNNYNAMES 'prompt - with newline in path' '
|
||||
repo_with_newline="repo
|
||||
with
|
||||
|
|
|
@ -470,7 +470,7 @@ then
|
|||
then
|
||||
: Executed by a Bash version supporting BASH_XTRACEFD. Good.
|
||||
else
|
||||
echo >&2 "warning: ignoring -x; '$0' is untraceable without BASH_XTRACEFD"
|
||||
echo >&2 "# warning: ignoring -x; '$0' is untraceable without BASH_XTRACEFD"
|
||||
trace=
|
||||
fi
|
||||
fi
|
||||
|
@ -707,7 +707,7 @@ then
|
|||
exec 3>>"$GIT_TEST_TEE_OUTPUT_FILE" 4>&3
|
||||
elif test "$verbose" = "t"
|
||||
then
|
||||
exec 4>&2 3>&1
|
||||
exec 4>&2 3>&2
|
||||
else
|
||||
exec 4>/dev/null 3>/dev/null
|
||||
fi
|
||||
|
@ -949,7 +949,7 @@ maybe_setup_verbose () {
|
|||
test -z "$verbose_only" && return
|
||||
if match_pattern_list $test_count "$verbose_only"
|
||||
then
|
||||
exec 4>&2 3>&1
|
||||
exec 4>&2 3>&2
|
||||
# Emit a delimiting blank line when going from
|
||||
# non-verbose to verbose. Within verbose mode the
|
||||
# delimiter is printed by test_expect_*. The choice
|
||||
|
@ -1272,7 +1272,14 @@ test_done () {
|
|||
|
||||
check_test_results_san_file_ "$test_failure"
|
||||
|
||||
if test -z "$skip_all" && test -n "$invert_exit_code"
|
||||
if test "$test_fixed" != 0
|
||||
then
|
||||
if test -z "$invert_exit_code"
|
||||
then
|
||||
GIT_EXIT_OK=t
|
||||
exit 1
|
||||
fi
|
||||
elif test -z "$skip_all" && test -n "$invert_exit_code"
|
||||
then
|
||||
say_color warn "# faking up non-zero exit with --invert-exit-code"
|
||||
GIT_EXIT_OK=t
|
||||
|
@ -1638,6 +1645,9 @@ fi
|
|||
# Fix some commands on Windows, and other OS-specific things
|
||||
uname_s=$(uname -s)
|
||||
case $uname_s in
|
||||
Darwin)
|
||||
test_set_prereq MACOS
|
||||
;;
|
||||
*MINGW*)
|
||||
# Windows has its own (incompatible) sort and find
|
||||
sort () {
|
||||
|
|
Loading…
Reference in New Issue