summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2013-12-28 04:29:15 -0500
committerJunio C Hamano <gitster@pobox.com>2014-01-02 14:40:03 -0800
commit68830470712b370d5ea231f76babd60a8859c105 (patch)
tree3858c13121f322741ead8f1b30fef4e75429bd3c
parent5512ac5840c8bcaa487806cf402ff960091ab244 (diff)
downloadgit-68830470712b370d5ea231f76babd60a8859c105.tar.gz
t0000: set TEST_OUTPUT_DIRECTORY for sub-tests
Running t0000 produces more trash directories than expected and does not clean up after itself: $ ./t0000-basic.sh [...] $ ls -d trash\ directory.* trash directory.failing-cleanup trash directory.mixed-results1 trash directory.mixed-results2 trash directory.partial-pass trash directory.test-verbose trash directory.test-verbose-only-2 These scratch areas for sub-tests should be under the t0000 trash directory, but because TEST_OUTPUT_DIRECTORY defaults to TEST_DIRECTORY, which is exported to help sub-tests find test-lib.sh, the sub-test trash directories are created under the toplevel t/ directory instead. Because some of the sub-tests simulate failures, their trash directories are kept around. Fix it by explicitly setting TEST_OUTPUT_DIRECTORY appropriately for sub-tests. An alternative fix would be to pass the --root parameter that only specifies where to put the trash directories, which would also work. However, using TEST_OUTPUT_DIRECTORY is more futureproof in case tests want to write more output in addition to the test-results/ (which are already suppressed in sub-tests using the HARNESS_ACTIVE setting) and trash directories. This fixes a regression introduced by 38b074d (t/test-lib.sh: fix TRASH_DIRECTORY handling, 2013-04-14). Before that commit, the TEST_OUTPUT_DIRECTORY setting was not respected consistently so most tests did their work in a "trash" subdirectory of the current directory instead of the output dir. Signed-off-by: Jeff King <peff@peff.net> Clarified-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t0000-basic.sh2
1 files changed, 2 insertions, 0 deletions
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 10be52beed..bc4e3e27b5 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -71,6 +71,8 @@ run_sub_test_lib_test () {
cat >>"$name.sh" &&
chmod +x "$name.sh" &&
export TEST_DIRECTORY &&
+ TEST_OUTPUT_DIRECTORY=$(pwd) &&
+ export TEST_OUTPUT_DIRECTORY &&
./"$name.sh" "$@" >out 2>err
)
}