Merge branch 'ph/rebase-i-redo'
[gitweb.git] / t / test-lib.sh
index 9914d3e1cfe20f09b47fdc02896dc18ed0f61e45..39da9c2d9950848cf97686656d80f0f7ad5e3548 100644 (file)
@@ -229,6 +229,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
@@ -522,6 +528,16 @@ test_eval_ () {
 test_run_ () {
        test_cleanup=:
        expecting_failure=$2
+
+       if test "${GIT_TEST_CHAIN_LINT:-1}" != 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=$?