tests: introduce --trash specifying root directory for trash folders
PATCH 1/1 tests: introduce --trash specifying root directory for trash folders
Normally, a directory named "trash directory.$TEST_NAME" is created for each test in the t directory (where the test resides). This option allows you to specify a different location to create the trash directories.
For example:
./some_test.sh --trash /tmp
will create a git repo and run the tests in some_test.sh under /tmp/trash directory.some_test/
Users may want to run tests on a tmpfs or maybe they have a disk they would like to run tests on that differs from the location of the source code. This option allows them to do so without having to do any mounting mumbo-jumbo.
---
I tried this out on a tmpfs and it didn't seem to give me too much speedup. Maybe something like 1%, but I couldn't test it with the 2GB test where it might be useful? I'm just throwing this out there as something people might like.
t/README | 6 ++++++ t/t3404-rebase-interactive.sh | 2 +- t/t3411-rebase-preserve-around-merges.sh | 2 +- t/t4014-format-patch.sh | 2 +- t/t4020-diff-external.sh | 2 +- t/test-lib.sh | 6 ++++-- 6 files changed, 14 insertions(+), 6 deletions(-)
t/README +6 -0
@@ -75,6 +75,12 @@ appropriately before running "make". As the names depend on the tests' file names, it is safe to run the tests with this option in parallel. +--trash:: + Normally a directory named "trash directory.$TEST_NAME" is + created for each test in the t directory (where the test + resides). This option allows you to specify a different + location to create the trash directories. + Skipping Tests --------------
t/t3404-rebase-interactive.sh +1 -1
@@ -10,7 +10,7 @@ that the result still makes sense. ' . ./test-lib.sh -. ../lib-rebase.sh +. $TEST_DIRECTORY/lib-rebase.sh set_fake_editor
t/t3411-rebase-preserve-around-merges.sh +1 -1
@@ -10,7 +10,7 @@ a merge to before the merge. ' . ./test-lib.sh -. ../lib-rebase.sh +. $TEST_DIRECTORY/lib-rebase.sh set_fake_editor
t/t4014-format-patch.sh +1 -1
@@ -493,7 +493,7 @@ test_expect_success 'format-patch from a subdirectory (2)' ' ' test_expect_success 'format-patch from a subdirectory (3)' ' - here="$TEST_DIRECTORY/$test" && + here="$PWD" && rm -f 0* && filename=$( rm -rf sub &&
t/t4020-diff-external.sh +1 -1
@@ -157,7 +157,7 @@ test_expect_success 'diff --cached' ' git update-index --assume-unchanged file && echo second >file && git diff --cached >actual && - test_cmp ../t4020/diff.NUL actual + test_cmp $TEST_DIRECTORY/t4020/diff.NUL actual ' test_done
t/test-lib.sh +4 -2
@@ -114,6 +114,8 @@ do valgrind=t; verbose=t; shift ;; --tee) shift ;; # was handled already + --tr|--tra|--tras|--trash) + shift; trash_dir=$1; shift;; *) break ;; esac
@@ -637,8 +639,8 @@ fi . ../GIT-BUILD-OPTIONS # Test repository -test="trash directory.$(basename "$0" .sh)" -test ! -z "$debug" || remove_trash="$TEST_DIRECTORY/$test" +test="${trash_dir:-$TEST_DIRECTORY}/trash directory.$(basename "$0" .sh)" +test ! -z "$debug" || remove_trash=$test rm -fr "$test" || { trap - EXIT echo >&5 "FATAL: Cannot prepare test area"
Signature · 1 line
1.6.3.1.30.g55524