{"thread":{"id":"19395","subject":"[PATCH] tests: introduce --trash specifying root directory for trash folders","startedAt":"2009-05-18T07:49:16Z","lastAt":"2009-05-18T07:49:16Z","messageCount":1,"participants":["Stephen Boyd"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"114159","messageId":"1242632956-7175-1-git-send-email-bebarino@gmail.com","threadId":"19395","inReplyTo":null,"subject":"[PATCH] tests: introduce --trash specifying root directory for trash folders","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-05-18T07:49:16Z","receivedAt":"2009-05-18T07:49:16Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Normally, a directory named \"trash directory.$TEST_NAME\" is created for\neach test in the t directory (where the test resides). This option\nallows you to specify a different location to create the trash\ndirectories.\n\nFor example:\n\n    ./some_test.sh --trash /tmp\n\nwill create a git repo and run the tests in some_test.sh under\n/tmp/trash directory.some_test/\n\nUsers may want to run tests on a tmpfs or maybe they have a disk they\nwould like to run tests on that differs from the location of the source\ncode. This option allows them to do so without having to do any mounting\nmumbo-jumbo.\n---\n\n I tried this out on a tmpfs and it didn't seem to give me too much speedup.\n Maybe something like 1%, but I couldn't test it with the 2GB test where it\n might be useful? I'm just throwing this out there as something people\n might like.\n\n\n t/README                                 |    6 ++++++\n t/t3404-rebase-interactive.sh            |    2 +-\n t/t3411-rebase-preserve-around-merges.sh |    2 +-\n t/t4014-format-patch.sh                  |    2 +-\n t/t4020-diff-external.sh                 |    2 +-\n t/test-lib.sh                            |    6 ++++--\n 6 files changed, 14 insertions(+), 6 deletions(-)\n\ndiff --git a/t/README b/t/README\nindex d8f6c7d..47a8da3 100644\n--- a/t/README\n+++ b/t/README\n@@ -75,6 +75,12 @@ appropriately before running \"make\".\n \tAs the names depend on the tests' file names, it is safe to\n \trun the tests with this option in parallel.\n \n+--trash::\n+\tNormally a directory named \"trash directory.$TEST_NAME\" is\n+\tcreated for each test in the t directory (where the test\n+\tresides). This option allows you to specify a different\n+\tlocation to create the trash directories.\n+\n Skipping Tests\n --------------\n \ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex c32ff66..da337c3 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -10,7 +10,7 @@ that the result still makes sense.\n '\n . ./test-lib.sh\n \n-. ../lib-rebase.sh\n+. $TEST_DIRECTORY/lib-rebase.sh\n \n set_fake_editor\n \ndiff --git a/t/t3411-rebase-preserve-around-merges.sh b/t/t3411-rebase-preserve-around-merges.sh\nindex 6533505..2b82c33 100755\n--- a/t/t3411-rebase-preserve-around-merges.sh\n+++ b/t/t3411-rebase-preserve-around-merges.sh\n@@ -10,7 +10,7 @@ a merge to before the merge.\n '\n . ./test-lib.sh\n \n-. ../lib-rebase.sh\n+. $TEST_DIRECTORY/lib-rebase.sh\n \n set_fake_editor\n \ndiff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\nindex 922a894..0fd7be7 100755\n--- a/t/t4014-format-patch.sh\n+++ b/t/t4014-format-patch.sh\n@@ -493,7 +493,7 @@ test_expect_success 'format-patch from a subdirectory (2)' '\n '\n \n test_expect_success 'format-patch from a subdirectory (3)' '\n-\there=\"$TEST_DIRECTORY/$test\" &&\n+\there=\"$PWD\" &&\n \trm -f 0* &&\n \tfilename=$(\n \t\trm -rf sub &&\ndiff --git a/t/t4020-diff-external.sh b/t/t4020-diff-external.sh\nindex 0720001..3d27a95 100755\n--- a/t/t4020-diff-external.sh\n+++ b/t/t4020-diff-external.sh\n@@ -157,7 +157,7 @@ test_expect_success 'diff --cached' '\n \tgit update-index --assume-unchanged file &&\n \techo second >file &&\n \tgit diff --cached >actual &&\n-\ttest_cmp ../t4020/diff.NUL actual\n+\ttest_cmp $TEST_DIRECTORY/t4020/diff.NUL actual\n '\n \n test_done\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex dad1437..022f826 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -114,6 +114,8 @@ do\n \t\tvalgrind=t; verbose=t; shift ;;\n \t--tee)\n \t\tshift ;; # was handled already\n+\t--tr|--tra|--tras|--trash)\n+\t\tshift; trash_dir=$1; shift;;\n \t*)\n \t\tbreak ;;\n \tesac\n@@ -637,8 +639,8 @@ fi\n . ../GIT-BUILD-OPTIONS\n \n # Test repository\n-test=\"trash directory.$(basename \"$0\" .sh)\"\n-test ! -z \"$debug\" || remove_trash=\"$TEST_DIRECTORY/$test\"\n+test=\"${trash_dir:-$TEST_DIRECTORY}/trash directory.$(basename \"$0\" .sh)\"\n+test ! -z \"$debug\" || remove_trash=$test\n rm -fr \"$test\" || {\n \ttrap - EXIT\n \techo >&5 \"FATAL: Cannot prepare test area\"\n-- \n1.6.3.1.30.g55524\n"}]}