{"thread":{"id":"15772","subject":"[FYI][PATCH] Execute testsuite on existing Git installation","startedAt":"2008-10-03T13:13:15Z","lastAt":"2008-10-03T15:59:49Z","messageCount":3,"participants":["Petr Baudis","Rogan Dawes"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"92249","messageId":"20081003131314.GS10544@machine.or.cz","threadId":"15772","inReplyTo":null,"subject":"[FYI][PATCH] Execute testsuite on existing Git installation","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-10-03T13:13:15Z","receivedAt":"2008-10-03T13:13:15Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"When I joined here, one of the first tasks I had was to \"verify if the\nexisting system-wide Git installation works fine on the local Linux\nsetup (of unknown qualities)\". I couldn't think of anything better than\nto run the Git testsuite, but using the system-wide Git instead of\nlocally compiled one.\n\nThis extremely dirty patch achieves this; patch testsuite of Git version\ncorresponding to the system-wide installation, of course. You will still\nneed to make the test helpers.\n\nI don't have any real interest on developing this further or tidying it\nup, but I have thought that someone might find this useful to just use\nor push forward, so here it goes.\n\nSigned-off-by: Petr Baudis <petr.baudis@novartis.com>\n\n---\n\ndiff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh\nindex 5d3bd9d..f3c78dc 100644\n--- a/t/lib-git-svn.sh\n+++ b/t/lib-git-svn.sh\n@@ -47,7 +47,7 @@ rawsvnrepo=\"$svnrepo\"\n svnrepo=\"file://$svnrepo\"\n \n poke() {\n-\ttest-chmtime +1 \"$1\"\n+\t~/git-repo/test-chmtime +1 \"$1\"\n }\n \n for d in \\\ndiff --git a/t/t0000-basic.sh b/t/t0000-basic.sh\nindex 690f80a..606ed99 100755\n--- a/t/t0000-basic.sh\n+++ b/t/t0000-basic.sh\n@@ -21,11 +21,13 @@ modification *should* take notice and update the test vectors here.\n ################################################################\n # It appears that people try to run tests without building...\n \n-../git >/dev/null\n-if test $? != 1\n-then\n-\techo >&2 'You do not seem to have built git yet.'\n-\texit 1\n+if false; then\n+\t../git >/dev/null\n+\tif test $? != 1\n+\tthen\n+\t\techo >&2 'You do not seem to have built git yet.'\n+\t\texit 1\n+\tfi\n fi\n \n . ./test-lib.sh\n@@ -301,14 +303,14 @@ test_expect_success 'absolute path works as expected' '\n \tmkdir third &&\n \tdir=\"$(cd .git; pwd -P)\" &&\n \tdir2=third/../second/other/.git &&\n-\ttest \"$dir\" = \"$(test-absolute-path $dir2)\" &&\n+\ttest \"$dir\" = \"$(~/git-repo/test-absolute-path $dir2)\" &&\n \tfile=\"$dir\"/index &&\n-\ttest \"$file\" = \"$(test-absolute-path $dir2/index)\" &&\n+\ttest \"$file\" = \"$(~/git-repo/test-absolute-path $dir2/index)\" &&\n \tbasename=blub &&\n-\ttest \"$dir/$basename\" = \"$(cd .git && test-absolute-path \"$basename\")\" &&\n+\ttest \"$dir/$basename\" = \"$(cd .git && ~/git-repo/test-absolute-path \"$basename\")\" &&\n \tln -s ../first/file .git/syml &&\n \tsym=\"$(cd first; pwd -P)\"/file &&\n-\ttest \"$sym\" = \"$(test-absolute-path \"$dir2/syml\")\"\n+\ttest \"$sym\" = \"$(~/git-repo/test-absolute-path \"$dir2/syml\")\"\n '\n \n test_expect_success 'very long name in the index handled sanely' '\ndiff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh\nindex 6309aed..7d13c3f 100755\n--- a/t/t0040-parse-options.sh\n+++ b/t/t0040-parse-options.sh\n@@ -39,7 +39,7 @@ Standard options\n EOF\n \n test_expect_success 'test help' '\n-\ttest_must_fail test-parse-options -h > output 2> output.err &&\n+\ttest_must_fail ~/git-repo/test-parse-options -h > output 2> output.err &&\n \ttest ! -s output &&\n \ttest_cmp expect.err output.err\n '\n@@ -55,7 +55,7 @@ dry run: yes\n EOF\n \n test_expect_success 'short options' '\n-\ttest-parse-options -s123 -b -i 1729 -b -vv -n > output 2> output.err &&\n+\t~/git-repo/test-parse-options -s123 -b -i 1729 -b -vv -n > output 2> output.err &&\n \ttest_cmp expect output &&\n \ttest ! -s output.err\n '\n@@ -71,7 +71,7 @@ dry run: no\n EOF\n \n test_expect_success 'long options' '\n-\ttest-parse-options --boolean --integer 1729 --boolean --string2=321 \\\n+\t~/git-repo/test-parse-options --boolean --integer 1729 --boolean --string2=321 \\\n \t\t--verbose --verbose --no-dry-run --abbrev=10 \\\n \t\t> output 2> output.err &&\n \ttest ! -s output.err &&\n@@ -92,7 +92,7 @@ arg 02: --boolean\n EOF\n \n test_expect_success 'intermingled arguments' '\n-\ttest-parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \\\n+\t~/git-repo/test-parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \\\n \t\t> output 2> output.err &&\n \ttest ! -s output.err &&\n \ttest_cmp expect output\n@@ -109,19 +109,19 @@ dry run: no\n EOF\n \n test_expect_success 'unambiguously abbreviated option' '\n-\ttest-parse-options --int 2 --boolean --no-bo > output 2> output.err &&\n+\t~/git-repo/test-parse-options --int 2 --boolean --no-bo > output 2> output.err &&\n \ttest ! -s output.err &&\n \ttest_cmp expect output\n '\n \n test_expect_success 'unambiguously abbreviated option with \"=\"' '\n-\ttest-parse-options --int=2 > output 2> output.err &&\n+\t~/git-repo/test-parse-options --int=2 > output 2> output.err &&\n \ttest ! -s output.err &&\n \ttest_cmp expect output\n '\n \n test_expect_success 'ambiguously abbreviated option' '\n-\ttest-parse-options --strin 123;\n+\t~/git-repo/test-parse-options --strin 123;\n \ttest $? = 129\n '\n \n@@ -136,7 +136,7 @@ dry run: no\n EOF\n \n test_expect_success 'non ambiguous option (after two options it abbreviates)' '\n-\ttest-parse-options --st 123 > output 2> output.err &&\n+\t~/git-repo/test-parse-options --st 123 > output 2> output.err &&\n \ttest ! -s output.err &&\n \ttest_cmp expect output\n '\n@@ -146,7 +146,7 @@ error: did you mean \\`--boolean\\` (with two dashes ?)\n EOF\n \n test_expect_success 'detect possible typos' '\n-\ttest_must_fail test-parse-options -boolean > output 2> output.err &&\n+\ttest_must_fail ~/git-repo/test-parse-options -boolean > output 2> output.err &&\n \ttest ! -s output &&\n \ttest_cmp typo.err output.err\n '\n@@ -163,7 +163,7 @@ arg 00: --quux\n EOF\n \n test_expect_success 'keep some options as arguments' '\n-\ttest-parse-options --quux > output 2> output.err &&\n+\t~/git-repo/test-parse-options --quux > output 2> output.err &&\n         test ! -s output.err &&\n         test_cmp expect output\n '\n@@ -180,7 +180,7 @@ arg 00: foo\n EOF\n \n test_expect_success 'OPT_DATE() and OPT_SET_PTR() work' '\n-\ttest-parse-options -t \"1970-01-01 00:00:01 +0000\" --default-string \\\n+\t~/git-repo/test-parse-options -t \"1970-01-01 00:00:01 +0000\" --default-string \\\n \t\tfoo -q > output 2> output.err &&\n \ttest ! -s output.err &&\n \ttest_cmp expect output\n@@ -198,7 +198,7 @@ dry run: no\n EOF\n \n test_expect_success 'OPT_CALLBACK() and OPT_BIT() work' '\n-\ttest-parse-options --length=four -b -4 > output 2> output.err &&\n+\t~/git-repo/test-parse-options --length=four -b -4 > output 2> output.err &&\n \ttest ! -s output.err &&\n \ttest_cmp expect output\n '\n@@ -208,7 +208,7 @@ Callback: \"not set\", 1\n EOF\n \n test_expect_success 'OPT_CALLBACK() and callback errors work' '\n-\ttest_must_fail test-parse-options --no-length > output 2> output.err &&\n+\ttest_must_fail ~/git-repo/test-parse-options --no-length > output 2> output.err &&\n \ttest_cmp expect output &&\n \ttest_cmp expect.err output.err\n '\n@@ -224,7 +224,7 @@ dry run: no\n EOF\n \n test_expect_success 'OPT_BIT() and OPT_SET_INT() work' '\n-\ttest-parse-options --set23 -bbbbb --no-or4 > output 2> output.err &&\n+\t~/git-repo/test-parse-options --set23 -bbbbb --no-or4 > output 2> output.err &&\n \ttest ! -s output.err &&\n \ttest_cmp expect output\n '\ndiff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh\nindex 85d7e3e..2e869f4 100755\n--- a/t/t4200-rerere.sh\n+++ b/t/t4200-rerere.sh\n@@ -149,16 +149,16 @@ just_over_15_days_ago=$((-1-15*86400))\n almost_60_days_ago=$((60-60*86400))\n just_over_60_days_ago=$((-1-60*86400))\n \n-test-chmtime =$almost_60_days_ago $rr/preimage\n-test-chmtime =$almost_15_days_ago $rr2/preimage\n+~/git-repo/test-chmtime =$almost_60_days_ago $rr/preimage\n+~/git-repo/test-chmtime =$almost_15_days_ago $rr2/preimage\n \n test_expect_success 'garbage collection (part1)' 'git rerere gc'\n \n test_expect_success 'young records still live' \\\n \t\"test -f $rr/preimage && test -f $rr2/preimage\"\n \n-test-chmtime =$just_over_60_days_ago $rr/preimage\n-test-chmtime =$just_over_15_days_ago $rr2/preimage\n+~/git-repo/test-chmtime =$just_over_60_days_ago $rr/preimage\n+~/git-repo/test-chmtime =$just_over_15_days_ago $rr2/preimage\n \n test_expect_success 'garbage collection (part2)' 'git rerere gc'\n \ndiff --git a/t/t5301-sliding-window.sh b/t/t5301-sliding-window.sh\nindex 073ac0c..89177ab 100755\n--- a/t/t5301-sliding-window.sh\n+++ b/t/t5301-sliding-window.sh\n@@ -12,7 +12,7 @@ test_expect_success \\\n      for i in a b c\n      do\n          echo $i >$i &&\n-         test-genrandom \"$i\" 32768 >>$i &&\n+         ~/git-repo/test-genrandom \"$i\" 32768 >>$i &&\n          git update-index --add $i || return 1\n      done &&\n      echo d >d && cat c >>d && git update-index --add d &&\ndiff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh\nindex 09fd917..a38c0c2 100755\n--- a/t/t5302-pack-index.sh\n+++ b/t/t5302-pack-index.sh\n@@ -15,11 +15,11 @@ test_expect_success \\\n      do\n \t\t i=`printf '%03i' $i`\n          echo $i >file_$i &&\n-         test-genrandom \"$i\" 8192 >>file_$i &&\n+         ~/git-repo/test-genrandom \"$i\" 8192 >>file_$i &&\n          git update-index --add file_$i &&\n \t\t i=`expr $i + 1` || return 1\n      done &&\n-     { echo 101 && test-genrandom 100 8192; } >file_101 &&\n+     { echo 101 && ~/git-repo/test-genrandom 100 8192; } >file_101 &&\n      git update-index --add file_101 &&\n      tree=`git write-tree` &&\n      commit=`git commit-tree $tree </dev/null` && {\ndiff --git a/t/t5304-prune.sh b/t/t5304-prune.sh\nindex 9fd9d07..6084172 100644\n--- a/t/t5304-prune.sh\n+++ b/t/t5304-prune.sh\n@@ -21,7 +21,7 @@ test_expect_success 'prune stale packs' '\n \torig_pack=$(echo .git/objects/pack/*.pack) &&\n \t: > .git/objects/tmp_1.pack &&\n \t: > .git/objects/tmp_2.pack &&\n-\ttest-chmtime -86501 .git/objects/tmp_1.pack &&\n+\t~/git-repo/test-chmtime -86501 .git/objects/tmp_1.pack &&\n \tgit prune --expire 1.day &&\n \ttest -f $orig_pack &&\n \ttest -f .git/objects/tmp_2.pack &&\n@@ -39,7 +39,7 @@ test_expect_success 'prune --expire' '\n \tgit prune --expire=1.hour.ago &&\n \ttest $((1 + $before)) = $(git count-objects | sed \"s/ .*//\") &&\n \ttest -f $BLOB_FILE &&\n-\ttest-chmtime -86500 $BLOB_FILE &&\n+\t~/git-repo/test-chmtime -86500 $BLOB_FILE &&\n \tgit prune --expire 1.day &&\n \ttest $before = $(git count-objects | sed \"s/ .*//\") &&\n \t! test -f $BLOB_FILE\n@@ -53,11 +53,11 @@ test_expect_success 'gc: implicit prune --expire' '\n \tBLOB_FILE=.git/objects/$(echo $BLOB | sed \"s/^../&\\//\") &&\n \ttest $((1 + $before)) = $(git count-objects | sed \"s/ .*//\") &&\n \ttest -f $BLOB_FILE &&\n-\ttest-chmtime -$((86400*14-30)) $BLOB_FILE &&\n+\t~/git-repo/test-chmtime -$((86400*14-30)) $BLOB_FILE &&\n \tgit gc &&\n \ttest $((1 + $before)) = $(git count-objects | sed \"s/ .*//\") &&\n \ttest -f $BLOB_FILE &&\n-\ttest-chmtime -$((86400*14+1)) $BLOB_FILE &&\n+\t~/git-repo/test-chmtime -$((86400*14+1)) $BLOB_FILE &&\n \tgit gc &&\n \ttest $before = $(git count-objects | sed \"s/ .*//\") &&\n \t! test -f $BLOB_FILE\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex c861141..38e6a59 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -345,7 +345,7 @@ test_create_repo () {\n \trepo=\"$1\"\n \tmkdir \"$repo\"\n \tcd \"$repo\" || error \"Cannot setup test environment\"\n-\t\"$GIT_EXEC_PATH/git\" init \"--template=$GIT_EXEC_PATH/templates/blt/\" >/dev/null 2>&1 ||\n+\t\"git\" init >/dev/null 2>&1 ||\n \terror \"cannot run git init -- have you built things yet?\"\n \tmv .git/hooks .git/hooks-disabled\n \tcd \"$owd\"\n@@ -387,20 +387,25 @@ 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-PATH=$(pwd)/..:$PATH\n-GIT_EXEC_PATH=$(pwd)/..\n-GIT_TEMPLATE_DIR=$(pwd)/../templates/blt\n-unset GIT_CONFIG\n-unset GIT_CONFIG_LOCAL\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-GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git\n-export GITPERLLIB\n-test -d ../templates/blt || {\n-\terror \"You haven't built things yet, have you?\"\n-}\n+if false; then\n+\tPATH=$(pwd)/..:$PATH\n+\tGIT_EXEC_PATH=$(pwd)/..\n+\tGIT_TEMPLATE_DIR=$(pwd)/../templates/blt\n+\n+\tGITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git\n+\texport GITPERLLIB\n+\ttest -d ../templates/blt || {\n+\t\terror \"You haven't built things yet, have you?\"\n+\t}\n+\n+\t. ../GIT-BUILD-OPTIONS\n+fi\n+\n+\tunset GIT_CONFIG\n+\tunset GIT_CONFIG_LOCAL\n+\tGIT_CONFIG_NOSYSTEM=1\n+\tGIT_CONFIG_NOGLOBAL=1\n+\texport PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_CONFIG_NOGLOBAL\n \n if ! test -x ../test-chmtime; then\n \techo >&2 'You need to build test-chmtime:'\n@@ -408,8 +413,6 @@ if ! test -x ../test-chmtime; then\n \texit 1\n fi\n \n-. ../GIT-BUILD-OPTIONS\n-\n # Test repository\n test=\"trash directory\"\n rm -fr \"$test\" || {\n"},{"id":"92253","messageId":"48E6314B.3090609@dawes.za.net","threadId":"15772","inReplyTo":"20081003131314.GS10544@machine.or.cz","subject":"Re: [FYI][PATCH] Execute testsuite on existing Git installation","fromName":"Rogan Dawes","fromEmail":"lists@dawes.za.net","sentAt":"2008-10-03T14:50:51Z","receivedAt":"2008-10-03T14:50:51Z","isPatch":true,"sender":{"key":"lists@dawes.za.net","avatar":null},"body":"Petr Baudis wrote:\n> When I joined here, one of the first tasks I had was to \"verify if the\n> existing system-wide Git installation works fine on the local Linux\n> setup (of unknown qualities)\". I couldn't think of anything better than\n> to run the Git testsuite, but using the system-wide Git instead of\n> locally compiled one.\n> \n> This extremely dirty patch achieves this; patch testsuite of Git version\n> corresponding to the system-wide installation, of course. You will still\n> need to make the test helpers.\n> \n> I don't have any real interest on developing this further or tidying it\n> up, but I have thought that someone might find this useful to just use\n> or push forward, so here it goes.\n> \n> Signed-off-by: Petr Baudis <petr.baudis@novartis.com>\n> \n\nPerhaps a stupid question, but might it not be easier to add the git \nbuild dir to the front of the PATH, and then remove the explicit paths?\n\nI realise that if the build was unsuccessful, you may end up executing a \ndifferent version of git than you expect, though.\n\nRogan\n"},{"id":"92257","messageId":"48E64175.5090709@dawes.za.net","threadId":"15772","inReplyTo":"48E6314B.3090609@dawes.za.net","subject":"Re: [FYI][PATCH] Execute testsuite on existing Git installation","fromName":"Rogan Dawes","fromEmail":"lists@dawes.za.net","sentAt":"2008-10-03T15:59:49Z","receivedAt":"2008-10-03T15:59:49Z","isPatch":true,"sender":{"key":"lists@dawes.za.net","avatar":null},"body":"Rogan Dawes wrote:\n> Petr Baudis wrote:\n>> When I joined here, one of the first tasks I had was to \"verify if the\n>> existing system-wide Git installation works fine on the local Linux\n>> setup (of unknown qualities)\". I couldn't think of anything better than\n>> to run the Git testsuite, but using the system-wide Git instead of\n>> locally compiled one.\n>>\n>> This extremely dirty patch achieves this; patch testsuite of Git version\n>> corresponding to the system-wide installation, of course. You will still\n>> need to make the test helpers.\n>>\n>> I don't have any real interest on developing this further or tidying it\n>> up, but I have thought that someone might find this useful to just use\n>> or push forward, so here it goes.\n>>\n>> Signed-off-by: Petr Baudis <petr.baudis@novartis.com>\n>>\n> \n> Perhaps a stupid question, but might it not be easier to add the git \n> build dir to the front of the PATH, and then remove the explicit paths?\n> \n> I realise that if the build was unsuccessful, you may end up executing a \n> different version of git than you expect, though.\n> \n> Rogan\n> \n\nOr, make a \"BUILD_DIR\" variable, and replace ../git with ${BUILD_DIR}git \nthroughout, and make BUILD_DIR == '../' for the normal case, and '' for \nthe less common case of testing the existing installation.\n\nOr, make ../git a symlink to the installed git binary. This is probably \nthe simplest, in fact, requiring the least surgery - i.e. none for those \nwho don't need this functionality.\n\nRogan\n"}]}