Skip to content

Commit e031669

Browse files
szedergitster
authored andcommitted
test-lib: don't check prereqs of test cases that won't be run anyway
With './t1234-foo.sh -r 5,6' we can run only specific test cases in a test script, but our test framwork still evaluates all lazy prereqs that the excluded test cases might depend on. This is unnecessary and produces verbose and trace output that can be distracting. This has been an issue ever since the '-r|--run=' options were introduced in 0445e6f (test-lib: '--run' to run only specific tests, 2014-04-30), because that commit added the check of the list of test cases specified with '-r' after evaluating the prereqs. Avoid this unnecessary prereq evaluation by checking the list of test cases specified with '-r' before looking at the prereqs. Note that GIT_SKIP_TESTS has always been checked before the prereqs, so prereqs necessary for tests skipped that way were not evaluated. Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5fa0f52 commit e031669

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

t/test-lib.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,12 @@ test_skip () {
994994
to_skip=t
995995
skipped_reason="GIT_SKIP_TESTS"
996996
fi
997+
if test -z "$to_skip" && test -n "$run_list" &&
998+
! match_test_selector_list '--run' $test_count "$run_list"
999+
then
1000+
to_skip=t
1001+
skipped_reason="--run"
1002+
fi
9971003
if test -z "$to_skip" && test -n "$test_prereq" &&
9981004
! test_have_prereq "$test_prereq"
9991005
then
@@ -1006,12 +1012,6 @@ test_skip () {
10061012
fi
10071013
skipped_reason="missing $missing_prereq${of_prereq}"
10081014
fi
1009-
if test -z "$to_skip" && test -n "$run_list" &&
1010-
! match_test_selector_list '--run' $test_count "$run_list"
1011-
then
1012-
to_skip=t
1013-
skipped_reason="--run"
1014-
fi
10151015

10161016
case "$to_skip" in
10171017
t)

0 commit comments

Comments
 (0)