提交 fadb5156 编写于 作者: Æ Ævar Arnfjörð Bjarmason 提交者: Junio C Hamano

tests: Skip tests in a way that makes sense under TAP

SKIP messages are now part of the TAP plan. A TAP harness now knows
why a particular test was skipped and can report that information. The
non-TAP harness built into Git's test-lib did nothing special with
these messages, and is unaffected by these changes.
Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 57e1538a
...@@ -5,11 +5,11 @@ git_svn_id=git""-svn-id ...@@ -5,11 +5,11 @@ git_svn_id=git""-svn-id
if test -n "$NO_SVN_TESTS" if test -n "$NO_SVN_TESTS"
then then
say 'skipping git svn tests, NO_SVN_TESTS defined' skip_all='skipping git svn tests, NO_SVN_TESTS defined'
test_done test_done
fi fi
if ! test_have_prereq PERL; then if ! test_have_prereq PERL; then
say 'skipping git svn tests, perl not available' skip_all='skipping git svn tests, perl not available'
test_done test_done
fi fi
......
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
if test -z "$GIT_TEST_HTTPD" if test -z "$GIT_TEST_HTTPD"
then then
say "skipping test, network testing disabled by default" skip_all="Network testing disabled (define GIT_TEST_HTTPD to enable)"
say "(define GIT_TEST_HTTPD to enable)"
test_done test_done
fi fi
......
...@@ -15,9 +15,12 @@ umask 077 ...@@ -15,9 +15,12 @@ umask 077
# is a good candidate: exists on all unices, and it has permission # is a good candidate: exists on all unices, and it has permission
# anyway, so we don't create a security hole running the testsuite. # anyway, so we don't create a security hole running the testsuite.
if ! setfacl -m u:root:rwx .; then setfacl_out="$(setfacl -m u:root:rwx . 2>&1)"
say "Skipping ACL tests: unable to use setfacl" setfacl_ret=$?
test_done
if [ $setfacl_ret != 0 ]; then
skip_all="Skipping ACL tests: unable to use setfacl (output: '$setfacl_out'; return code: '$setfacl_ret')"
test_done
fi fi
check_perms_and_acl () { check_perms_and_acl () {
......
...@@ -99,17 +99,17 @@ test_foobar_foobar() { ...@@ -99,17 +99,17 @@ test_foobar_foobar() {
} }
if ! test_have_prereq POSIXPERM || ! [ -w / ]; then if ! test_have_prereq POSIXPERM || ! [ -w / ]; then
say "Dangerous test skipped. Read this test if you want to execute it" skip_all="Dangerous test skipped. Read this test if you want to execute it"
test_done test_done
fi fi
if [ "$IKNOWWHATIAMDOING" != "YES" ]; then if [ "$IKNOWWHATIAMDOING" != "YES" ]; then
say "You must set env var IKNOWWHATIAMDOING=YES in order to run this test" skip_all="You must set env var IKNOWWHATIAMDOING=YES in order to run this test"
test_done test_done
fi fi
if [ "$UID" = 0 ]; then if [ "$UID" = 0 ]; then
say "No you can't run this with root" skip_all="No you can't run this with root"
test_done test_done
fi fi
......
...@@ -8,7 +8,7 @@ test_description='git checkout to switch between branches with symlink<->dir' ...@@ -8,7 +8,7 @@ test_description='git checkout to switch between branches with symlink<->dir'
if ! test_have_prereq SYMLINKS if ! test_have_prereq SYMLINKS
then then
say "symbolic links not supported - skipping tests" skip_all="symbolic links not supported - skipping tests"
test_done test_done
fi fi
......
...@@ -26,7 +26,7 @@ echo 'Foo Bar Baz' >"$p2" ...@@ -26,7 +26,7 @@ echo 'Foo Bar Baz' >"$p2"
test -f "$p1" && cmp "$p0" "$p1" || { test -f "$p1" && cmp "$p0" "$p1" || {
# since FAT/NTFS does not allow tabs in filenames, skip this test # since FAT/NTFS does not allow tabs in filenames, skip this test
say 'Your filesystem does not allow tabs in filenames, test skipped.' skip_all='Your filesystem does not allow tabs in filenames, test skipped.'
test_done test_done
} }
......
...@@ -8,7 +8,7 @@ test_description='Test commit notes index (expensive!)' ...@@ -8,7 +8,7 @@ test_description='Test commit notes index (expensive!)'
. ./test-lib.sh . ./test-lib.sh
test -z "$GIT_NOTES_TIMING_TESTS" && { test -z "$GIT_NOTES_TIMING_TESTS" && {
say Skipping timing tests skip_all="Skipping timing tests"
test_done test_done
exit exit
} }
......
...@@ -39,7 +39,7 @@ if test -f test-file ...@@ -39,7 +39,7 @@ if test -f test-file
then then
test_set_prereq RO_DIR test_set_prereq RO_DIR
else else
say 'skipping removal failure test (perhaps running as root?)' skip_all='skipping removal failure test (perhaps running as root?)'
fi fi
chmod 775 . chmod 775 .
rm -f test-file rm -f test-file
......
...@@ -4,7 +4,7 @@ test_description='add -i basic tests' ...@@ -4,7 +4,7 @@ test_description='add -i basic tests'
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq PERL; then if ! test_have_prereq PERL; then
say 'skipping git add -i tests, perl not available' skip_all='skipping git add -i tests, perl not available'
test_done test_done
fi fi
...@@ -154,7 +154,7 @@ rm -f .gitignore ...@@ -154,7 +154,7 @@ rm -f .gitignore
if test "$(git config --bool core.filemode)" = false if test "$(git config --bool core.filemode)" = false
then then
say 'skipping filemode tests (filesystem does not properly support modes)' say '# skipping filemode tests (filesystem does not properly support modes)'
else else
test_set_prereq FILEMODE test_set_prereq FILEMODE
fi fi
......
...@@ -17,7 +17,7 @@ DQ='"' ...@@ -17,7 +17,7 @@ DQ='"'
echo foo 2>/dev/null > "Name and an${HT}HT" echo foo 2>/dev/null > "Name and an${HT}HT"
test -f "Name and an${HT}HT" || { test -f "Name and an${HT}HT" || {
# since FAT/NTFS does not allow tabs in filenames, skip this test # since FAT/NTFS does not allow tabs in filenames, skip this test
say 'Your filesystem does not allow tabs in filenames, test skipped.' skip_all='Your filesystem does not allow tabs in filenames, test skipped.'
test_done test_done
} }
......
...@@ -14,7 +14,7 @@ by an edit for them. ...@@ -14,7 +14,7 @@ by an edit for them.
if ! test_have_prereq SYMLINKS if ! test_have_prereq SYMLINKS
then then
say 'Symbolic links not supported, skipping tests.' skip_all='Symbolic links not supported, skipping tests.'
test_done test_done
fi fi
......
...@@ -11,7 +11,7 @@ test_description='Test diff of symlinks. ...@@ -11,7 +11,7 @@ test_description='Test diff of symlinks.
if ! test_have_prereq SYMLINKS if ! test_have_prereq SYMLINKS
then then
say 'Symbolic links not supported, skipping tests.' skip_all='Symbolic links not supported, skipping tests.'
test_done test_done
fi fi
......
...@@ -14,7 +14,7 @@ P2='pathname with SP' ...@@ -14,7 +14,7 @@ P2='pathname with SP'
P3='pathname P3='pathname
with LF' with LF'
: 2>/dev/null >"$P1" && test -f "$P1" && rm -f "$P1" || { : 2>/dev/null >"$P1" && test -f "$P1" && rm -f "$P1" || {
say 'Your filesystem does not allow tabs in filenames, test skipped.' skip_all='Your filesystem does not allow tabs in filenames, test skipped.'
test_done test_done
} }
......
...@@ -6,7 +6,7 @@ test_description='typechange rename detection' ...@@ -6,7 +6,7 @@ test_description='typechange rename detection'
if ! test_have_prereq SYMLINKS if ! test_have_prereq SYMLINKS
then then
say 'Symbolic links not supported, skipping tests.' skip_all='Symbolic links not supported, skipping tests.'
test_done test_done
fi fi
......
...@@ -11,7 +11,7 @@ test_description='git apply should not get confused with type changes. ...@@ -11,7 +11,7 @@ test_description='git apply should not get confused with type changes.
if ! test_have_prereq SYMLINKS if ! test_have_prereq SYMLINKS
then then
say 'Symbolic links not supported, skipping tests.' skip_all='Symbolic links not supported, skipping tests.'
test_done test_done
fi fi
......
...@@ -11,7 +11,7 @@ test_description='git apply symlinks and partial files ...@@ -11,7 +11,7 @@ test_description='git apply symlinks and partial files
if ! test_have_prereq SYMLINKS if ! test_have_prereq SYMLINKS
then then
say 'Symbolic links not supported, skipping tests.' skip_all='Symbolic links not supported, skipping tests.'
test_done test_done
fi fi
......
...@@ -5,7 +5,7 @@ test_description='apply to deeper directory without getting fooled with symlink' ...@@ -5,7 +5,7 @@ test_description='apply to deeper directory without getting fooled with symlink'
if ! test_have_prereq SYMLINKS if ! test_have_prereq SYMLINKS
then then
say 'Symbolic links not supported, skipping tests.' skip_all='Symbolic links not supported, skipping tests.'
test_done test_done
fi fi
......
...@@ -74,7 +74,7 @@ if msg=$(git verify-pack -v "test-3-${pack3}.pack" 2>&1) || ...@@ -74,7 +74,7 @@ if msg=$(git verify-pack -v "test-3-${pack3}.pack" 2>&1) ||
then then
test_set_prereq OFF64_T test_set_prereq OFF64_T
else else
say "skipping tests concerning 64-bit offsets" say "# skipping tests concerning 64-bit offsets"
fi fi
test_expect_success OFF64_T \ test_expect_success OFF64_T \
......
...@@ -6,7 +6,7 @@ test_description='test automatic tag following' ...@@ -6,7 +6,7 @@ test_description='test automatic tag following'
case $(uname -s) in case $(uname -s) in
*MINGW*) *MINGW*)
say "GIT_DEBUG_SEND_PACK not supported - skipping tests" skip_all="GIT_DEBUG_SEND_PACK not supported - skipping tests"
test_done test_done
esac esac
......
...@@ -6,7 +6,7 @@ test_description='pulling from symlinked subdir' ...@@ -6,7 +6,7 @@ test_description='pulling from symlinked subdir'
if ! test_have_prereq SYMLINKS if ! test_have_prereq SYMLINKS
then then
say 'Symbolic links not supported, skipping tests.' skip_all='Symbolic links not supported, skipping tests.'
test_done test_done
fi fi
......
...@@ -11,7 +11,7 @@ This test runs various sanity checks on http-push.' ...@@ -11,7 +11,7 @@ This test runs various sanity checks on http-push.'
if git http-push > /dev/null 2>&1 || [ $? -eq 128 ] if git http-push > /dev/null 2>&1 || [ $? -eq 128 ]
then then
say "skipping test, USE_CURL_MULTI is not defined" skip_all="skipping test, USE_CURL_MULTI is not defined"
test_done test_done
fi fi
......
...@@ -7,7 +7,7 @@ test_description='test smart pushing over http via http-backend' ...@@ -7,7 +7,7 @@ test_description='test smart pushing over http via http-backend'
. ./test-lib.sh . ./test-lib.sh
if test -n "$NO_CURL"; then if test -n "$NO_CURL"; then
say 'skipping test, git built without http support' skip_all='skipping test, git built without http support'
test_done test_done
fi fi
......
...@@ -4,7 +4,7 @@ test_description='test dumb fetching over http via static file' ...@@ -4,7 +4,7 @@ test_description='test dumb fetching over http via static file'
. ./test-lib.sh . ./test-lib.sh
if test -n "$NO_CURL"; then if test -n "$NO_CURL"; then
say 'skipping test, git built without http support' skip_all='skipping test, git built without http support'
test_done test_done
fi fi
......
...@@ -4,7 +4,7 @@ test_description='test smart fetching over http via http-backend' ...@@ -4,7 +4,7 @@ test_description='test smart fetching over http via http-backend'
. ./test-lib.sh . ./test-lib.sh
if test -n "$NO_CURL"; then if test -n "$NO_CURL"; then
say 'skipping test, git built without http support' skip_all='skipping test, git built without http support'
test_done test_done
fi fi
......
...@@ -4,7 +4,7 @@ test_description='test git-http-backend' ...@@ -4,7 +4,7 @@ test_description='test git-http-backend'
. ./test-lib.sh . ./test-lib.sh
if test -n "$NO_CURL"; then if test -n "$NO_CURL"; then
say 'skipping test, git built without http support' skip_all='skipping test, git built without http support'
test_done test_done
fi fi
......
...@@ -4,7 +4,7 @@ test_description='Test cloning a repository larger than 2 gigabyte' ...@@ -4,7 +4,7 @@ test_description='Test cloning a repository larger than 2 gigabyte'
. ./test-lib.sh . ./test-lib.sh
test -z "$GIT_TEST_CLONE_2GB" && test -z "$GIT_TEST_CLONE_2GB" &&
say "Skipping expensive 2GB clone test; enable it with GIT_TEST_CLONE_2GB=t" && skip_all="Skipping expensive 2GB clone test; enable it with GIT_TEST_CLONE_2GB=t" &&
test_done && test_done &&
exit exit
......
...@@ -5,7 +5,7 @@ test_description='merging when a directory was replaced with a symlink' ...@@ -5,7 +5,7 @@ test_description='merging when a directory was replaced with a symlink'
if ! test_have_prereq SYMLINKS if ! test_have_prereq SYMLINKS
then then
say 'Symbolic links not supported, skipping tests.' skip_all='Symbolic links not supported, skipping tests.'
test_done test_done
fi fi
......
...@@ -583,7 +583,7 @@ test_expect_success \ ...@@ -583,7 +583,7 @@ test_expect_success \
# subsequent tests require gpg; check if it is available # subsequent tests require gpg; check if it is available
gpg --version >/dev/null 2>/dev/null gpg --version >/dev/null 2>/dev/null
if [ $? -eq 127 ]; then if [ $? -eq 127 ]; then
say "gpg not found - skipping tag signing and verification tests" say "# gpg not found - skipping tag signing and verification tests"
else else
# As said here: http://www.gnupg.org/documentation/faqs.html#q6.19 # As said here: http://www.gnupg.org/documentation/faqs.html#q6.19
# the gpg version 1.0.6 didn't parse trust packets correctly, so for # the gpg version 1.0.6 didn't parse trust packets correctly, so for
......
...@@ -36,7 +36,7 @@ then ...@@ -36,7 +36,7 @@ then
} }
test_set_prereq TTY test_set_prereq TTY
else else
say no usable terminal, so skipping some tests say "# no usable terminal, so skipping some tests"
fi fi
test_expect_success 'setup' ' test_expect_success 'setup' '
......
...@@ -11,7 +11,7 @@ Testing basic diff tool invocation ...@@ -11,7 +11,7 @@ Testing basic diff tool invocation
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq PERL; then if ! test_have_prereq PERL; then
say 'skipping difftool tests, perl not available' skip_all='skipping difftool tests, perl not available'
test_done test_done
fi fi
......
...@@ -4,7 +4,7 @@ test_description='git send-email' ...@@ -4,7 +4,7 @@ test_description='git send-email'
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq PERL; then if ! test_have_prereq PERL; then
say 'skipping git send-email tests, perl not available' skip_all='skipping git send-email tests, perl not available'
test_done test_done
fi fi
...@@ -58,7 +58,7 @@ test_no_confirm () { ...@@ -58,7 +58,7 @@ test_no_confirm () {
# Exit immediately to prevent hang if a no-confirm test fails # Exit immediately to prevent hang if a no-confirm test fails
check_no_confirm () { check_no_confirm () {
test -f no_confirm_okay || { test -f no_confirm_okay || {
say 'No confirm test failed; skipping remaining tests to prevent hanging' skip_all='confirm test failed; skipping remaining tests to prevent hanging'
test_done test_done
} }
} }
......
...@@ -15,7 +15,7 @@ case "$GIT_SVN_LC_ALL" in ...@@ -15,7 +15,7 @@ case "$GIT_SVN_LC_ALL" in
test_set_prereq UTF8 test_set_prereq UTF8
;; ;;
*) *)
say "UTF-8 locale not set, some tests skipped ($GIT_SVN_LC_ALL)" say "# UTF-8 locale not set, some tests skipped ($GIT_SVN_LC_ALL)"
;; ;;
esac esac
......
...@@ -13,7 +13,7 @@ case $v in ...@@ -13,7 +13,7 @@ case $v in
1.[456].*) 1.[456].*)
;; ;;
*) *)
say "skipping svn-info test (SVN version: $v not supported)" skip_all="skipping svn-info test (SVN version: $v not supported)"
test_done test_done
;; ;;
esac esac
......
...@@ -23,7 +23,7 @@ if test -n "$a_utf8_locale" ...@@ -23,7 +23,7 @@ if test -n "$a_utf8_locale"
then then
test_set_prereq UTF8 test_set_prereq UTF8
else else
say "UTF-8 locale not available, some tests are skipped" say "# UTF-8 locale not available, some tests are skipped"
fi fi
compare_svn_head_with () { compare_svn_head_with () {
......
...@@ -43,7 +43,7 @@ then ...@@ -43,7 +43,7 @@ then
gunzip .git/svn/refs/remotes/git-svn/unhandled.log.gz gunzip .git/svn/refs/remotes/git-svn/unhandled.log.gz
' '
else else
say "Perl Compress::Zlib unavailable, skipping gunzip test" say "# Perl Compress::Zlib unavailable, skipping gunzip test"
fi fi
test_expect_success 'git svn gc does not change unhandled.log files' ' test_expect_success 'git svn gc does not change unhandled.log files' '
......
...@@ -7,14 +7,14 @@ test_description='Test export of commits to CVS' ...@@ -7,14 +7,14 @@ test_description='Test export of commits to CVS'
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq PERL; then if ! test_have_prereq PERL; then
say 'skipping git cvsexportcommit tests, perl not available' skip_all='skipping git cvsexportcommit tests, perl not available'
test_done test_done
fi fi
cvs >/dev/null 2>&1 cvs >/dev/null 2>&1
if test $? -ne 1 if test $? -ne 1
then then
say 'skipping git cvsexportcommit tests, cvs not found' skip_all='skipping git cvsexportcommit tests, cvs not found'
test_done test_done
fi fi
......
...@@ -11,17 +11,17 @@ cvs CLI client via git-cvsserver server' ...@@ -11,17 +11,17 @@ cvs CLI client via git-cvsserver server'
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq PERL; then if ! test_have_prereq PERL; then
say 'skipping git cvsserver tests, perl not available' skip_all='skipping git cvsserver tests, perl not available'
test_done test_done
fi fi
cvs >/dev/null 2>&1 cvs >/dev/null 2>&1
if test $? -ne 1 if test $? -ne 1
then then
say 'skipping git-cvsserver tests, cvs not found' skip_all='skipping git-cvsserver tests, cvs not found'
test_done test_done
fi fi
"$PERL_PATH" -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || { "$PERL_PATH" -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
say 'skipping git-cvsserver tests, Perl SQLite interface unavailable' skip_all='skipping git-cvsserver tests, Perl SQLite interface unavailable'
test_done test_done
} }
......
...@@ -41,16 +41,16 @@ not_present() { ...@@ -41,16 +41,16 @@ not_present() {
cvs >/dev/null 2>&1 cvs >/dev/null 2>&1
if test $? -ne 1 if test $? -ne 1
then then
say 'skipping git-cvsserver tests, cvs not found' skip_all='skipping git-cvsserver tests, cvs not found'
test_done test_done
fi fi
if ! test_have_prereq PERL if ! test_have_prereq PERL
then then
say 'skipping git-cvsserver tests, perl not available' skip_all='skipping git-cvsserver tests, perl not available'
test_done test_done
fi fi
"$PERL_PATH" -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || { "$PERL_PATH" -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
say 'skipping git-cvsserver tests, Perl SQLite interface unavailable' skip_all='skipping git-cvsserver tests, Perl SQLite interface unavailable'
test_done test_done
} }
......
...@@ -4,7 +4,7 @@ test_description='git cvsimport basic tests' ...@@ -4,7 +4,7 @@ test_description='git cvsimport basic tests'
. ./lib-cvs.sh . ./lib-cvs.sh
if ! test_have_prereq PERL; then if ! test_have_prereq PERL; then
say 'skipping git cvsimport tests, perl not available' skip_all='skipping git cvsimport tests, perl not available'
test_done test_done
fi fi
......
...@@ -7,12 +7,12 @@ test_description='perl interface (Git.pm)' ...@@ -7,12 +7,12 @@ test_description='perl interface (Git.pm)'
. ./test-lib.sh . ./test-lib.sh
if ! test_have_prereq PERL; then if ! test_have_prereq PERL; then
say 'skipping perl interface tests, perl not available' skip_all='skipping perl interface tests, perl not available'
test_done test_done
fi fi
"$PERL_PATH" -MTest::More -e 0 2>/dev/null || { "$PERL_PATH" -MTest::More -e 0 2>/dev/null || {
say "Perl Test::More unavailable, skipping test" skip_all="Perl Test::More unavailable, skipping test"
test_done test_done
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册