Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-12-01 15:41:44 +0300
committerJunio C Hamano <gitster@pobox.com>2018-12-01 15:41:44 +0300
commit623370493673d27c1994ea4394f123e4ed0a20bc (patch)
treee4b28b163845b752b0663de97ab3da8902990dce /t
parent152cb0cdc3df641ee9d47d400058f424377dcaed (diff)
parent165293af3ce4535efa72eb51587383144a2b3f01 (diff)
Merge branch 'sg/test-BUG'
test framework has been updated to make a bug in the test script (as opposed to bugs in Git that are discovered by running the tests) stand out more prominently. * sg/test-BUG: tests: send "bug in the test script" errors to the script's stderr
Diffstat (limited to 't')
-rw-r--r--t/perf/perf-lib.sh4
-rwxr-xr-xt/t0001-init.sh4
-rwxr-xr-xt/t4013-diff-various.sh2
-rwxr-xr-xt/t5516-fetch-push.sh2
-rwxr-xr-xt/t9902-completion.sh2
-rw-r--r--t/test-lib-functions.sh25
-rw-r--r--t/test-lib.sh10
7 files changed, 26 insertions, 23 deletions
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index 11d1922cf5..2e33ab3ec3 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -82,7 +82,7 @@ test_perf_do_repo_symlink_config_ () {
test_perf_create_repo_from () {
test "$#" = 2 ||
- error "bug in the test script: not 2 parameters to test-create-repo"
+ BUG "not 2 parameters to test-create-repo"
repo="$1"
source="$2"
source_git="$("$MODERN_GIT" -C "$source" rev-parse --git-dir)"
@@ -184,7 +184,7 @@ test_wrapper_ () {
test_start_
test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq=
test "$#" = 2 ||
- error "bug in the test script: not 2 or 3 parameters to test-expect-success"
+ BUG "not 2 or 3 parameters to test-expect-success"
export test_prereq
if ! test_skip "$@"
then
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 182da069f1..42a263cada 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -319,14 +319,14 @@ test_lazy_prereq GETCWD_IGNORES_PERMS '
base=GETCWD_TEST_BASE_DIR &&
mkdir -p $base/dir &&
chmod 100 $base ||
- error "bug in test script: cannot prepare $base"
+ BUG "cannot prepare $base"
(cd $base/dir && /bin/pwd -P)
status=$?
chmod 700 $base &&
rm -rf $base ||
- error "bug in test script: cannot clean $base"
+ BUG "cannot clean $base"
return $status
'
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index 73f7038253..7d985ff6b1 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -129,7 +129,7 @@ do
case "$magic" in
noellipses) ;;
*)
- die "bug in t4103: unknown magic $magic" ;;
+ BUG "unknown magic $magic" ;;
esac ;;
*)
cmd="$magic $cmd" magic=
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 7316365a24..37e8e80893 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -95,7 +95,7 @@ mk_child() {
check_push_result () {
test $# -ge 3 ||
- error "bug in the test script: check_push_result requires at least 3 parameters"
+ BUG "check_push_result requires at least 3 parameters"
repo_name="$1"
shift
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 3c6b185b60..d01ad8eb25 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -1249,7 +1249,7 @@ test_expect_success 'teardown after ref completion' '
test_path_completion ()
{
- test $# = 2 || error "bug in the test script: not 2 parameters to test_path_completion"
+ test $# = 2 || BUG "not 2 parameters to test_path_completion"
local cur="$1" expected="$2"
echo "$expected" >expected &&
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 589d93d15b..6b3bbf99e4 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -418,14 +418,14 @@ test_declared_prereq () {
test_verify_prereq () {
test -z "$test_prereq" ||
expr >/dev/null "$test_prereq" : '[A-Z0-9_,!]*$' ||
- error "bug in the test script: '$test_prereq' does not look like a prereq"
+ BUG "'$test_prereq' does not look like a prereq"
}
test_expect_failure () {
test_start_
test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq=
test "$#" = 2 ||
- error "bug in the test script: not 2 or 3 parameters to test-expect-failure"
+ BUG "not 2 or 3 parameters to test-expect-failure"
test_verify_prereq
export test_prereq
if ! test_skip "$@"
@@ -445,7 +445,7 @@ test_expect_success () {
test_start_
test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq=
test "$#" = 2 ||
- error "bug in the test script: not 2 or 3 parameters to test-expect-success"
+ BUG "not 2 or 3 parameters to test-expect-success"
test_verify_prereq
export test_prereq
if ! test_skip "$@"
@@ -472,7 +472,7 @@ test_expect_success () {
test_external () {
test "$#" = 4 && { test_prereq=$1; shift; } || test_prereq=
test "$#" = 3 ||
- error >&5 "bug in the test script: not 3 or 4 parameters to test_external"
+ BUG "not 3 or 4 parameters to test_external"
descr="$1"
shift
test_verify_prereq
@@ -613,7 +613,7 @@ test_path_is_missing () {
test_line_count () {
if test $# != 3
then
- error "bug in the test script: not 3 parameters to test_line_count"
+ BUG "not 3 parameters to test_line_count"
elif ! test $(wc -l <"$3") "$1" "$2"
then
echo "test_line_count: line count for $3 !$1 $2"
@@ -793,13 +793,12 @@ test_i18ngrep () {
eval "last_arg=\${$#}"
test -f "$last_arg" ||
- error "bug in the test script: test_i18ngrep requires a file" \
- "to read as the last parameter"
+ BUG "test_i18ngrep requires a file to read as the last parameter"
if test $# -lt 2 ||
{ test "x!" = "x$1" && test $# -lt 3 ; }
then
- error "bug in the test script: too few parameters to test_i18ngrep"
+ BUG "too few parameters to test_i18ngrep"
fi
if test_have_prereq !C_LOCALE_OUTPUT
@@ -885,7 +884,7 @@ test_seq () {
case $# in
1) set 1 "$@" ;;
2) ;;
- *) error "bug in the test script: not 1 or 2 parameters to test_seq" ;;
+ *) BUG "not 1 or 2 parameters to test_seq" ;;
esac
test_seq_counter__=$1
while test "$test_seq_counter__" -le "$2"
@@ -923,7 +922,7 @@ test_when_finished () {
# doing so on Bash is better than nothing (the test will
# silently pass on other shells).
test "${BASH_SUBSHELL-0}" = 0 ||
- error "bug in test script: test_when_finished does nothing in a subshell"
+ BUG "test_when_finished does nothing in a subshell"
test_cleanup="{ $*
} && (exit \"\$eval_ret\"); eval_ret=\$?; $test_cleanup"
}
@@ -932,7 +931,7 @@ test_when_finished () {
# Usage: test_create_repo <directory>
test_create_repo () {
test "$#" = 1 ||
- error "bug in the test script: not 1 parameter to test-create-repo"
+ BUG "not 1 parameter to test-create-repo"
repo="$1"
mkdir -p "$repo"
(
@@ -1245,7 +1244,7 @@ test_oid_cache () {
if ! expr "$k" : '[a-z0-9][a-z0-9]*$' >/dev/null
then
- error 'bug in the test script: bad hash algorithm'
+ BUG 'bad hash algorithm'
fi &&
eval "test_oid_${k}_$tag=\"\$v\""
done
@@ -1260,7 +1259,7 @@ test_oid () {
# key-hash pair, so exit with an error.
if eval "test -z \"\${$var+set}\""
then
- error "bug in the test script: undefined key '$1'" >&2
+ BUG "undefined key '$1'"
fi &&
eval "printf '%s' \"\${$var}\""
}
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 6c6c0af7a1..0f1faa24b2 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -402,6 +402,10 @@ error () {
exit 1
}
+BUG () {
+ error >&7 "bug in the test script: $*"
+}
+
say () {
say_color info "$*"
}
@@ -729,7 +733,7 @@ test_run_ () {
if $(printf '%s\n' "$1" | sed -f "$GIT_BUILD_DIR/t/chainlint.sed" | grep -q '?![A-Z][A-Z]*?!') ||
test "OK-117" != "$(test_eval_ "(exit 117) && $1${LF}${LF}echo OK-\$?" 3>&1)"
then
- error "bug in the test script: broken &&-chain or run-away HERE-DOC: $1"
+ BUG "broken &&-chain or run-away HERE-DOC: $1"
fi
trace=$trace_tmp
fi
@@ -1231,7 +1235,7 @@ test_lazy_prereq SANITY '
chmod -w SANETESTD.1 &&
chmod -r SANETESTD.1/x &&
chmod -rx SANETESTD.2 ||
- error "bug in test sript: cannot prepare SANETESTD"
+ BUG "cannot prepare SANETESTD"
! test -r SANETESTD.1/x &&
! rm SANETESTD.1/x && ! test -f SANETESTD.2/x
@@ -1239,7 +1243,7 @@ test_lazy_prereq SANITY '
chmod +rwx SANETESTD.1 SANETESTD.2 &&
rm -rf SANETESTD.1 SANETESTD.2 ||
- error "bug in test sript: cannot clean SANETESTD"
+ BUG "cannot clean SANETESTD"
return $status
'