]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/test-lib.sh
Merge branch 'sg/test-bash-version-fix'
[thirdparty/git.git] / t / test-lib.sh
index 6c6c0af7a128ea7f35fb1753ed39c073208976ea..c34831a4deab4cc76916ff8fbafec531607760b5 100644 (file)
@@ -323,12 +323,12 @@ do
                # this test is marked as such, and ignore '-x' if it
                # isn't executed with a suitable Bash version.
                if test -z "$test_untraceable" || {
-                    test -n "$BASH_VERSION" && {
+                    test -n "$BASH_VERSION" && eval '
                       test ${BASH_VERSINFO[0]} -gt 4 || {
                         test ${BASH_VERSINFO[0]} -eq 4 &&
                         test ${BASH_VERSINFO[1]} -ge 1
                       }
-                    }
+                    '
                   }
                then
                        trace=t
@@ -402,6 +402,10 @@ error () {
        exit 1
 }
 
+BUG () {
+       error >&7 "bug in the test script: $*"
+}
+
 say () {
        say_color info "$*"
 }
@@ -729,7 +733,7 @@ test_run_ () {
                if $(printf '%s\n' "$1" | sed -f "$GIT_BUILD_DIR/t/chainlint.sed" | grep -q '?![A-Z][A-Z]*?!') ||
                        test "OK-117" != "$(test_eval_ "(exit 117) && $1${LF}${LF}echo OK-\$?" 3>&1)"
                then
-                       error "bug in the test script: broken &&-chain or run-away HERE-DOC: $1"
+                       BUG "broken &&-chain or run-away HERE-DOC: $1"
                fi
                trace=$trace_tmp
        fi
@@ -1231,7 +1235,7 @@ test_lazy_prereq SANITY '
        chmod -w SANETESTD.1 &&
        chmod -r SANETESTD.1/x &&
        chmod -rx SANETESTD.2 ||
-       error "bug in test sript: cannot prepare SANETESTD"
+       BUG "cannot prepare SANETESTD"
 
        ! test -r SANETESTD.1/x &&
        ! rm SANETESTD.1/x && ! test -f SANETESTD.2/x
@@ -1239,7 +1243,7 @@ test_lazy_prereq SANITY '
 
        chmod +rwx SANETESTD.1 SANETESTD.2 &&
        rm -rf SANETESTD.1 SANETESTD.2 ||
-       error "bug in test sript: cannot clean SANETESTD"
+       BUG "cannot clean SANETESTD"
        return $status
 '