{"thread":{"id":"24767","subject":"[PATCH] t/t0000-basic.sh: Don't run a passing TODO unless TEST_PASSING_TODO=1","startedAt":"2010-08-17T09:43:54Z","lastAt":"2010-08-19T17:39:54Z","messageCount":20,"participants":["Ævar Arnfjörð Bjarmason","Sverre Rabbelier","Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"148270","messageId":"1282038234-1880-1-git-send-email-avarab@gmail.com","threadId":"24767","inReplyTo":null,"subject":"[PATCH] t/t0000-basic.sh: Don't run a passing TODO unless TEST_PASSING_TODO=1","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-17T09:43:54Z","receivedAt":"2010-08-17T09:43:54Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the sanity tests in t/t0000-basic.sh to not to run a passing\nTODO test unless the TEST_PASSING_TODO environment variable is set.\n\nThe motivation is to have nothing out of the ordinary on a normal test\nrun for test smoking purposes.\n\nIf every normal test run has a passing TODO you're more likely to turn\na blind eye to it and not to investigate cases where things really are\npassing unexpectedly.\n\nIt also makes the prove(1) output less noisy. Before:\n\n    All tests successful.\n\n    Test Summary Report\n    -------------------\n    ./t0000-basic.sh                                   (Wstat: 0 Tests: 46 Failed: 0)\n      TODO passed:   5\n    Files=484, Tests=6229, 143 wallclock secs ( 4.00 usr  4.15 sys + 104.77 cusr 351.57 csys = 464.49 CPU)\n    Result: PASS\n\nAnd after:\n\n    All tests successful.\n    Files=484, Tests=6228, 139 wallclock secs ( 4.07 usr  4.25 sys + 104.54 cusr 350.85 csys = 463.71 CPU)\n    Result: PASS\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t0000-basic.sh |   11 ++++++++---\n 1 files changed, 8 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t0000-basic.sh b/t/t0000-basic.sh\nindex f2c7336..2f6a17b 100755\n--- a/t/t0000-basic.sh\n+++ b/t/t0000-basic.sh\n@@ -54,9 +54,14 @@ test_expect_success 'success is reported like this' '\n test_expect_failure 'pretend we have a known breakage' '\n     false\n '\n-test_expect_failure 'pretend we have fixed a known breakage' '\n-    :\n-'\n+if test -z \"$TEST_PASSING_TODO\"\n+then\n+\tsay \"Not testing a known breakage, set TEST_PASSING_TODO=1 to enable\"\n+else\n+\ttest_expect_failure 'pretend we have fixed a known breakage' '\n+\t    :\n+\t'\n+fi\n test_set_prereq HAVEIT\n haveit=no\n test_expect_success HAVEIT 'test runs if prerequisite is satisfied' '\n-- \n1.7.2.1.389.gc3d0b\n"},{"id":"148298","messageId":"AANLkTimx_kOr6UptsVOCdMHjxQqcde4oaDgrN2amnuYe@mail.gmail.com","threadId":"24767","inReplyTo":"1282038234-1880-1-git-send-email-avarab@gmail.com","subject":"Re: [PATCH] t/t0000-basic.sh: Don't run a passing TODO unless TEST_PASSING_TODO=1","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-08-17T17:57:01Z","receivedAt":"2010-08-17T17:57:01Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Tue, Aug 17, 2010 at 04:43, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n> Change the sanity tests in t/t0000-basic.sh to not to run a passing\n> TODO test unless the TEST_PASSING_TODO environment variable is set.\n>\n> The motivation is to have nothing out of the ordinary on a normal test\n> run for test smoking purposes.\n>\n> If every normal test run has a passing TODO you're more likely to turn\n> a blind eye to it and not to investigate cases where things really are\n> passing unexpectedly.\n\nThanks, this has bothered me ever since I first ran the test suite.\nWhile I understand that the test suite needs testing to, it should be\ndone in such a way that it doesn't produce false positives. That is,\nmy preference would be to still keep the test in the suite as-is, but\nsomehow get it to show up as a passing test instead of a fixed one.\nE.g., something like:\n\ntest_in_new_harness 0 1 0 0 '\n    test_expect_failure 'pretend we have fixed a known breakage' '\n           :\n     '\n'\n\nWhere there '0 1 0 0' stands for '0 failures, 1 fixed, 0 broken, 0\nsuccess'. Not sure there's any other use for a test_in_new_harness\nfunction though...\n\nPS: To clarify, test_in_new_harness would not change any of the\ncounters (test_failure, test_count, test_fixed, test_broken,\ntest_success), but would instead compare those against the values\nspecified as argument to test_in_new_harness.\n\nPSPS: I have no idea how easy it would be to implement something like this.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"148302","messageId":"7vpqxhaw92.fsf@alter.siamese.dyndns.org","threadId":"24767","inReplyTo":"AANLkTimx_kOr6UptsVOCdMHjxQqcde4oaDgrN2amnuYe@mail.gmail.com","subject":"Re: [PATCH] t/t0000-basic.sh: Don't run a passing TODO unless TEST_PASSING_TODO=1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-17T19:12:57Z","receivedAt":"2010-08-17T19:12:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sverre Rabbelier <srabbelier@gmail.com> writes:\n\n> E.g., something like:\n>\n> test_in_new_harness 0 1 0 0 '\n>     test_expect_failure 'pretend we have fixed a known breakage' '\n>            :\n>      '\n> '\n\nNow the question becomes who tests \"test_in_new_harness\" ;-)\n\nI'd rather prefer not to touch this one.  Isn't whatever the outer wrapper\nused flexible enough to be taught about this kind of thing and filter it?\n"},{"id":"148370","messageId":"1282138473-15613-1-git-send-email-avarab@gmail.com","threadId":"24767","inReplyTo":"7vpqxhaw92.fsf@alter.siamese.dyndns.org","subject":"[PATCH v2 0/4] Support for running tests outside t/ + don't run a TODO test","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-18T13:34:29Z","receivedAt":"2010-08-18T13:34:29Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Tue, Aug 17, 2010 at 19:12, Junio C Hamano <gitster@pobox.com> wrote:\n> Sverre Rabbelier <srabbelier@gmail.com> writes:\n>\n>> E.g., something like:\n>>\n>> test_in_new_harness 0 1 0 0 '\n>>     test_expect_failure 'pretend we have fixed a known breakage' '\n>>            :\n>>      '\n>> '\n>\n> Now the question becomes who tests \"test_in_new_harness\" ;-)\n>\n> I'd rather prefer not to touch this one.  Isn't whatever the outer wrapper\n> used flexible enough to be taught about this kind of thing and filter it?\n\nThe problem is that you have to modify *all* the outer wrappers. Since\nthe test suite can be run with any TAP consumer that isn't viable, and\nat the very least having to do:\n\n    prove --source=Some::Custom::Git Thing ...\n\nIs tedious, and requires us to maintain the Some::Custom::Git thingy.\n\nAnyway, here's a better patch. It allows us to run a pasing TODO test,\ncheck if it works, and if so not mark *that* test as passing TODO, but\nsimply as passing.\n\nAs a side benefit it makes the test lib more awesome.\n\nÆvar Arnfjörð Bjarmason (4):\n  test-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and\n    ../\n  test-lib: Use \"$GIT_BUILD_DIR\" instead of \"$TEST_DIRECTORY\"/../\n  test-lib: Allow overriding of TEST_DIRECTORY\n  t/t0000-basic.sh: Run the passing TODO test inside its own test-lib\n\n t/t0000-basic.sh |   31 +++++++++++++++++++++++++++++++\n t/test-lib.sh    |   39 +++++++++++++++++++++++----------------\n 2 files changed, 54 insertions(+), 16 deletions(-)\n\n-- \n1.7.2.1.414.g9bf49\n"},{"id":"148371","messageId":"1282138473-15613-2-git-send-email-avarab@gmail.com","threadId":"24767","inReplyTo":"7vpqxhaw92.fsf@alter.siamese.dyndns.org","subject":"[PATCH v2 1/4] test-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and ../","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-18T13:34:30Z","receivedAt":"2010-08-18T13:34:30Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the redundant calls to $(pwd) to use $TEST_DIRECTORY\ninstead. None of these were being executed after we cd'd somewhere\nelse so they weren't actually needed.\n\nThis also makes it easier to add support for overriding the test\nlibrary location and run tests in a different directory than t/.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib.sh |   16 ++++++++--------\n 1 files changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 5bb7662..0e460f9 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -830,14 +830,14 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:\n \t\tPATH=\"$TEST_DIRECTORY/..:$PATH\"\n \tfi\n fi\n-GIT_BUILD_DIR=$(pwd)/..\n-GIT_TEMPLATE_DIR=$(pwd)/../templates/blt\n+GIT_BUILD_DIR=\"$TEST_DIRECTORY\"/..\n+GIT_TEMPLATE_DIR=\"$TEST_DIRECTORY\"/../templates/blt\n unset GIT_CONFIG\n GIT_CONFIG_NOSYSTEM=1\n GIT_CONFIG_NOGLOBAL=1\n export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_CONFIG_NOGLOBAL\n \n-. ../GIT-BUILD-OPTIONS\n+. \"$GIT_BUILD_DIR\"/GIT-BUILD-OPTIONS\n \n if test -z \"$GIT_TEST_CMP\"\n then\n@@ -849,22 +849,22 @@ then\n \tfi\n fi\n \n-GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git\n+GITPERLLIB=\"$TEST_DIRECTORY\"/../perl/blib/lib:\"$TEST_DIRECTORY\"/../perl/blib/arch/auto/Git\n export GITPERLLIB\n-test -d ../templates/blt || {\n+test -d \"$TEST_DIRECTORY\"/../templates/blt || {\n \terror \"You haven't built things yet, have you?\"\n }\n \n if test -z \"$GIT_TEST_INSTALLED\" && test -z \"$NO_PYTHON\"\n then\n-\tGITPYTHONLIB=\"$(pwd)/../git_remote_helpers/build/lib\"\n+\tGITPYTHONLIB=\"$TEST_DIRECTORY/../git_remote_helpers/build/lib\"\n \texport GITPYTHONLIB\n-\ttest -d ../git_remote_helpers/build || {\n+\ttest -d \"$TEST_DIRECTORY\"/../git_remote_helpers/build || {\n \t\terror \"You haven't built git_remote_helpers yet, have you?\"\n \t}\n fi\n \n-if ! test -x ../test-chmtime; then\n+if ! test -x \"$TEST_DIRECTORY\"/../test-chmtime; then\n \techo >&2 'You need to build test-chmtime:'\n \techo >&2 'Run \"make test-chmtime\" in the source (toplevel) directory'\n \texit 1\n-- \n1.7.2.1.414.g9bf49\n"},{"id":"148372","messageId":"1282138473-15613-3-git-send-email-avarab@gmail.com","threadId":"24767","inReplyTo":"7vpqxhaw92.fsf@alter.siamese.dyndns.org","subject":"[PATCH v2 2/4] test-lib: Use \"$GIT_BUILD_DIR\" instead of \"$TEST_DIRECTORY\"/../","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-18T13:34:31Z","receivedAt":"2010-08-18T13:34:31Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change code that used $TEST_DIRECTORY/.. to use $GIT_BUILD_DIR\ninstead, the two are equivalent, but the latter is easier to read.\n\nThis required moving the assignment od GIT_BUILD_DIR to earlier in the\ntest-lib.sh file.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n\nNote that the usage of GIT_BUILD_DIR in the first hunk isn't an error,\nsince it's inside a function GIT_BUILD_DIR will be defined by the time\nit's used.\n\n t/test-lib.sh |   29 +++++++++++++++--------------\n 1 files changed, 15 insertions(+), 14 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 0e460f9..689aa29 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -685,7 +685,7 @@ test_create_repo () {\n \trepo=\"$1\"\n \tmkdir -p \"$repo\"\n \tcd \"$repo\" || error \"Cannot setup test environment\"\n-\t\"$GIT_EXEC_PATH/git-init\" \"--template=$TEST_DIRECTORY/../templates/blt/\" >&3 2>&4 ||\n+\t\"$GIT_EXEC_PATH/git-init\" \"--template=$GIT_BUILD_DIR/templates/blt/\" >&3 2>&4 ||\n \terror \"cannot run git init -- have you built things yet?\"\n \tmv .git/hooks .git/hooks-disabled\n \tcd \"$owd\"\n@@ -748,6 +748,8 @@ test_done () {\n # Test the binaries we have just built.  The tests are kept in\n # t/ subdirectory and are run in 'trash directory' subdirectory.\n TEST_DIRECTORY=$(pwd)\n+GIT_BUILD_DIR=\"$TEST_DIRECTORY\"/..\n+\n if test -n \"$valgrind\"\n then\n \tmake_symlink () {\n@@ -774,7 +776,7 @@ then\n \t\ttest -x \"$1\" || return\n \n \t\tbase=$(basename \"$1\")\n-\t\tsymlink_target=$TEST_DIRECTORY/../$base\n+\t\tsymlink_target=$GIT_BUILD_DIR/$base\n \t\t# do not override scripts\n \t\tif test -x \"$symlink_target\" &&\n \t\t    test ! -d \"$symlink_target\" &&\n@@ -793,7 +795,7 @@ then\n \t# override all git executables in TEST_DIRECTORY/..\n \tGIT_VALGRIND=$TEST_DIRECTORY/valgrind\n \tmkdir -p \"$GIT_VALGRIND\"/bin\n-\tfor file in $TEST_DIRECTORY/../git* $TEST_DIRECTORY/../test-*\n+\tfor file in $GIT_BUILD_DIR/git* $GIT_BUILD_DIR/test-*\n \tdo\n \t\tmake_valgrind_symlink $file\n \tdone\n@@ -814,10 +816,10 @@ then\n elif test -n \"$GIT_TEST_INSTALLED\" ; then\n \tGIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path)  ||\n \terror \"Cannot run git from $GIT_TEST_INSTALLED.\"\n-\tPATH=$GIT_TEST_INSTALLED:$TEST_DIRECTORY/..:$PATH\n+\tPATH=$GIT_TEST_INSTALLED:$GIT_BUILD_DIR:$PATH\n \tGIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}\n else # normal case, use ../bin-wrappers only unless $with_dashes:\n-\tgit_bin_dir=\"$TEST_DIRECTORY/../bin-wrappers\"\n+\tgit_bin_dir=\"$GIT_BUILD_DIR/bin-wrappers\"\n \tif ! test -x \"$git_bin_dir/git\" ; then\n \t\tif test -z \"$with_dashes\" ; then\n \t\t\tsay \"$git_bin_dir/git is not executable; using GIT_EXEC_PATH\"\n@@ -825,13 +827,12 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:\n \t\twith_dashes=t\n \tfi\n \tPATH=\"$git_bin_dir:$PATH\"\n-\tGIT_EXEC_PATH=$TEST_DIRECTORY/..\n+\tGIT_EXEC_PATH=$GIT_BUILD_DIR\n \tif test -n \"$with_dashes\" ; then\n-\t\tPATH=\"$TEST_DIRECTORY/..:$PATH\"\n+\t\tPATH=\"$GIT_BUILD_DIR:$PATH\"\n \tfi\n fi\n-GIT_BUILD_DIR=\"$TEST_DIRECTORY\"/..\n-GIT_TEMPLATE_DIR=\"$TEST_DIRECTORY\"/../templates/blt\n+GIT_TEMPLATE_DIR=\"$GIT_BUILD_DIR\"/templates/blt\n unset GIT_CONFIG\n GIT_CONFIG_NOSYSTEM=1\n GIT_CONFIG_NOGLOBAL=1\n@@ -849,22 +850,22 @@ then\n \tfi\n fi\n \n-GITPERLLIB=\"$TEST_DIRECTORY\"/../perl/blib/lib:\"$TEST_DIRECTORY\"/../perl/blib/arch/auto/Git\n+GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/blib/lib:\"$GIT_BUILD_DIR\"/perl/blib/arch/auto/Git\n export GITPERLLIB\n-test -d \"$TEST_DIRECTORY\"/../templates/blt || {\n+test -d \"$GIT_BUILD_DIR\"/templates/blt || {\n \terror \"You haven't built things yet, have you?\"\n }\n \n if test -z \"$GIT_TEST_INSTALLED\" && test -z \"$NO_PYTHON\"\n then\n-\tGITPYTHONLIB=\"$TEST_DIRECTORY/../git_remote_helpers/build/lib\"\n+\tGITPYTHONLIB=\"$GIT_BUILD_DIR/git_remote_helpers/build/lib\"\n \texport GITPYTHONLIB\n-\ttest -d \"$TEST_DIRECTORY\"/../git_remote_helpers/build || {\n+\ttest -d \"$GIT_BUILD_DIR\"/git_remote_helpers/build || {\n \t\terror \"You haven't built git_remote_helpers yet, have you?\"\n \t}\n fi\n \n-if ! test -x \"$TEST_DIRECTORY\"/../test-chmtime; then\n+if ! test -x \"$GIT_BUILD_DIR\"/test-chmtime; then\n \techo >&2 'You need to build test-chmtime:'\n \techo >&2 'Run \"make test-chmtime\" in the source (toplevel) directory'\n \texit 1\n-- \n1.7.2.1.414.g9bf49\n"},{"id":"148373","messageId":"1282138473-15613-4-git-send-email-avarab@gmail.com","threadId":"24767","inReplyTo":"7vpqxhaw92.fsf@alter.siamese.dyndns.org","subject":"[PATCH v2 3/4] test-lib: Allow overriding of TEST_DIRECTORY","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-18T13:34:32Z","receivedAt":"2010-08-18T13:34:32Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Tests that test the test-lib.sh itself need to be executed in the\ndynamically created trash directory, so we can't assume\n$TEST_DIRECTORY is ../ for those.\n\nAs a side benefit this change also makes it easy for us to move the\nt/*.sh tests into subdirectories if we ever want to do that.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib.sh |    8 +++++++-\n 1 files changed, 7 insertions(+), 1 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 689aa29..01ddf3e 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -747,7 +747,13 @@ test_done () {\n \n # Test the binaries we have just built.  The tests are kept in\n # t/ subdirectory and are run in 'trash directory' subdirectory.\n-TEST_DIRECTORY=$(pwd)\n+if test -z \"$TEST_DIRECTORY\"\n+then\n+\t# We allow tests to override this, in case they want to run tests\n+\t# outside of t/, e.g. for running tests on the test library\n+\t# itself.\n+\tTEST_DIRECTORY=$(pwd)\n+fi\n GIT_BUILD_DIR=\"$TEST_DIRECTORY\"/..\n \n if test -n \"$valgrind\"\n-- \n1.7.2.1.414.g9bf49\n"},{"id":"148374","messageId":"1282138473-15613-5-git-send-email-avarab@gmail.com","threadId":"24767","inReplyTo":"7vpqxhaw92.fsf@alter.siamese.dyndns.org","subject":"[PATCH v2 4/4] t/t0000-basic.sh: Run the passing TODO test inside its own test-lib","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-18T13:34:33Z","receivedAt":"2010-08-18T13:34:33Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the passing TODO test in t0000-basic.sh to run inside its own\ntest-lib.sh. The motivation is to have nothing out of the ordinary on\na normal test run for test smoking purposes.\n\nIf every normal test run has a passing TODO you're more likely to turn\na blind eye to it and not to investigate cases where things really are\npassing unexpectedly.\n\nIt also makes the prove(1) output less noisy. Before:\n\n    All tests successful.\n\n    Test Summary Report\n    -------------------\n    ./t0000-basic.sh                                   (Wstat: 0 Tests: 46 Failed: 0)\n      TODO passed:   5\n    Files=484, Tests=6229, 143 wallclock secs ( 4.00 usr  4.15 sys + 104.77 cusr 351.57 csys = 464.49 CPU)\n    Result: PASS\n\nAnd after:\n\n    All tests successful.\n    Files=484, Tests=6228, 139 wallclock secs ( 4.07 usr  4.25 sys + 104.54 cusr 350.85 csys = 463.71 CPU)\n    Result: PASS\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t0000-basic.sh |   31 +++++++++++++++++++++++++++++++\n 1 files changed, 31 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t0000-basic.sh b/t/t0000-basic.sh\nindex 9602085..1a977db 100755\n--- a/t/t0000-basic.sh\n+++ b/t/t0000-basic.sh\n@@ -54,9 +54,40 @@ test_expect_success 'success is reported like this' '\n test_expect_failure 'pretend we have a known breakage' '\n     false\n '\n+\n+test_expect_success 'pretend we have fixed a known breakage (run in sub test-lib)' \"\n+    mkdir passing-todo &&\n+    (cd passing-todo &&\n+    cat >passing-todo.sh <<EOF &&\n+#!/bin/sh\n+\n+test_description='A passing TODO test\n+\n+This is run in a sub test-lib so that we don't get incorrect passing\n+metrics\n+'\n+\n+# Point to the t/test-lib.sh, which isn't in ../ as usual\n+TEST_DIRECTORY=\\\"$TEST_DIRECTORY\\\"\n+. \\\"\\$TEST_DIRECTORY\\\"/test-lib.sh\n+\n test_expect_failure 'pretend we have fixed a known breakage' '\n     :\n '\n+\n+test_done\n+EOF\n+    chmod +x passing-todo.sh &&\n+    ./passing-todo.sh >out 2>err &&\n+    ! test -s err &&\n+cat >expect <<EOF &&\n+ok 1 - pretend we have fixed a known breakage # TODO known breakage\n+# fixed 1 known breakage(s)\n+# passed all 1 test(s)\n+1..1\n+EOF\n+    test_cmp expect out)\n+\"\n test_set_prereq HAVEIT\n haveit=no\n test_expect_success HAVEIT 'test runs if prerequisite is satisfied' '\n-- \n1.7.2.1.414.g9bf49\n"},{"id":"148462","messageId":"1282233961-27203-1-git-send-email-avarab@gmail.com","threadId":"24767","inReplyTo":"1282138473-15613-1-git-send-email-avarab@gmail.com","subject":"[PATCH v2 0/4] Support for running tests outside t/ + don't run a TODO test","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-19T16:05:57Z","receivedAt":"2010-08-19T16:05:57Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Tue, Aug 17, 2010 at 19:12, Junio C Hamano <gitster@pobox.com> wrote:\n> Sverre Rabbelier <srabbelier@gmail.com> writes:\n>\n>> E.g., something like:\n>>\n>> test_in_new_harness 0 1 0 0 '\n>>     test_expect_failure 'pretend we have fixed a known breakage' '\n>>            :\n>>      '\n>> '\n>\n> Now the question becomes who tests \"test_in_new_harness\" ;-)\n>\n> I'd rather prefer not to touch this one.  Isn't whatever the outer wrapper\n> used flexible enough to be taught about this kind of thing and filter it?\n\nThe problem is that you have to modify *all* the outer wrappers. Since\nthe test suite can be run with any TAP consumer that isn't viable, and\nat the very least having to do:\n\n    prove --source=Some::Custom::Git Thing ...\n\nIs tedious, and requires us to maintain the Some::Custom::Git thingy.\n\nAnyway, here's a better patch. It allows us to run a pasing TODO test,\ncheck if it works, and if so not mark *that* test as passing TODO, but\nsimply as passing.\n\nAs a side benefit it makes the test lib more awesome.\n\nÆvar Arnfjörð Bjarmason (4):\n  test-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and\n    ../\n  test-lib: Use \"$GIT_BUILD_DIR\" instead of \"$TEST_DIRECTORY\"/../\n  test-lib: Allow overriding of TEST_DIRECTORY\n  t/t0000-basic.sh: Run the passing TODO test inside its own test-lib\n\n t/t0000-basic.sh |   31 +++++++++++++++++++++++++++++++\n t/test-lib.sh    |   39 +++++++++++++++++++++++----------------\n 2 files changed, 54 insertions(+), 16 deletions(-)\n\n-- \n1.7.2.1.414.g9bf49\n"},{"id":"148459","messageId":"1282233961-27203-2-git-send-email-avarab@gmail.com","threadId":"24767","inReplyTo":"1282138473-15613-1-git-send-email-avarab@gmail.com","subject":"[PATCH v2 1/4] test-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and ../","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-19T16:05:58Z","receivedAt":"2010-08-19T16:05:58Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the redundant calls to $(pwd) to use $TEST_DIRECTORY\ninstead. None of these were being executed after we cd'd somewhere\nelse so they weren't actually needed.\n\nThis also makes it easier to add support for overriding the test\nlibrary location and run tests in a different directory than t/.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib.sh |   16 ++++++++--------\n 1 files changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 5bb7662..0e460f9 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -830,14 +830,14 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:\n \t\tPATH=\"$TEST_DIRECTORY/..:$PATH\"\n \tfi\n fi\n-GIT_BUILD_DIR=$(pwd)/..\n-GIT_TEMPLATE_DIR=$(pwd)/../templates/blt\n+GIT_BUILD_DIR=\"$TEST_DIRECTORY\"/..\n+GIT_TEMPLATE_DIR=\"$TEST_DIRECTORY\"/../templates/blt\n unset GIT_CONFIG\n GIT_CONFIG_NOSYSTEM=1\n GIT_CONFIG_NOGLOBAL=1\n export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_CONFIG_NOGLOBAL\n \n-. ../GIT-BUILD-OPTIONS\n+. \"$GIT_BUILD_DIR\"/GIT-BUILD-OPTIONS\n \n if test -z \"$GIT_TEST_CMP\"\n then\n@@ -849,22 +849,22 @@ then\n \tfi\n fi\n \n-GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git\n+GITPERLLIB=\"$TEST_DIRECTORY\"/../perl/blib/lib:\"$TEST_DIRECTORY\"/../perl/blib/arch/auto/Git\n export GITPERLLIB\n-test -d ../templates/blt || {\n+test -d \"$TEST_DIRECTORY\"/../templates/blt || {\n \terror \"You haven't built things yet, have you?\"\n }\n \n if test -z \"$GIT_TEST_INSTALLED\" && test -z \"$NO_PYTHON\"\n then\n-\tGITPYTHONLIB=\"$(pwd)/../git_remote_helpers/build/lib\"\n+\tGITPYTHONLIB=\"$TEST_DIRECTORY/../git_remote_helpers/build/lib\"\n \texport GITPYTHONLIB\n-\ttest -d ../git_remote_helpers/build || {\n+\ttest -d \"$TEST_DIRECTORY\"/../git_remote_helpers/build || {\n \t\terror \"You haven't built git_remote_helpers yet, have you?\"\n \t}\n fi\n \n-if ! test -x ../test-chmtime; then\n+if ! test -x \"$TEST_DIRECTORY\"/../test-chmtime; then\n \techo >&2 'You need to build test-chmtime:'\n \techo >&2 'Run \"make test-chmtime\" in the source (toplevel) directory'\n \texit 1\n-- \n1.7.2.1.414.g9bf49\n"},{"id":"148460","messageId":"1282233961-27203-3-git-send-email-avarab@gmail.com","threadId":"24767","inReplyTo":"1282138473-15613-1-git-send-email-avarab@gmail.com","subject":"[PATCH v2 2/4] test-lib: Use \"$GIT_BUILD_DIR\" instead of \"$TEST_DIRECTORY\"/../","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-19T16:05:59Z","receivedAt":"2010-08-19T16:05:59Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change code that used $TEST_DIRECTORY/.. to use $GIT_BUILD_DIR\ninstead, the two are equivalent, but the latter is easier to read.\n\nThis required moving the assignment od GIT_BUILD_DIR to earlier in the\ntest-lib.sh file.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n\nNote that the usage of GIT_BUILD_DIR in the first hunk isn't an error,\nsince it's inside a function GIT_BUILD_DIR will be defined by the time\nit's used.\n\n t/test-lib.sh |   29 +++++++++++++++--------------\n 1 files changed, 15 insertions(+), 14 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 0e460f9..689aa29 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -685,7 +685,7 @@ test_create_repo () {\n \trepo=\"$1\"\n \tmkdir -p \"$repo\"\n \tcd \"$repo\" || error \"Cannot setup test environment\"\n-\t\"$GIT_EXEC_PATH/git-init\" \"--template=$TEST_DIRECTORY/../templates/blt/\" >&3 2>&4 ||\n+\t\"$GIT_EXEC_PATH/git-init\" \"--template=$GIT_BUILD_DIR/templates/blt/\" >&3 2>&4 ||\n \terror \"cannot run git init -- have you built things yet?\"\n \tmv .git/hooks .git/hooks-disabled\n \tcd \"$owd\"\n@@ -748,6 +748,8 @@ test_done () {\n # Test the binaries we have just built.  The tests are kept in\n # t/ subdirectory and are run in 'trash directory' subdirectory.\n TEST_DIRECTORY=$(pwd)\n+GIT_BUILD_DIR=\"$TEST_DIRECTORY\"/..\n+\n if test -n \"$valgrind\"\n then\n \tmake_symlink () {\n@@ -774,7 +776,7 @@ then\n \t\ttest -x \"$1\" || return\n \n \t\tbase=$(basename \"$1\")\n-\t\tsymlink_target=$TEST_DIRECTORY/../$base\n+\t\tsymlink_target=$GIT_BUILD_DIR/$base\n \t\t# do not override scripts\n \t\tif test -x \"$symlink_target\" &&\n \t\t    test ! -d \"$symlink_target\" &&\n@@ -793,7 +795,7 @@ then\n \t# override all git executables in TEST_DIRECTORY/..\n \tGIT_VALGRIND=$TEST_DIRECTORY/valgrind\n \tmkdir -p \"$GIT_VALGRIND\"/bin\n-\tfor file in $TEST_DIRECTORY/../git* $TEST_DIRECTORY/../test-*\n+\tfor file in $GIT_BUILD_DIR/git* $GIT_BUILD_DIR/test-*\n \tdo\n \t\tmake_valgrind_symlink $file\n \tdone\n@@ -814,10 +816,10 @@ then\n elif test -n \"$GIT_TEST_INSTALLED\" ; then\n \tGIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path)  ||\n \terror \"Cannot run git from $GIT_TEST_INSTALLED.\"\n-\tPATH=$GIT_TEST_INSTALLED:$TEST_DIRECTORY/..:$PATH\n+\tPATH=$GIT_TEST_INSTALLED:$GIT_BUILD_DIR:$PATH\n \tGIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}\n else # normal case, use ../bin-wrappers only unless $with_dashes:\n-\tgit_bin_dir=\"$TEST_DIRECTORY/../bin-wrappers\"\n+\tgit_bin_dir=\"$GIT_BUILD_DIR/bin-wrappers\"\n \tif ! test -x \"$git_bin_dir/git\" ; then\n \t\tif test -z \"$with_dashes\" ; then\n \t\t\tsay \"$git_bin_dir/git is not executable; using GIT_EXEC_PATH\"\n@@ -825,13 +827,12 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:\n \t\twith_dashes=t\n \tfi\n \tPATH=\"$git_bin_dir:$PATH\"\n-\tGIT_EXEC_PATH=$TEST_DIRECTORY/..\n+\tGIT_EXEC_PATH=$GIT_BUILD_DIR\n \tif test -n \"$with_dashes\" ; then\n-\t\tPATH=\"$TEST_DIRECTORY/..:$PATH\"\n+\t\tPATH=\"$GIT_BUILD_DIR:$PATH\"\n \tfi\n fi\n-GIT_BUILD_DIR=\"$TEST_DIRECTORY\"/..\n-GIT_TEMPLATE_DIR=\"$TEST_DIRECTORY\"/../templates/blt\n+GIT_TEMPLATE_DIR=\"$GIT_BUILD_DIR\"/templates/blt\n unset GIT_CONFIG\n GIT_CONFIG_NOSYSTEM=1\n GIT_CONFIG_NOGLOBAL=1\n@@ -849,22 +850,22 @@ then\n \tfi\n fi\n \n-GITPERLLIB=\"$TEST_DIRECTORY\"/../perl/blib/lib:\"$TEST_DIRECTORY\"/../perl/blib/arch/auto/Git\n+GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/blib/lib:\"$GIT_BUILD_DIR\"/perl/blib/arch/auto/Git\n export GITPERLLIB\n-test -d \"$TEST_DIRECTORY\"/../templates/blt || {\n+test -d \"$GIT_BUILD_DIR\"/templates/blt || {\n \terror \"You haven't built things yet, have you?\"\n }\n \n if test -z \"$GIT_TEST_INSTALLED\" && test -z \"$NO_PYTHON\"\n then\n-\tGITPYTHONLIB=\"$TEST_DIRECTORY/../git_remote_helpers/build/lib\"\n+\tGITPYTHONLIB=\"$GIT_BUILD_DIR/git_remote_helpers/build/lib\"\n \texport GITPYTHONLIB\n-\ttest -d \"$TEST_DIRECTORY\"/../git_remote_helpers/build || {\n+\ttest -d \"$GIT_BUILD_DIR\"/git_remote_helpers/build || {\n \t\terror \"You haven't built git_remote_helpers yet, have you?\"\n \t}\n fi\n \n-if ! test -x \"$TEST_DIRECTORY\"/../test-chmtime; then\n+if ! test -x \"$GIT_BUILD_DIR\"/test-chmtime; then\n \techo >&2 'You need to build test-chmtime:'\n \techo >&2 'Run \"make test-chmtime\" in the source (toplevel) directory'\n \texit 1\n-- \n1.7.2.1.414.g9bf49\n"},{"id":"148461","messageId":"1282233961-27203-4-git-send-email-avarab@gmail.com","threadId":"24767","inReplyTo":"1282138473-15613-1-git-send-email-avarab@gmail.com","subject":"[PATCH v2 3/4] test-lib: Allow overriding of TEST_DIRECTORY","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-19T16:06:00Z","receivedAt":"2010-08-19T16:06:00Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Tests that test the test-lib.sh itself need to be executed in the\ndynamically created trash directory, so we can't assume\n$TEST_DIRECTORY is ../ for those.\n\nAs a side benefit this change also makes it easy for us to move the\nt/*.sh tests into subdirectories if we ever want to do that.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib.sh |    8 +++++++-\n 1 files changed, 7 insertions(+), 1 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 689aa29..01ddf3e 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -747,7 +747,13 @@ test_done () {\n \n # Test the binaries we have just built.  The tests are kept in\n # t/ subdirectory and are run in 'trash directory' subdirectory.\n-TEST_DIRECTORY=$(pwd)\n+if test -z \"$TEST_DIRECTORY\"\n+then\n+\t# We allow tests to override this, in case they want to run tests\n+\t# outside of t/, e.g. for running tests on the test library\n+\t# itself.\n+\tTEST_DIRECTORY=$(pwd)\n+fi\n GIT_BUILD_DIR=\"$TEST_DIRECTORY\"/..\n \n if test -n \"$valgrind\"\n-- \n1.7.2.1.414.g9bf49\n"},{"id":"148458","messageId":"1282233961-27203-5-git-send-email-avarab@gmail.com","threadId":"24767","inReplyTo":"1282138473-15613-1-git-send-email-avarab@gmail.com","subject":"[PATCH v2 4/4] t/t0000-basic.sh: Run the passing TODO test inside its own test-lib","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-19T16:06:01Z","receivedAt":"2010-08-19T16:06:01Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the passing TODO test in t0000-basic.sh to run inside its own\ntest-lib.sh. The motivation is to have nothing out of the ordinary on\na normal test run for test smoking purposes.\n\nIf every normal test run has a passing TODO you're more likely to turn\na blind eye to it and not to investigate cases where things really are\npassing unexpectedly.\n\nIt also makes the prove(1) output less noisy. Before:\n\n    All tests successful.\n\n    Test Summary Report\n    -------------------\n    ./t0000-basic.sh                                   (Wstat: 0 Tests: 46 Failed: 0)\n      TODO passed:   5\n    Files=484, Tests=6229, 143 wallclock secs ( 4.00 usr  4.15 sys + 104.77 cusr 351.57 csys = 464.49 CPU)\n    Result: PASS\n\nAnd after:\n\n    All tests successful.\n    Files=484, Tests=6228, 139 wallclock secs ( 4.07 usr  4.25 sys + 104.54 cusr 350.85 csys = 463.71 CPU)\n    Result: PASS\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t0000-basic.sh |   31 +++++++++++++++++++++++++++++++\n 1 files changed, 31 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t0000-basic.sh b/t/t0000-basic.sh\nindex 9602085..1a977db 100755\n--- a/t/t0000-basic.sh\n+++ b/t/t0000-basic.sh\n@@ -54,9 +54,40 @@ test_expect_success 'success is reported like this' '\n test_expect_failure 'pretend we have a known breakage' '\n     false\n '\n+\n+test_expect_success 'pretend we have fixed a known breakage (run in sub test-lib)' \"\n+    mkdir passing-todo &&\n+    (cd passing-todo &&\n+    cat >passing-todo.sh <<EOF &&\n+#!/bin/sh\n+\n+test_description='A passing TODO test\n+\n+This is run in a sub test-lib so that we don't get incorrect passing\n+metrics\n+'\n+\n+# Point to the t/test-lib.sh, which isn't in ../ as usual\n+TEST_DIRECTORY=\\\"$TEST_DIRECTORY\\\"\n+. \\\"\\$TEST_DIRECTORY\\\"/test-lib.sh\n+\n test_expect_failure 'pretend we have fixed a known breakage' '\n     :\n '\n+\n+test_done\n+EOF\n+    chmod +x passing-todo.sh &&\n+    ./passing-todo.sh >out 2>err &&\n+    ! test -s err &&\n+cat >expect <<EOF &&\n+ok 1 - pretend we have fixed a known breakage # TODO known breakage\n+# fixed 1 known breakage(s)\n+# passed all 1 test(s)\n+1..1\n+EOF\n+    test_cmp expect out)\n+\"\n test_set_prereq HAVEIT\n haveit=no\n test_expect_success HAVEIT 'test runs if prerequisite is satisfied' '\n-- \n1.7.2.1.414.g9bf49\n"},{"id":"148463","messageId":"1282234092-27429-1-git-send-email-avarab@gmail.com","threadId":"24767","inReplyTo":"1282138473-15613-1-git-send-email-avarab@gmail.com","subject":"[PATCH v3 0/4] Support for running tests outside t/ + don't run a TODO test","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-19T16:08:08Z","receivedAt":"2010-08-19T16:08:08Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This *really* v3, I just sent another copy of v2 unchanged\naccidentally (this is really not my day). This one:\n\n * Fixes a trivial shell syntax error in the last patch (oops!)\n\n * Uses #!$SHELL_PATH for a shebang instead of #!/bin/sh in the file\n   we're about to write out. This now passes e.g. on Solaris which has\n   an insane /bin/sh.\n\nAs an aside there's a bunch of other things in our tests that are\nwriting out shellscripts with a #!/bin/sh shebang instead of\n#!$SHELL_PATH. These are passing purely by accident since they just\nhappen to use shell syntax that doesn't run afoul of grumpy old shells\nlike Solaris's /bin/sh.\n\nÆvar Arnfjörð Bjarmason (4):\n  test-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and\n    ../\n  test-lib: Use \"$GIT_BUILD_DIR\" instead of \"$TEST_DIRECTORY\"/../\n  test-lib: Allow overriding of TEST_DIRECTORY\n  t/t0000-basic.sh: Run the passing TODO test inside its own test-lib\n\n t/t0000-basic.sh |   31 +++++++++++++++++++++++++++++++\n t/test-lib.sh    |   39 +++++++++++++++++++++++----------------\n 2 files changed, 54 insertions(+), 16 deletions(-)\n\n-- \n1.7.2.1.446.g168052\n"},{"id":"148464","messageId":"1282234092-27429-2-git-send-email-avarab@gmail.com","threadId":"24767","inReplyTo":"1282138473-15613-1-git-send-email-avarab@gmail.com","subject":"[PATCH v3 1/4] test-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and ../","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-19T16:08:09Z","receivedAt":"2010-08-19T16:08:09Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the redundant calls to $(pwd) to use $TEST_DIRECTORY\ninstead. None of these were being executed after we cd'd somewhere\nelse so they weren't actually needed.\n\nThis also makes it easier to add support for overriding the test\nlibrary location and run tests in a different directory than t/.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib.sh |   16 ++++++++--------\n 1 files changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 5bb7662..0e460f9 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -830,14 +830,14 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:\n \t\tPATH=\"$TEST_DIRECTORY/..:$PATH\"\n \tfi\n fi\n-GIT_BUILD_DIR=$(pwd)/..\n-GIT_TEMPLATE_DIR=$(pwd)/../templates/blt\n+GIT_BUILD_DIR=\"$TEST_DIRECTORY\"/..\n+GIT_TEMPLATE_DIR=\"$TEST_DIRECTORY\"/../templates/blt\n unset GIT_CONFIG\n GIT_CONFIG_NOSYSTEM=1\n GIT_CONFIG_NOGLOBAL=1\n export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_CONFIG_NOGLOBAL\n \n-. ../GIT-BUILD-OPTIONS\n+. \"$GIT_BUILD_DIR\"/GIT-BUILD-OPTIONS\n \n if test -z \"$GIT_TEST_CMP\"\n then\n@@ -849,22 +849,22 @@ then\n \tfi\n fi\n \n-GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git\n+GITPERLLIB=\"$TEST_DIRECTORY\"/../perl/blib/lib:\"$TEST_DIRECTORY\"/../perl/blib/arch/auto/Git\n export GITPERLLIB\n-test -d ../templates/blt || {\n+test -d \"$TEST_DIRECTORY\"/../templates/blt || {\n \terror \"You haven't built things yet, have you?\"\n }\n \n if test -z \"$GIT_TEST_INSTALLED\" && test -z \"$NO_PYTHON\"\n then\n-\tGITPYTHONLIB=\"$(pwd)/../git_remote_helpers/build/lib\"\n+\tGITPYTHONLIB=\"$TEST_DIRECTORY/../git_remote_helpers/build/lib\"\n \texport GITPYTHONLIB\n-\ttest -d ../git_remote_helpers/build || {\n+\ttest -d \"$TEST_DIRECTORY\"/../git_remote_helpers/build || {\n \t\terror \"You haven't built git_remote_helpers yet, have you?\"\n \t}\n fi\n \n-if ! test -x ../test-chmtime; then\n+if ! test -x \"$TEST_DIRECTORY\"/../test-chmtime; then\n \techo >&2 'You need to build test-chmtime:'\n \techo >&2 'Run \"make test-chmtime\" in the source (toplevel) directory'\n \texit 1\n-- \n1.7.2.1.446.g168052\n"},{"id":"148466","messageId":"1282234092-27429-3-git-send-email-avarab@gmail.com","threadId":"24767","inReplyTo":"1282138473-15613-1-git-send-email-avarab@gmail.com","subject":"[PATCH v3 2/4] test-lib: Use \"$GIT_BUILD_DIR\" instead of \"$TEST_DIRECTORY\"/../","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-19T16:08:10Z","receivedAt":"2010-08-19T16:08:10Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change code that used $TEST_DIRECTORY/.. to use $GIT_BUILD_DIR\ninstead, the two are equivalent, but the latter is easier to read.\n\nThis required moving the assignment od GIT_BUILD_DIR to earlier in the\ntest-lib.sh file.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib.sh |   29 +++++++++++++++--------------\n 1 files changed, 15 insertions(+), 14 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 0e460f9..689aa29 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -685,7 +685,7 @@ test_create_repo () {\n \trepo=\"$1\"\n \tmkdir -p \"$repo\"\n \tcd \"$repo\" || error \"Cannot setup test environment\"\n-\t\"$GIT_EXEC_PATH/git-init\" \"--template=$TEST_DIRECTORY/../templates/blt/\" >&3 2>&4 ||\n+\t\"$GIT_EXEC_PATH/git-init\" \"--template=$GIT_BUILD_DIR/templates/blt/\" >&3 2>&4 ||\n \terror \"cannot run git init -- have you built things yet?\"\n \tmv .git/hooks .git/hooks-disabled\n \tcd \"$owd\"\n@@ -748,6 +748,8 @@ test_done () {\n # Test the binaries we have just built.  The tests are kept in\n # t/ subdirectory and are run in 'trash directory' subdirectory.\n TEST_DIRECTORY=$(pwd)\n+GIT_BUILD_DIR=\"$TEST_DIRECTORY\"/..\n+\n if test -n \"$valgrind\"\n then\n \tmake_symlink () {\n@@ -774,7 +776,7 @@ then\n \t\ttest -x \"$1\" || return\n \n \t\tbase=$(basename \"$1\")\n-\t\tsymlink_target=$TEST_DIRECTORY/../$base\n+\t\tsymlink_target=$GIT_BUILD_DIR/$base\n \t\t# do not override scripts\n \t\tif test -x \"$symlink_target\" &&\n \t\t    test ! -d \"$symlink_target\" &&\n@@ -793,7 +795,7 @@ then\n \t# override all git executables in TEST_DIRECTORY/..\n \tGIT_VALGRIND=$TEST_DIRECTORY/valgrind\n \tmkdir -p \"$GIT_VALGRIND\"/bin\n-\tfor file in $TEST_DIRECTORY/../git* $TEST_DIRECTORY/../test-*\n+\tfor file in $GIT_BUILD_DIR/git* $GIT_BUILD_DIR/test-*\n \tdo\n \t\tmake_valgrind_symlink $file\n \tdone\n@@ -814,10 +816,10 @@ then\n elif test -n \"$GIT_TEST_INSTALLED\" ; then\n \tGIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path)  ||\n \terror \"Cannot run git from $GIT_TEST_INSTALLED.\"\n-\tPATH=$GIT_TEST_INSTALLED:$TEST_DIRECTORY/..:$PATH\n+\tPATH=$GIT_TEST_INSTALLED:$GIT_BUILD_DIR:$PATH\n \tGIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}\n else # normal case, use ../bin-wrappers only unless $with_dashes:\n-\tgit_bin_dir=\"$TEST_DIRECTORY/../bin-wrappers\"\n+\tgit_bin_dir=\"$GIT_BUILD_DIR/bin-wrappers\"\n \tif ! test -x \"$git_bin_dir/git\" ; then\n \t\tif test -z \"$with_dashes\" ; then\n \t\t\tsay \"$git_bin_dir/git is not executable; using GIT_EXEC_PATH\"\n@@ -825,13 +827,12 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:\n \t\twith_dashes=t\n \tfi\n \tPATH=\"$git_bin_dir:$PATH\"\n-\tGIT_EXEC_PATH=$TEST_DIRECTORY/..\n+\tGIT_EXEC_PATH=$GIT_BUILD_DIR\n \tif test -n \"$with_dashes\" ; then\n-\t\tPATH=\"$TEST_DIRECTORY/..:$PATH\"\n+\t\tPATH=\"$GIT_BUILD_DIR:$PATH\"\n \tfi\n fi\n-GIT_BUILD_DIR=\"$TEST_DIRECTORY\"/..\n-GIT_TEMPLATE_DIR=\"$TEST_DIRECTORY\"/../templates/blt\n+GIT_TEMPLATE_DIR=\"$GIT_BUILD_DIR\"/templates/blt\n unset GIT_CONFIG\n GIT_CONFIG_NOSYSTEM=1\n GIT_CONFIG_NOGLOBAL=1\n@@ -849,22 +850,22 @@ then\n \tfi\n fi\n \n-GITPERLLIB=\"$TEST_DIRECTORY\"/../perl/blib/lib:\"$TEST_DIRECTORY\"/../perl/blib/arch/auto/Git\n+GITPERLLIB=\"$GIT_BUILD_DIR\"/perl/blib/lib:\"$GIT_BUILD_DIR\"/perl/blib/arch/auto/Git\n export GITPERLLIB\n-test -d \"$TEST_DIRECTORY\"/../templates/blt || {\n+test -d \"$GIT_BUILD_DIR\"/templates/blt || {\n \terror \"You haven't built things yet, have you?\"\n }\n \n if test -z \"$GIT_TEST_INSTALLED\" && test -z \"$NO_PYTHON\"\n then\n-\tGITPYTHONLIB=\"$TEST_DIRECTORY/../git_remote_helpers/build/lib\"\n+\tGITPYTHONLIB=\"$GIT_BUILD_DIR/git_remote_helpers/build/lib\"\n \texport GITPYTHONLIB\n-\ttest -d \"$TEST_DIRECTORY\"/../git_remote_helpers/build || {\n+\ttest -d \"$GIT_BUILD_DIR\"/git_remote_helpers/build || {\n \t\terror \"You haven't built git_remote_helpers yet, have you?\"\n \t}\n fi\n \n-if ! test -x \"$TEST_DIRECTORY\"/../test-chmtime; then\n+if ! test -x \"$GIT_BUILD_DIR\"/test-chmtime; then\n \techo >&2 'You need to build test-chmtime:'\n \techo >&2 'Run \"make test-chmtime\" in the source (toplevel) directory'\n \texit 1\n-- \n1.7.2.1.446.g168052\n"},{"id":"148465","messageId":"1282234092-27429-4-git-send-email-avarab@gmail.com","threadId":"24767","inReplyTo":"1282138473-15613-1-git-send-email-avarab@gmail.com","subject":"[PATCH v3 3/4] test-lib: Allow overriding of TEST_DIRECTORY","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-19T16:08:11Z","receivedAt":"2010-08-19T16:08:11Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Tests that test the test-lib.sh itself need to be executed in the\ndynamically created trash directory, so we can't assume\n$TEST_DIRECTORY is ../ for those.\n\nAs a side benefit this change also makes it easy for us to move the\nt/*.sh tests into subdirectories if we ever want to do that.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib.sh |    8 +++++++-\n 1 files changed, 7 insertions(+), 1 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 689aa29..01ddf3e 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -747,7 +747,13 @@ test_done () {\n \n # Test the binaries we have just built.  The tests are kept in\n # t/ subdirectory and are run in 'trash directory' subdirectory.\n-TEST_DIRECTORY=$(pwd)\n+if test -z \"$TEST_DIRECTORY\"\n+then\n+\t# We allow tests to override this, in case they want to run tests\n+\t# outside of t/, e.g. for running tests on the test library\n+\t# itself.\n+\tTEST_DIRECTORY=$(pwd)\n+fi\n GIT_BUILD_DIR=\"$TEST_DIRECTORY\"/..\n \n if test -n \"$valgrind\"\n-- \n1.7.2.1.446.g168052\n"},{"id":"148467","messageId":"1282234092-27429-5-git-send-email-avarab@gmail.com","threadId":"24767","inReplyTo":"1282138473-15613-1-git-send-email-avarab@gmail.com","subject":"[PATCH v3 4/4] t/t0000-basic.sh: Run the passing TODO test inside its own test-lib","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-19T16:08:12Z","receivedAt":"2010-08-19T16:08:12Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the passing TODO test in t0000-basic.sh to run inside its own\ntest-lib.sh. The motivation is to have nothing out of the ordinary on\na normal test run for test smoking purposes.\n\nIf every normal test run has a passing TODO you're more likely to turn\na blind eye to it and not to investigate cases where things really are\npassing unexpectedly.\n\nIt also makes the prove(1) output less noisy. Before:\n\n    All tests successful.\n\n    Test Summary Report\n    -------------------\n    ./t0000-basic.sh                                   (Wstat: 0 Tests: 46 Failed: 0)\n      TODO passed:   5\n    Files=484, Tests=6229, 143 wallclock secs ( 4.00 usr  4.15 sys + 104.77 cusr 351.57 csys = 464.49 CPU)\n    Result: PASS\n\nAnd after:\n\n    All tests successful.\n    Files=484, Tests=6228, 139 wallclock secs ( 4.07 usr  4.25 sys + 104.54 cusr 350.85 csys = 463.71 CPU)\n    Result: PASS\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t0000-basic.sh |   31 +++++++++++++++++++++++++++++++\n 1 files changed, 31 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t0000-basic.sh b/t/t0000-basic.sh\nindex 9602085..f688bd3 100755\n--- a/t/t0000-basic.sh\n+++ b/t/t0000-basic.sh\n@@ -54,9 +54,40 @@ test_expect_success 'success is reported like this' '\n test_expect_failure 'pretend we have a known breakage' '\n     false\n '\n+\n+test_expect_success 'pretend we have fixed a known breakage (run in sub test-lib)' \"\n+    mkdir passing-todo &&\n+    (cd passing-todo &&\n+    cat >passing-todo.sh <<EOF &&\n+#!$SHELL_PATH\n+\n+test_description='A passing TODO test\n+\n+This is run in a sub test-lib so that we do not get incorrect passing\n+metrics\n+'\n+\n+# Point to the t/test-lib.sh, which isn't in ../ as usual\n+TEST_DIRECTORY=\\\"$TEST_DIRECTORY\\\"\n+. \\\"\\$TEST_DIRECTORY\\\"/test-lib.sh\n+\n test_expect_failure 'pretend we have fixed a known breakage' '\n     :\n '\n+\n+test_done\n+EOF\n+    chmod +x passing-todo.sh &&\n+    ./passing-todo.sh >out 2>err &&\n+    ! test -s err &&\n+cat >expect <<EOF &&\n+ok 1 - pretend we have fixed a known breakage # TODO known breakage\n+# fixed 1 known breakage(s)\n+# passed all 1 test(s)\n+1..1\n+EOF\n+    test_cmp expect out)\n+\"\n test_set_prereq HAVEIT\n haveit=no\n test_expect_success HAVEIT 'test runs if prerequisite is satisfied' '\n-- \n1.7.2.1.446.g168052\n"},{"id":"148468","messageId":"20100819161821.GA27381@sigill.intra.peff.net","threadId":"24767","inReplyTo":"1282234092-27429-1-git-send-email-avarab@gmail.com","subject":"Re: [PATCH v3 0/4] Support for running tests outside t/ + don't run a TODO test","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-08-19T16:18:21Z","receivedAt":"2010-08-19T16:18:21Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Aug 19, 2010 at 04:08:08PM +0000, Ævar Arnfjörð Bjarmason wrote:\n\n> As an aside there's a bunch of other things in our tests that are\n> writing out shellscripts with a #!/bin/sh shebang instead of\n> #!$SHELL_PATH. These are passing purely by accident since they just\n> happen to use shell syntax that doesn't run afoul of grumpy old shells\n> like Solaris's /bin/sh.\n\nIt's not an accident. I (and others) checked them all when $SHELL_PATH\nbecame available to the test scripts, and declared them all trivial. But\nI would not be opposed to making them all #!$SHELL_PATH.\n\n-Peff\n"},{"id":"148472","messageId":"AANLkTin5XciuPCusghw4GihsYp2Lq8Ng1UcWACRrDy6f@mail.gmail.com","threadId":"24767","inReplyTo":"1282138473-15613-5-git-send-email-avarab@gmail.com","subject":"Re: [PATCH v2 4/4] t/t0000-basic.sh: Run the passing TODO test inside its own test-lib","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-08-19T17:39:54Z","receivedAt":"2010-08-19T17:39:54Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Wed, Aug 18, 2010 at 08:34, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n> Change the passing TODO test in t0000-basic.sh to run inside its own\n> test-lib.sh. The motivation is to have nothing out of the ordinary on\n> a normal test run for test smoking purposes.\n\nI like the effect of this patch, but the patch itself is a bit obscure\nperhaps. I'll defer judgement on whether this is acceptable to others\n:).\n\n-- \nCheers,\n\nSverre Rabbelier\n"}]}