t0000: simplify HARNESS_ACTIVE hack

Commit 517cd55 set HARNESS_ACTIVE unconditionally in sub-tests, because that value affects the output of "--verbose". t0000 needs stable output from its sub-tests, and we may or may not be running under a TAP harness. That commit made the decision to always set the variable, since it has another useful side effect, which is suppressing writes to t/test-results by the sub-tests (which would just pollute the real results). Since the last commit, though, the sub-tests have their own test-results directories, so this is no longer an issue. We can now update a few comments that are no longer accurate nor necessary. We can also revisit the choice of HARNESS_ACTIVE. Since we must choose one value for stability, it's probably saner to have it off. This means that future patches could test things like the test-results writing, or the "--quiet" option, which is currently ignored when run under a harness. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Dec 28, 2013 at 04:31 UTC a63c12c9be28bf455816b1ece4a52b463ecf6241
2 files changed +5 -11
t/t0000-basic.sh
+5 -9
@@ -50,11 +50,11 @@ run_sub_test_lib_test () {
50 shift 2
51 mkdir "$name" &&
52 (
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 &&
53 + # Pretend we're not running under a test harness, whether we
54 + # are or not. The test-lib output depends on the setting of
55 + # this variable, so we need a stable setting under which to run
56 + # the sub-test.
57 + sane_unset HARNESS_ACTIVE &&
58 cd "$name" &&
59 cat >"$name.sh" <<-EOF &&
60 #!$SHELL_PATH
@@ -235,16 +235,13 @@ test_expect_success 'test --verbose' '
235 grep -v "^Initialized empty" test-verbose/out+ >test-verbose/out &&
236 check_sub_test_lib_test test-verbose <<-\EOF
237 > expecting success: true
238 - > Z
238 > ok 1 - passing test
239 > Z
240 > expecting success: echo foo
241 > foo
243 - > Z
242 > ok 2 - test with output
243 > Z
244 > expecting success: false
247 - > Z
245 > not ok 3 - failing test
246 > # false
247 > Z
@@ -267,7 +264,6 @@ test_expect_success 'test --verbose-only' '
264 > Z
265 > expecting success: echo foo
266 > foo
270 - > Z
267 > ok 2 - test with output
268 > Z
269 > not ok 3 - failing test
t/test-lib.sh
-2
@@ -477,8 +477,6 @@ test_at_end_hook_ () {
477 test_done () {
478 GIT_EXIT_OK=t
479
480 - # Note: t0000 relies on $HARNESS_ACTIVE disabling the .counts
481 - # output file
480 if test -z "$HARNESS_ACTIVE"
481 then
482 test_results_dir="$TEST_OUTPUT_DIRECTORY/test-results"