Merge branch 'ew/svn-pm'
[gitweb.git] / t / test-lib.sh
index 470a909891bc1358163af91513972ce7d0c702c0..f0f9cd6be01681c90d1914eaa8a40144e2280adf 100755 (executable)
@@ -28,13 +28,21 @@ unset GIT_DIR
 unset GIT_EXTERNAL_DIFF
 unset GIT_INDEX_FILE
 unset GIT_OBJECT_DIRECTORY
-unset GIT_TRACE
 unset SHA1_FILE_DIRECTORIES
 unset SHA1_FILE_DIRECTORY
 export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
 export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
 export EDITOR VISUAL
 
+case $(echo $GIT_TRACE |tr "[A-Z]" "[a-z]") in
+       1|2|true)
+               echo "* warning: Some tests will not work if GIT_TRACE" \
+                       "is set as to trace on STDERR ! *"
+               echo "* warning: Please set GIT_TRACE to something" \
+                       "other than 1, 2 or true ! *"
+               ;;
+esac
+
 # Each test should start with something like this, after copyright notices:
 #
 # test_description='Description of this test...
@@ -68,7 +76,8 @@ do
        -v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
                verbose=t; shift ;;
        --no-python)
-               no_python=t; shift ;;
+               # noop now...
+               shift ;;
        *)
                break ;;
        esac
@@ -121,12 +130,13 @@ test_expect_failure () {
        error "bug in the test script: not 2 parameters to test-expect-failure"
        say >&3 "expecting failure: $2"
        test_run_ "$2"
-       if [ "$?" = 0 -a "$eval_ret" != 0 ]
+       if [ "$?" = 0 -a "$eval_ret" != 0 -a "$eval_ret" -lt 129 ]
        then
                test_ok_ "$1"
        else
                test_failure_ "$@"
        fi
+       echo >&3 ""
 }
 
 test_expect_success () {
@@ -140,6 +150,7 @@ test_expect_success () {
        else
                test_failure_ "$@"
        fi
+       echo >&3 ""
 }
 
 test_expect_code () {
@@ -153,6 +164,7 @@ test_expect_code () {
        else
                test_failure_ "$@"
        fi
+       echo >&3 ""
 }
 
 # Most tests can use the created repository, but some amy need to create more.
@@ -196,20 +208,12 @@ test_done () {
 # t/ subdirectory and are run in trash subdirectory.
 PATH=$(pwd)/..:$PATH
 GIT_EXEC_PATH=$(pwd)/..
-export PATH GIT_EXEC_PATH
-
-# Similarly use ../compat/subprocess.py if our python does not
-# have subprocess.py on its own.
-PYTHON=`sed -e '1{
-       s/^#!//
-       q
-}' ../git-merge-recursive` || {
-       error "You haven't built things yet, have you?"
-}
-"$PYTHON" -c 'import subprocess' 2>/dev/null || {
-       PYTHONPATH=$(pwd)/../compat
-       export PYTHONPATH
-}
+GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
+HOME=$(pwd)/trash
+export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR HOME
+
+GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git
+export GITPERLLIB
 test -d ../templates/blt || {
        error "You haven't built things yet, have you?"
 }