t7004: fix embedded single-quotes
[gitweb.git] / t / test-lib.sh
index c09677802cce067a946a2550cdd2d8ef33434e81..50b3d3f45dde25b63d1bff636056565be70a17ba 100644 (file)
@@ -232,6 +232,12 @@ do
        --root=*)
                root=$(expr "z$1" : 'z[^=]*=\(.*\)')
                shift ;;
+       --chain-lint)
+               GIT_TEST_CHAIN_LINT=1
+               shift ;;
+       --no-chain-lint)
+               GIT_TEST_CHAIN_LINT=0
+               shift ;;
        -x)
                trace=t
                verbose=t
@@ -524,6 +530,16 @@ test_eval_ () {
 test_run_ () {
        test_cleanup=:
        expecting_failure=$2
+
+       if test "${GIT_TEST_CHAIN_LINT:-0}" != 0; then
+               # 117 is magic because it is unlikely to match the exit
+               # code of other programs
+               test_eval_ "(exit 117) && $1"
+               if test "$?" != 117; then
+                       error "bug in the test script: broken &&-chain: $1"
+               fi
+       fi
+
        setup_malloc_check
        test_eval_ "$1"
        eval_ret=$?