Merge branch 'jk/t0000-subtests-fix'

Test fix.

* jk/t0000-subtests-fix:
  t0000: clear GIT_SKIP_TESTS before running sub-tests
This commit is contained in:
Junio C Hamano 2021-07-28 13:18:00 -07:00
commit 4d4c8ddd37

View File

@ -69,6 +69,23 @@ test_expect_success 'success is reported like this' '
_run_sub_test_lib_test_common () {
neg="$1" name="$2" descr="$3" # stdin is the body of the test code
shift 3
# intercept pseudo-options at the front of the argument list that we
# will not pass to child script
skip=
while test $# -gt 0
do
case "$1" in
--skip=*)
skip=${1#--*=}
shift
;;
*)
break
;;
esac
done
mkdir "$name" &&
(
# Pretend we're not running under a test harness, whether we
@ -91,6 +108,8 @@ _run_sub_test_lib_test_common () {
export TEST_DIRECTORY &&
TEST_OUTPUT_DIRECTORY=$(pwd) &&
export TEST_OUTPUT_DIRECTORY &&
GIT_SKIP_TESTS=$skip &&
export GIT_SKIP_TESTS &&
sane_unset GIT_TEST_FAIL_PREREQS &&
if test -z "$neg"
then
@ -319,9 +338,9 @@ test_expect_success 'test --verbose-only' '
test_expect_success 'GIT_SKIP_TESTS' '
(
GIT_SKIP_TESTS="git.2" && export GIT_SKIP_TESTS &&
run_sub_test_lib_test git-skip-tests-basic \
"GIT_SKIP_TESTS" <<-\EOF &&
"GIT_SKIP_TESTS" \
--skip="git.2" <<-\EOF &&
for i in 1 2 3
do
test_expect_success "passing test #$i" "true"
@ -340,9 +359,9 @@ test_expect_success 'GIT_SKIP_TESTS' '
test_expect_success 'GIT_SKIP_TESTS several tests' '
(
GIT_SKIP_TESTS="git.2 git.5" && export GIT_SKIP_TESTS &&
run_sub_test_lib_test git-skip-tests-several \
"GIT_SKIP_TESTS several tests" <<-\EOF &&
"GIT_SKIP_TESTS several tests" \
--skip="git.2 git.5" <<-\EOF &&
for i in 1 2 3 4 5 6
do
test_expect_success "passing test #$i" "true"
@ -364,9 +383,9 @@ test_expect_success 'GIT_SKIP_TESTS several tests' '
test_expect_success 'GIT_SKIP_TESTS sh pattern' '
(
GIT_SKIP_TESTS="git.[2-5]" && export GIT_SKIP_TESTS &&
run_sub_test_lib_test git-skip-tests-sh-pattern \
"GIT_SKIP_TESTS sh pattern" <<-\EOF &&
"GIT_SKIP_TESTS sh pattern" \
--skip="git.[2-5]" <<-\EOF &&
for i in 1 2 3 4 5 6
do
test_expect_success "passing test #$i" "true"
@ -388,9 +407,9 @@ test_expect_success 'GIT_SKIP_TESTS sh pattern' '
test_expect_success 'GIT_SKIP_TESTS entire suite' '
(
GIT_SKIP_TESTS="git" && export GIT_SKIP_TESTS &&
run_sub_test_lib_test git-skip-tests-entire-suite \
"GIT_SKIP_TESTS entire suite" <<-\EOF &&
"GIT_SKIP_TESTS entire suite" \
--skip="git" <<-\EOF &&
for i in 1 2 3
do
test_expect_success "passing test #$i" "true"
@ -405,9 +424,9 @@ test_expect_success 'GIT_SKIP_TESTS entire suite' '
test_expect_success 'GIT_SKIP_TESTS does not skip unmatched suite' '
(
GIT_SKIP_TESTS="notgit" && export GIT_SKIP_TESTS &&
run_sub_test_lib_test git-skip-tests-unmatched-suite \
"GIT_SKIP_TESTS does not skip unmatched suite" <<-\EOF &&
"GIT_SKIP_TESTS does not skip unmatched suite" \
--skip="notgit" <<-\EOF &&
for i in 1 2 3
do
test_expect_success "passing test #$i" "true"