All test cases found in t/*.sh must include test-lib instead of test-lib.sh Replace the inclusion of GIT-BUILD-OPTIONS with definitions that are filled in during preprocessing. The new test-lib doesn't need to to open GIT-BUILD-OPTIONS for each test script, which speeds up the execution a bit. Signed-off-by: Torsten Bögershausen <tboegi@xxxxxx> --- Note: The diff of all files in t/* is not here in this patch - the mail seems not to got through when I add all the diffs here. So this patch is incomplete and should show the idea. I ran the following script to do the changes: sedmulti.sh t/* (where sedmulti.sh is below:) ==================== #!/bin/sh if [ $# -lt 3 ]; then echo "usage sedmulti <fromtext> <totext> filename ..." >&2 exit 1; fi fromtext=$1; shift; totext=$1; shift; for f in "$@"; do echo sed -ire "s%$fromtext%$totext%g" $f sed -ire "s%$fromtext%$totext%g" $f done =================== .gitignore | 1 + Makefile | 4 ++++ t/README | 8 ++++---- t/test-lib.sh | 11 ++++++++--- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index bf66648..62c60ce 100644 --- a/.gitignore +++ b/.gitignore @@ -192,6 +192,7 @@ /test-sigchain /test-subprocess /test-svn-fe +t/test-lib /common-cmds.h *.tar.gz *.dsc diff --git a/Makefile b/Makefile index 0914133..d540ab6 100644 --- a/Makefile +++ b/Makefile @@ -442,6 +442,7 @@ SCRIPT_LIB += git-rebase--interactive SCRIPT_LIB += git-rebase--merge SCRIPT_LIB += git-sh-setup SCRIPT_LIB += git-sh-i18n +SCRIPT_LIB += t/test-lib SCRIPT_PERL += git-add--interactive.perl SCRIPT_PERL += git-difftool.perl @@ -2018,6 +2019,9 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \ -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \ + -e 's|@@PERL_PATH@@|$(PERL_PATH)|g' \ + -e 's|@@PYTHON_PATH@@|$(PYTHON_PATH)|g' \ + -e 's|@@TAR@@|$(TAR)|g' \ -e $(BROKEN_PATH_FIX) \ $@.sh >$@+ endef diff --git a/t/README b/t/README index 4c3ea25..fa23726 100644 --- a/t/README +++ b/t/README @@ -203,7 +203,7 @@ the top-level test script, never name the file to match the above pattern. The Makefile here considers all such files as the top-level test script and tries to run all of them. Care is especially needed if you are creating a common test library -file, similar to test-lib.sh, because such a library file may +file, similar to test-lib, because such a library file may not be suitable for standalone execution. @@ -225,13 +225,13 @@ assignment to variable 'test_description', like this: and tries to run git-ls-files with option --frotz.' -Source 'test-lib.sh' +Source 'test-lib' -------------------- After assigning test_description, the test script should source -test-lib.sh like this: +test-lib like this: - . ./test-lib.sh + . ./test-lib This test harness library does the following things: diff --git a/t/test-lib.sh b/t/test-lib.sh index 9e2b711..306fcd9 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -46,7 +46,7 @@ EDITOR=: # /usr/xpg4/bin/sh and /bin/ksh to bail out. So keep the unsets # deriving from the command substitution clustered with the other # ones. -unset VISUAL EMAIL LANGUAGE COLUMNS $(perl -e ' +unset VISUAL EMAIL LANGUAGE COLUMNS $(@@PERL_PATH@@ -e ' my @env = keys %ENV; my $ok = join("|", qw( TRACE @@ -107,7 +107,7 @@ export _x05 _x40 _z40 LF # test_description='Description of this test... # This test checks if command xyzzy does the right thing... # ' -# . ./test-lib.sh +# . ./test-lib [ "x$ORIGINAL_TERM" != "xdumb" ] && ( TERM=$ORIGINAL_TERM && export TERM && @@ -492,7 +492,12 @@ GIT_CONFIG_NOSYSTEM=1 GIT_ATTR_NOSYSTEM=1 export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_ATTR_NOSYSTEM -. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS +SHELL_PATH='@SHELL_PATH@' +PERL_PATH='@@PERL_PATH@@' +DIFF='@@DIFF@@' +PYTHON_PATH='@@PYTHON_PATH@@' +TAR='@@TAR@@' +export PERL_PATH if test -z "$GIT_TEST_CMP" then -- 1.7.9.1.3.gd6f4c.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html