{"thread":{"id":"20494","subject":"[PATCH 0/3] moving test trash directories","startedAt":"2009-08-09T08:35:19Z","lastAt":"2009-08-09T17:42:27Z","messageCount":7,"participants":["Jeff King","Johannes Sixt","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"120037","messageId":"20090809083518.GA8147@coredump.intra.peff.net","threadId":"20494","inReplyTo":null,"subject":"[PATCH 0/3] moving test trash directories","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-08-09T08:35:19Z","receivedAt":"2009-08-09T08:35:19Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This series adds support for making trash directories for the test\nscripts outside of the usual hierarchy. The main benefit is improved\nperformance. By putting the trash directories onto a tmpfs (rather than\nSATA disks), my \"make -j32 test\" time went from around 1m51s to around\n1m01s. I can only imagine what improvement it would have for people on\nNFS.  :)\n\nIt also has the nice side effect that running the test suite doesn't\nthrash your disk as much, in case you wanted to do something else while\nit was running.\n\n  [1/3] tests: use \"$TEST_DIRECTORY\" instead of \"..\"\n  [2/3] tests: provide $TRASH_DIRECTORY variable\n  [3/3] tests: allow user to specify trash directory location\n\n-Peff\n"},{"id":"120038","messageId":"20090809083752.GA8250@coredump.intra.peff.net","threadId":"20494","inReplyTo":"20090809083518.GA8147@coredump.intra.peff.net","subject":"[PATCH 1/3] tests: use \"$TEST_DIRECTORY\" instead of \"..\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-08-09T08:37:52Z","receivedAt":"2009-08-09T08:37:52Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The $TEST_DIRECTORY variable allows tests to find the\ntop-level test directory regardless of the current working\ndirectory.\n\nIn the past, this has been used to accomodate tests which\nchange directories, but it is also the first step to being\nable to move trash directories outside of the\n$TEST_DIRECTORY hierarchy.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n t/t3404-rebase-interactive.sh            |    2 +-\n t/t3411-rebase-preserve-around-merges.sh |    2 +-\n t/t3414-rebase-preserve-onto.sh          |    2 +-\n t/t4020-diff-external.sh                 |    2 +-\n 4 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex a973628..4cae019 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..14a23cd 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/t3414-rebase-preserve-onto.sh b/t/t3414-rebase-preserve-onto.sh\nindex 80019ee..ee0a6cc 100755\n--- a/t/t3414-rebase-preserve-onto.sh\n+++ b/t/t3414-rebase-preserve-onto.sh\n@@ -10,7 +10,7 @@ aren'\"'\"'t on top of $ONTO, even if they are on top of $UPSTREAM.\n '\n . ./test-lib.sh\n \n-. ../lib-rebase.sh\n+. \"$TEST_DIRECTORY\"/lib-rebase.sh\n \n # Set up branches like this:\n # A1---B1---E1---F1---G1\ndiff --git a/t/t4020-diff-external.sh b/t/t4020-diff-external.sh\nindex 4ea42e0..a7602cf 100755\n--- a/t/t4020-diff-external.sh\n+++ b/t/t4020-diff-external.sh\n@@ -166,7 +166,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\n-- \n1.6.4.178.g7a987\n"},{"id":"120039","messageId":"20090809083810.GB8250@coredump.intra.peff.net","threadId":"20494","inReplyTo":"20090809083518.GA8147@coredump.intra.peff.net","subject":"[PATCH 2/3] tests: provide $TRASH_DIRECTORY variable","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-08-09T08:38:11Z","receivedAt":"2009-08-09T08:38:11Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Most scripts don't care about the absolute path to the trash\ndirectory. The one exception was t4014 script, which pieced\ntogether $TEST_DIRECTORY and $test itself to get an absolute\ndirectory.\n\nInstead, let's provide a $TRASH_DIRECTORY which specifies\nthe same thing. This keeps the $test variable internal to\ntest-lib.sh and paves the way for trash directories in other\nlocations.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n t/t4014-format-patch.sh |    3 +--\n t/test-lib.sh           |    3 ++-\n 2 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\nindex 922a894..531f5b7 100755\n--- a/t/t4014-format-patch.sh\n+++ b/t/t4014-format-patch.sh\n@@ -493,13 +493,12 @@ 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 \trm -f 0* &&\n \tfilename=$(\n \t\trm -rf sub &&\n \t\tmkdir -p sub/dir &&\n \t\tcd sub/dir &&\n-\t\tgit format-patch -1 -o \"$here\"\n+\t\tgit format-patch -1 -o \"$TRASH_DIRECTORY\"\n \t) &&\n \tbasename=$(expr \"$filename\" : \".*/\\(.*\\)\") &&\n \ttest -f \"$basename\"\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 5fdc5d9..e6a7bb1 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -645,7 +645,8 @@ fi\n \n # Test repository\n test=\"trash directory.$(basename \"$0\" .sh)\"\n-test ! -z \"$debug\" || remove_trash=\"$TEST_DIRECTORY/$test\"\n+TRASH_DIRECTORY=\"$TEST_DIRECTORY/$test\"\n+test ! -z \"$debug\" || remove_trash=$TRASH_DIRECTORY\n rm -fr \"$test\" || {\n \tGIT_EXIT_OK=t\n \techo >&5 \"FATAL: Cannot prepare test area\"\n-- \n1.6.4.178.g7a987\n"},{"id":"120040","messageId":"20090809083945.GC8250@coredump.intra.peff.net","threadId":"20494","inReplyTo":"20090809083518.GA8147@coredump.intra.peff.net","subject":"[PATCH 3/3] tests: allow user to specify trash directory location","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-08-09T08:39:45Z","receivedAt":"2009-08-09T08:39:45Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The tests generate a large amount of I/O activity creating\nand destroying repositories and files. We can improve the\ntime it takes to run the test suite by creating trash\ndirectories on filesystems with better performance\ncharacteristic, even though we may not want the rest of the\ngit repository on those filesystems (e.g., because they are\nnot network connected, or because they are temporary\nramdisks).\n\nFor example, on a dual processor system:\n\n  $ cd t && time make -j32\n  real    1m51.562s\n  user    0m59.260s\n  sys     1m20.933s\n\n  # /dev/shm is tmpfs\n  $ cd t && time make -j32 GIT_TEST_OPTS=\"--root=/dev/shm\"\n  real    1m1.484s\n  user    0m53.555s\n  sys     1m5.264s\n\nWe almost halve the wall clock time, and we utilize the\ndual processors much better.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nThere is a test below for absolute versus relative path in the root\nprovided.  Do we need some extra magic to make it work on non-Unix\nplatforms?\n\n t/test-lib.sh |    9 ++++++++-\n 1 files changed, 8 insertions(+), 1 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex e6a7bb1..a5b8d03 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -114,6 +114,9 @@ do\n \t\tvalgrind=t; verbose=t; shift ;;\n \t--tee)\n \t\tshift ;; # was handled already\n+\t--root=*)\n+\t\troot=$(expr \"z$1\" : 'z[^=]*=\\(.*\\)')\n+\t\tshift ;;\n \t*)\n \t\techo \"error: unknown test option '$1'\" >&2; exit 1 ;;\n \tesac\n@@ -645,7 +648,11 @@ fi\n \n # Test repository\n test=\"trash directory.$(basename \"$0\" .sh)\"\n-TRASH_DIRECTORY=\"$TEST_DIRECTORY/$test\"\n+test -n \"$root\" && test=\"$root/$test\"\n+case \"$test\" in\n+/*) TRASH_DIRECTORY=\"$test\" ;;\n+ *) TRASH_DIRECTORY=\"$TEST_DIRECTORY/$test\" ;;\n+esac\n test ! -z \"$debug\" || remove_trash=$TRASH_DIRECTORY\n rm -fr \"$test\" || {\n \tGIT_EXIT_OK=t\n-- \n1.6.4.178.g7a987\n"},{"id":"120041","messageId":"20090809085037.GA31406@coredump.intra.peff.net","threadId":"20494","inReplyTo":"20090809083518.GA8147@coredump.intra.peff.net","subject":"[PATCH 4/3] t/Makefile: include config.mak","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-08-09T08:50:37Z","receivedAt":"2009-08-09T08:50:37Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This is useful if you want to specify GIT_TEST_OPTS that you\nalways use.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nOn Sun, Aug 09, 2009 at 04:35:19AM -0400, Jeff King wrote:\n\n>   [1/3] tests: use \"$TEST_DIRECTORY\" instead of \"..\"\n>   [2/3] tests: provide $TRASH_DIRECTORY variable\n>   [3/3] tests: allow user to specify trash directory location\n\nI think a 4/3 like this is nice to let you use --root without extra\ntyping each time.  And when you do \"cd t && make t$WHATEVER.sh\nGIT_TEST_OPTS='-v -i'\", it will automatically be overridden, which is\nprobably what you want, so you can inspect the failed tests in t/trash*.\n\n t/Makefile |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/t/Makefile b/t/Makefile\nindex bf816fc..bd09390 100644\n--- a/t/Makefile\n+++ b/t/Makefile\n@@ -3,6 +3,8 @@\n # Copyright (c) 2005 Junio C Hamano\n #\n \n+-include ../config.mak\n+\n #GIT_TEST_OPTS=--verbose --debug\n SHELL_PATH ?= $(SHELL)\n TAR ?= $(TAR)\n-- \n1.6.4.178.g7a987\n"},{"id":"120051","messageId":"200908091533.40227.j6t@kdbg.org","threadId":"20494","inReplyTo":"20090809083945.GC8250@coredump.intra.peff.net","subject":"Re: [PATCH 3/3] tests: allow user to specify trash directory location","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2009-08-09T13:33:40Z","receivedAt":"2009-08-09T13:33:40Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Sonntag, 9. August 2009, Jeff King wrote:\n> There is a test below for absolute versus relative path in the root\n> provided.  Do we need some extra magic to make it work on non-Unix\n> platforms?\n\nNot for Windows. Those devolpers who want to use an absolute path can use the \nPOSIX path notation:\n\n   GIT_TEST_OPTS=--root=/c/temp/gittests\n\nThis works in t4014.\n\n-- Hannes\n"},{"id":"120062","messageId":"alpine.DEB.1.00.0908091941550.8306@pacific.mpi-cbg.de","threadId":"20494","inReplyTo":"200908091533.40227.j6t@kdbg.org","subject":"Re: [PATCH 3/3] tests: allow user to specify trash directory location","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-08-09T17:42:27Z","receivedAt":"2009-08-09T17:42:27Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 9 Aug 2009, Johannes Sixt wrote:\n\n> On Sonntag, 9. August 2009, Jeff King wrote:\n> > There is a test below for absolute versus relative path in the root\n> > provided.  Do we need some extra magic to make it work on non-Unix\n> > platforms?\n> \n> Not for Windows. Those devolpers who want to use an absolute path can use the \n> POSIX path notation:\n> \n>    GIT_TEST_OPTS=--root=/c/temp/gittests\n> \n> This works in t4014.\n\nBut I am not aware of any reasonable tmpfs equivalent on Windows.  Are \nyou?  I would be _very_ interested.\n\nCiao,\nDscho\n"}]}