Merge branch 'jc/test-lib-source-build-options-early'
authorJunio C Hamano <gitster@pobox.com>
Wed, 25 Jul 2012 22:47:08 +0000 (15:47 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Jul 2012 22:47:08 +0000 (15:47 -0700)
Reorders t/test-lib.sh so that we dot-source GIT-BUILD-OPTIONS that
records the shell and Perl the user told us to use with Git a lot
early, so that test-lib.sh script itself can use "$PERL_PATH" in
one of its early operations.

* jc/test-lib-source-build-options-early:
test-lib: reorder and include GIT-BUILD-OPTIONS a lot earlier

1  2 
t/test-lib.sh
diff --combined t/test-lib.sh
index 5e7f435d515f9eff54f2374beb83b75f556787af,f3e7cf9e57c4c48c36b0cbae00a817c5e785c36e..bb4f8865b2628665f4adbf9ceef03d5a9081e244
@@@ -34,6 -34,26 +34,26 @@@ esa
  # Keep the original TERM for say_color
  ORIGINAL_TERM=$TERM
  
+ # Test the binaries we have just built.  The tests are kept in
+ # t/ subdirectory and are run in 'trash directory' subdirectory.
+ if test -z "$TEST_DIRECTORY"
+ then
+       # We allow tests to override this, in case they want to run tests
+       # outside of t/, e.g. for running tests on the test library
+       # itself.
+       TEST_DIRECTORY=$(pwd)
+ fi
+ if test -z "$TEST_OUTPUT_DIRECTORY"
+ then
+       # Similarly, override this to store the test-results subdir
+       # elsewhere
+       TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
+ fi
+ GIT_BUILD_DIR="$TEST_DIRECTORY"/..
+ . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
+ export PERL_PATH SHELL_PATH
  # For repeatability, reset the environment to known value.
  LANG=C
  LC_ALL=C
@@@ -46,7 -66,7 +66,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
@@@ -61,7 -81,6 +81,7 @@@
        my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
        print join("\n", @vars);
  ')
 +unset XDG_CONFIG_HOME
  GIT_AUTHOR_EMAIL=author@example.com
  GIT_AUTHOR_NAME='A U Thor'
  GIT_COMMITTER_EMAIL=committer@example.com
@@@ -230,7 -249,7 +250,7 @@@ trap 'die' EXI
  
  # The user-facing functions are loaded from a separate file so that
  # test_perf subshells can have them too
- . "${TEST_DIRECTORY:-.}"/test-lib-functions.sh
+ . "$TEST_DIRECTORY/test-lib-functions.sh"
  
  # You are not expected to call test_ok_ and test_failure_ directly, use
  # the text_expect_* functions instead.
@@@ -381,23 -400,6 +401,6 @@@ test_done () 
        esac
  }
  
- # Test the binaries we have just built.  The tests are kept in
- # t/ subdirectory and are run in 'trash directory' subdirectory.
- if test -z "$TEST_DIRECTORY"
- then
-       # We allow tests to override this, in case they want to run tests
-       # outside of t/, e.g. for running tests on the test library
-       # itself.
-       TEST_DIRECTORY=$(pwd)
- fi
- if test -z "$TEST_OUTPUT_DIRECTORY"
- then
-       # Similarly, override this to store the test-results subdir
-       # elsewhere
-       TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
- fi
- GIT_BUILD_DIR="$TEST_DIRECTORY"/..
  if test -n "$valgrind"
  then
        make_symlink () {
@@@ -493,10 -495,6 +496,6 @@@ GIT_CONFIG_NOSYSTEM=
  GIT_ATTR_NOSYSTEM=1
  export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_ATTR_NOSYSTEM
  
- . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
- export PERL_PATH
  if test -z "$GIT_TEST_CMP"
  then
        if test -n "$GIT_TEST_CMP_USE_COPIED_CONTEXT"