Skip to content

Commit f0f493e

Browse files
committed
Merge branch 'jk/test-framework-updates'
The basic test used to leave unnecessary trash directories in the t/ directory. * jk/test-framework-updates: t0000: drop "known breakage" test t0000: simplify HARNESS_ACTIVE hack t0000: set TEST_OUTPUT_DIRECTORY for sub-tests
2 parents d5d1678 + 738a8be commit f0f493e

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

t/t0000-basic.sh

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,17 @@ test_expect_success '.git/objects should have 3 subdirectories' '
4141
test_expect_success 'success is reported like this' '
4242
:
4343
'
44-
test_expect_failure 'pretend we have a known breakage' '
45-
false
46-
'
4744

4845
run_sub_test_lib_test () {
4946
name="$1" descr="$2" # stdin is the body of the test code
5047
shift 2
5148
mkdir "$name" &&
5249
(
53-
# Pretend we're a test harness. This prevents
54-
# test-lib from writing the counts to a file that will
55-
# later be summarized, showing spurious "failed" tests
56-
HARNESS_ACTIVE=t &&
57-
export HARNESS_ACTIVE &&
50+
# Pretend we're not running under a test harness, whether we
51+
# are or not. The test-lib output depends on the setting of
52+
# this variable, so we need a stable setting under which to run
53+
# the sub-test.
54+
sane_unset HARNESS_ACTIVE &&
5855
cd "$name" &&
5956
cat >"$name.sh" <<-EOF &&
6057
#!$SHELL_PATH
@@ -71,6 +68,8 @@ run_sub_test_lib_test () {
7168
cat >>"$name.sh" &&
7269
chmod +x "$name.sh" &&
7370
export TEST_DIRECTORY &&
71+
TEST_OUTPUT_DIRECTORY=$(pwd) &&
72+
export TEST_OUTPUT_DIRECTORY &&
7473
./"$name.sh" "$@" >out 2>err
7574
)
7675
}
@@ -233,16 +232,13 @@ test_expect_success 'test --verbose' '
233232
grep -v "^Initialized empty" test-verbose/out+ >test-verbose/out &&
234233
check_sub_test_lib_test test-verbose <<-\EOF
235234
> expecting success: true
236-
> Z
237235
> ok 1 - passing test
238236
> Z
239237
> expecting success: echo foo
240238
> foo
241-
> Z
242239
> ok 2 - test with output
243240
> Z
244241
> expecting success: false
245-
> Z
246242
> not ok 3 - failing test
247243
> # false
248244
> Z
@@ -265,7 +261,6 @@ test_expect_success 'test --verbose-only' '
265261
> Z
266262
> expecting success: echo foo
267263
> foo
268-
> Z
269264
> ok 2 - test with output
270265
> Z
271266
> not ok 3 - failing test

t/test-lib.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,6 @@ test_at_end_hook_ () {
481481
test_done () {
482482
GIT_EXIT_OK=t
483483

484-
# Note: t0000 relies on $HARNESS_ACTIVE disabling the .counts
485-
# output file
486484
if test -z "$HARNESS_ACTIVE"
487485
then
488486
test_results_dir="$TEST_OUTPUT_DIRECTORY/test-results"

0 commit comments

Comments
 (0)