Merge branch 'jk/test-chain-lint'
authorJunio C Hamano <gitster@pobox.com>
Thu, 26 Mar 2015 18:57:13 +0000 (11:57 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 26 Mar 2015 18:57:14 +0000 (11:57 -0700)
People often forget to chain the commands in their test together
with &&, leaving a failure from an earlier command in the test go
unnoticed. The new GIT_TEST_CHAIN_LINT mechanism allows you to
catch such a mistake more easily.

* jk/test-chain-lint: (36 commits)
t9001: drop save_confirm helper
t0020: use test_* helpers instead of hand-rolled messages
t: simplify loop exit-code status variables
t: fix some trivial cases of ignored exit codes in loops
t7701: fix ignored exit code inside loop
t3305: fix ignored exit code inside loop
t0020: fix ignored exit code inside loops
perf-lib: fix ignored exit code inside loop
t6039: fix broken && chain
t9158, t9161: fix broken &&-chain in git-svn tests
t9104: fix test for following larger parents
t4104: drop hand-rolled error reporting
t0005: fix broken &&-chains
t7004: fix embedded single-quotes
t0050: appease --chain-lint
t9001: use test_when_finished
t4117: use modern test_* helpers
t6034: use modern test_* helpers
t1301: use modern test_* helpers
t0020: use modern test_* helpers
...

1  2 
t/t1700-split-index.sh
t/t4052-stat-output.sh
t/t4202-log.sh
t/t5541-http-push-smart.sh
t/t5551-http-fetch-smart.sh
t/t6000-rev-list-misc.sh
t/t7004-tag.sh
t/t7510-signed-commit.sh
t/t9903-bash-prompt.sh
t/test-lib.sh
diff --combined t/t1700-split-index.sh
index 92f7298fba625fc56c1f8f6df2088ba4cc1a771a,a55f5bc0a1b566b7467a728804150f702fe09d96..193d55c3f4486ce3515b261df0c7edf9b3e3fcbb
@@@ -10,18 -10,9 +10,18 @@@ sane_unset GIT_TEST_SPLIT_INDE
  test_expect_success 'enable split index' '
        git update-index --split-index &&
        test-dump-split-index .git/index >actual &&
 +      indexversion=$(test-index-version <.git/index) &&
 +      if test "$indexversion" = "4"
 +      then
 +              own=432ef4b63f32193984f339431fd50ca796493569
 +              base=508851a7f0dfa8691e9f69c7f055865389012491
 +      else
 +              own=8299b0bcd1ac364e5f1d7768efb62fa2da79a339
 +              base=39d890139ee5356c7ef572216cebcd27aa41f9df
 +      fi &&
        cat >expect <<EOF &&
 -own 8299b0bcd1ac364e5f1d7768efb62fa2da79a339
 -base 39d890139ee5356c7ef572216cebcd27aa41f9df
 +own $own
 +base $base
  replacements:
  deletions:
  EOF
@@@ -39,7 -30,7 +39,7 @@@ EO
  
        test-dump-split-index .git/index | sed "/^own/d" >actual &&
        cat >expect <<EOF &&
 -base 39d890139ee5356c7ef572216cebcd27aa41f9df
 +base $base
  100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0     one
  replacements:
  deletions:
@@@ -191,7 -182,7 +191,7 @@@ test_expect_success 'unify index, two f
  100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0     one
  100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0     two
  EOF
-       test_cmp ls-files.expect ls-files.actual
+       test_cmp ls-files.expect ls-files.actual &&
  
        test-dump-split-index .git/index | sed "/^own/d" >actual &&
        cat >expect <<EOF &&
diff --combined t/t4052-stat-output.sh
index babd2ead88182e7b212486d0ae753f51d5deac76,4a02b17fc8528975b7dc626e153903f67a583da7..9f563db20a867156a825dfc0ce810c4f59109ac8
@@@ -94,15 -94,15 +94,15 @@@ EO
  while read verb expect cmd args
  do
        test_expect_success "$cmd $verb COLUMNS (big change)" '
-               COLUMNS=200 git $cmd $args >output
+               COLUMNS=200 git $cmd $args >output &&
                grep " | " output >actual &&
                test_cmp "$expect" actual
        '
  
 -      test "$cmd" != diff || continue
 +      case "$cmd" in diff|show) continue;; esac
  
        test_expect_success "$cmd --graph $verb COLUMNS (big change)" '
-               COLUMNS=200 git $cmd $args --graph >output
+               COLUMNS=200 git $cmd $args --graph >output &&
                grep " | " output >actual &&
                test_cmp "$expect-graph" actual
        '
@@@ -122,15 -122,15 +122,15 @@@ EO
  while read verb expect cmd args
  do
        test_expect_success "$cmd $verb not enough COLUMNS (big change)" '
-               COLUMNS=40 git $cmd $args >output
+               COLUMNS=40 git $cmd $args >output &&
                grep " | " output >actual &&
                test_cmp "$expect" actual
        '
  
 -      test "$cmd" != diff || continue
 +      case "$cmd" in diff|show) continue;; esac
  
        test_expect_success "$cmd --graph $verb not enough COLUMNS (big change)" '
-               COLUMNS=40 git $cmd $args --graph >output
+               COLUMNS=40 git $cmd $args --graph >output &&
                grep " | " output >actual &&
                test_cmp "$expect-graph" actual
        '
@@@ -150,15 -150,15 +150,15 @@@ EO
  while read verb expect cmd args
  do
        test_expect_success "$cmd $verb statGraphWidth config" '
-               git -c diff.statGraphWidth=26 $cmd $args >output
+               git -c diff.statGraphWidth=26 $cmd $args >output &&
                grep " | " output >actual &&
                test_cmp "$expect" actual
        '
  
 -      test "$cmd" != diff || continue
 +      case "$cmd" in diff|show) continue;; esac
  
        test_expect_success "$cmd --graph $verb statGraphWidth config" '
-               git -c diff.statGraphWidth=26 $cmd $args --graph >output
+               git -c diff.statGraphWidth=26 $cmd $args --graph >output &&
                grep " | " output >actual &&
                test_cmp "$expect-graph" actual
        '
@@@ -179,33 -179,33 +179,33 @@@ EO
  while read cmd args
  do
        test_expect_success "$cmd --stat=width with big change" '
-               git $cmd $args --stat=40 >output
+               git $cmd $args --stat=40 >output &&
                grep " | " output >actual &&
                test_cmp expect actual
        '
  
        test_expect_success "$cmd --stat-width=width with big change" '
-               git $cmd $args --stat-width=40 >output
+               git $cmd $args --stat-width=40 >output &&
                grep " | " output >actual &&
                test_cmp expect actual
        '
  
        test_expect_success "$cmd --stat-graph-width with big change" '
-               git $cmd $args --stat-graph-width=26 >output
+               git $cmd $args --stat-graph-width=26 >output &&
                grep " | " output >actual &&
                test_cmp expect actual
        '
  
 -      test "$cmd" != diff || continue
 +      case "$cmd" in diff|show) continue;; esac
  
        test_expect_success "$cmd --stat-width=width --graph with big change" '
-               git $cmd $args --stat-width=40 --graph >output
+               git $cmd $args --stat-width=40 --graph >output &&
                grep " | " output >actual &&
                test_cmp expect-graph actual
        '
  
        test_expect_success "$cmd --stat-graph-width --graph with big change" '
-               git $cmd $args --stat-graph-width=26 --graph >output
+               git $cmd $args --stat-graph-width=26 --graph >output &&
                grep " | " output >actual &&
                test_cmp expect-graph actual
        '
@@@ -236,7 -236,7 +236,7 @@@ d
                test_cmp expect actual
        '
  
 -      test "$cmd" != diff || continue
 +      case "$cmd" in diff|show) continue;; esac
  
        test_expect_success "$cmd --stat=width --graph with big change is balanced" '
                git $cmd $args --stat-width=60 --graph >output &&
@@@ -265,15 -265,15 +265,15 @@@ EO
  while read verb expect cmd args
  do
        test_expect_success "$cmd $verb COLUMNS (long filename)" '
-               COLUMNS=200 git $cmd $args >output
+               COLUMNS=200 git $cmd $args >output &&
                grep " | " output >actual &&
                test_cmp "$expect" actual
        '
  
 -      test "$cmd" != diff || continue
 +      case "$cmd" in diff|show) continue;; esac
  
        test_expect_success "$cmd --graph $verb COLUMNS (long filename)" '
-               COLUMNS=200 git $cmd $args --graph >output
+               COLUMNS=200 git $cmd $args --graph >output &&
                grep " | " output >actual &&
                test_cmp "$expect-graph" actual
        '
@@@ -294,16 -294,16 +294,16 @@@ while read verb expect cmd arg
  do
        test_expect_success COLUMNS_CAN_BE_1 \
                "$cmd $verb prefix greater than COLUMNS (big change)" '
-               COLUMNS=1 git $cmd $args >output
+               COLUMNS=1 git $cmd $args >output &&
                grep " | " output >actual &&
                test_cmp "$expect" actual
        '
  
 -      test "$cmd" != diff || continue
 +      case "$cmd" in diff|show) continue;; esac
  
        test_expect_success COLUMNS_CAN_BE_1 \
                "$cmd --graph $verb prefix greater than COLUMNS (big change)" '
-               COLUMNS=1 git $cmd $args --graph >output
+               COLUMNS=1 git $cmd $args --graph >output &&
                grep " | " output >actual &&
                test_cmp "$expect-graph" actual
        '
@@@ -320,7 -320,7 +320,7 @@@ EO
  test_expect_success 'merge --stat respects COLUMNS (big change)' '
        git checkout -b branch HEAD^^ &&
        COLUMNS=100 git merge --stat --no-ff master^ >output &&
-       grep " | " output >actual
+       grep " | " output >actual &&
        test_cmp expect actual
  '
  
@@@ -329,7 -329,7 +329,7 @@@ cat >expect <<'EOF
  EOF
  test_expect_success 'merge --stat respects COLUMNS (long filename)' '
        COLUMNS=100 git merge --stat --no-ff master >output &&
-       grep " | " output >actual
+       grep " | " output >actual &&
        test_cmp expect actual
  '
  
diff --combined t/t4202-log.sh
index f111705e704ad064409d6354aec78696bf325f5d,85230a87b4d5a22c499b3af5e5b967f02c7423f6..1b2e981a0011d520d1a7d8bb8d0a5fd7892bacc4
@@@ -113,11 -113,7 +113,7 @@@ test_expect_success 'diff-filter=M' 
  
        actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) &&
        expect=$(echo second) &&
-       test "$actual" = "$expect" || {
-               echo Oops
-               echo "Actual: $actual"
-               false
-       }
+       verbose test "$actual" = "$expect"
  
  '
  
@@@ -125,11 -121,7 +121,7 @@@ test_expect_success 'diff-filter=D' 
  
        actual=$(git log --pretty="format:%s" --diff-filter=D HEAD) &&
        expect=$(echo sixth ; echo third) &&
-       test "$actual" = "$expect" || {
-               echo Oops
-               echo "Actual: $actual"
-               false
-       }
+       verbose test "$actual" = "$expect"
  
  '
  
@@@ -137,11 -129,7 +129,7 @@@ test_expect_success 'diff-filter=R' 
  
        actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) &&
        expect=$(echo third) &&
-       test "$actual" = "$expect" || {
-               echo Oops
-               echo "Actual: $actual"
-               false
-       }
+       verbose test "$actual" = "$expect"
  
  '
  
@@@ -149,11 -137,7 +137,7 @@@ test_expect_success 'diff-filter=C' 
  
        actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) &&
        expect=$(echo fourth) &&
-       test "$actual" = "$expect" || {
-               echo Oops
-               echo "Actual: $actual"
-               false
-       }
+       verbose test "$actual" = "$expect"
  
  '
  
@@@ -161,11 -145,7 +145,7 @@@ test_expect_success 'git log --follow' 
  
        actual=$(git log --follow --pretty="format:%s" ichi) &&
        expect=$(echo third ; echo second ; echo initial) &&
-       test "$actual" = "$expect" || {
-               echo Oops
-               echo "Actual: $actual"
-               false
-       }
+       verbose test "$actual" = "$expect"
  
  '
  
@@@ -481,7 -461,7 +461,7 @@@ test_expect_success 'log.decorate confi
        git log --oneline --no-decorate >actual &&
        test_cmp expect.none actual &&
        git log --oneline --decorate >actual &&
-       test_cmp expect.short actual
+       test_cmp expect.short actual &&
  
        test_unconfig log.decorate &&
        git log --pretty=raw >expect.raw &&
@@@ -887,8 -867,4 +867,8 @@@ test_expect_success GPG 'log --graph --
        grep "^| | gpg: Good signature" actual
  '
  
 +test_expect_success 'log --graph --no-walk is forbidden' '
 +      test_must_fail git log --graph --no-walk
 +'
 +
  test_done
index 1ecb5881acf720e7c0dc8b885750f6e641764591,47cee537c7a9699611b0eb4842936957029a83e4..9cf27e8c9924770b619b8e21fb22b5225e5f085f
@@@ -158,7 -158,7 +158,7 @@@ test_http_push_nonff "$HTTPD_DOCUMENT_R
  test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper' '
        # create a dissimilarly-named remote ref so that git is unable to match the
        # two refs (viz. local, remote) unless an explicit refspec is provided.
-       git push origin master:retsam
+       git push origin master:retsam &&
  
        echo "change changed" > path2 &&
        git commit -a -m path2 --amend &&
@@@ -324,6 -324,12 +324,6 @@@ test_expect_success 'push into half-aut
        test_cmp expect actual
  '
  
 -run_with_limited_cmdline () {
 -      (ulimit -s 128 && "$@")
 -}
 -
 -test_lazy_prereq CMDLINE_LIMIT 'run_with_limited_cmdline true'
 -
  test_expect_success CMDLINE_LIMIT 'push 2000 tags over http' '
        sha1=$(git rev-parse HEAD) &&
        test_seq 2000 |
index df47851752f6b9b085d0feab8d6ba24ef2d0da29,cf0a6ea538949e8fe1c11a7237b241284481030a..66439e58fcf4b08a43ef417b054ae476ffbe3aea
@@@ -83,7 -83,7 +83,7 @@@ test_expect_success 'clone http reposit
  test_expect_success 'fetch changes via http' '
        echo content >>file &&
        git commit -a -m two &&
-       git push public
+       git push public &&
        (cd clone && git pull) &&
        test_cmp file clone/file
  '
@@@ -169,7 -169,7 +169,7 @@@ test_expect_success 'GIT_SMART_HTTP ca
  '
  
  test_expect_success 'invalid Content-Type rejected' '
-       test_must_fail git clone $HTTPD_URL/broken_smart/repo.git 2>actual
+       test_must_fail git clone $HTTPD_URL/broken_smart/repo.git 2>actual &&
        grep "not valid:" actual
  '
  
@@@ -209,25 -209,14 +209,25 @@@ test_expect_success 'cookies stored in 
        git config http.cookiefile cookies.txt &&
        git config http.savecookies true &&
        git ls-remote $HTTPD_URL/smart_cookies/repo.git master &&
-       tail -3 cookies.txt > cookies_tail.txt
+       tail -3 cookies.txt >cookies_tail.txt &&
        test_cmp expect_cookies.txt cookies_tail.txt
  '
  
 -test_expect_success EXPENSIVE 'create 50,000 tags in the repo' '
 +test_expect_success 'transfer.hiderefs works over smart-http' '
 +      test_commit hidden &&
 +      test_commit visible &&
 +      git push public HEAD^:refs/heads/a HEAD:refs/heads/b &&
 +      git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
 +              config transfer.hiderefs refs/heads/a &&
 +      git clone --bare "$HTTPD_URL/smart/repo.git" hidden.git &&
 +      test_must_fail git -C hidden.git rev-parse --verify a &&
 +      git -C hidden.git rev-parse --verify b
 +'
 +
 +test_expect_success 'create 2,000 tags in the repo' '
        (
        cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
 -      for i in `test_seq 50000`
 +      for i in $(test_seq 2000)
        do
                echo "commit refs/heads/too-many-refs"
                echo "mark :$i"
        )
  '
  
 -test_expect_success EXPENSIVE 'clone the 50,000 tag repo to check OS command line overflow' '
 -      git clone $HTTPD_URL/smart/repo.git too-many-refs &&
 +test_expect_success CMDLINE_LIMIT \
 +      'clone the 2,000 tag repo to check OS command line overflow' '
 +      run_with_limited_cmdline git clone $HTTPD_URL/smart/repo.git too-many-refs &&
        (
                cd too-many-refs &&
 -              test $(git for-each-ref refs/tags | wc -l) = 50000
 +              git for-each-ref refs/tags >actual &&
 +              test_line_count = 2000 actual
        )
  '
  
 +test_expect_success 'large fetch-pack requests can be split across POSTs' '
 +      GIT_CURL_VERBOSE=1 git -c http.postbuffer=65536 \
 +              clone --bare "$HTTPD_URL/smart/repo.git" split.git 2>err &&
 +      grep "^> POST" err >posts &&
 +      test_line_count = 2 posts
 +'
 +
  stop_httpd
  test_done
diff --combined t/t6000-rev-list-misc.sh
index 1f58b46e1f1300b7e893f16b92c40f4c2a09b014,7911ed9af6729de9263e5c958eda684a39bf3919..3e752ce03280ff694fedb6657fe2ed334127f253
@@@ -42,7 -42,7 +42,7 @@@ test_expect_success 'rev-list --object
        test_tick &&
        git commit -m that &&
  
-       ONE=$(git rev-parse HEAD:one)
+       ONE=$(git rev-parse HEAD:one) &&
        git rev-list --objects HEAD two >output &&
        grep "$ONE two/three" output &&
        ! grep one output
@@@ -85,7 -85,7 +85,7 @@@ test_expect_success 'rev-list can show 
        #   - we do not show the root tree; since we updated the index, it
        #     does not have a valid cache tree
        #
-       cat >expect <<-\EOF
+       cat >expect <<-\EOF &&
        8e4020bb5a8d8c873b25de15933e75cc0fc275df one
        d9d3a7417b9605cfd88ee6306b28dadc29e6ab08 only-in-index
        9200b628cf9dc883a85a7abc8d6e6730baee589c two
@@@ -96,8 -96,4 +96,8 @@@
        test_cmp expect actual
  '
  
 +test_expect_success '--bisect and --first-parent can not be combined' '
 +      test_must_fail git rev-list --bisect --first-parent HEAD
 +'
 +
  test_done
diff --combined t/t7004-tag.sh
index 8bfeef9b0bf6eedcd1f0b31a141efc87a37041f8,efb08c34961e3a023e6fefbff5545248a4b04123..fa207f3b8cae5397904f5fb8da2b20b67d297415
@@@ -1180,8 -1180,8 +1180,8 @@@ test_expect_success 'message in editor 
  test_expect_success \
        'message in editor has initial comment: remainder' '
        # remove commented lines from the remainder -- should be empty
-       >rest.expect
-       sed -e 1d -e '/^#/d' <actual >rest.actual &&
+       >rest.expect &&
+       sed -e 1d -e "/^#/d" <actual >rest.actual &&
        test_cmp rest.expect rest.actual
  '
  
@@@ -1459,34 -1459,6 +1459,34 @@@ test_expect_success 'invalid sort param
        test_cmp expect actual
  '
  
 +test_expect_success 'version sort with prerelease reordering' '
 +      git config --unset tag.sort &&
 +      git config versionsort.prereleaseSuffix -rc &&
 +      git tag foo1.6-rc1 &&
 +      git tag foo1.6-rc2 &&
 +      git tag -l --sort=version:refname "foo*" >actual &&
 +      cat >expect <<-\EOF &&
 +      foo1.3
 +      foo1.6-rc1
 +      foo1.6-rc2
 +      foo1.6
 +      foo1.10
 +      EOF
 +      test_cmp expect actual
 +'
 +
 +test_expect_success 'reverse version sort with prerelease reordering' '
 +      git tag -l --sort=-version:refname "foo*" >actual &&
 +      cat >expect <<-\EOF &&
 +      foo1.10
 +      foo1.6
 +      foo1.6-rc2
 +      foo1.6-rc1
 +      foo1.3
 +      EOF
 +      test_cmp expect actual
 +'
 +
  run_with_limited_stack () {
        (ulimit -s 128 && "$@")
  }
diff --combined t/t7510-signed-commit.sh
index 3cef18cfdaa587d12aafec5fe32742f0356fc501,fc1ff452833749ad727f27f4c88ab3b174421ee7..13331e533bf520b6f268df16f8a143b8661a1c72
@@@ -42,7 -42,7 +42,7 @@@ test_expect_success GPG 'create signed 
        git tag seventh-unsigned &&
  
        test_tick && git rebase -f HEAD^^ && git tag sixth-signed HEAD^ &&
-       git tag seventh-signed
+       git tag seventh-signed &&
  
        echo 8 >file && test_tick && git commit -a -m eighth -SB7227189 &&
        git tag eighth-signed-alt
@@@ -86,8 -86,8 +86,8 @@@ test_expect_success GPG 'show signed co
        git show -s --show-signature initial >show &&
        git verify-commit -v initial >verify.1 2>verify.2 &&
        git cat-file commit initial >cat &&
 -      grep -v "gpg: " show >show.commit &&
 -      grep "gpg: " show >show.gpg &&
 +      grep -v -e "gpg: " -e "Warning: " show >show.commit &&
 +      grep -e "gpg: " -e "Warning: " show >show.gpg &&
        grep -v "^ " cat | grep -v "^gpgsig " >cat.commit &&
        test_cmp show.commit commit &&
        test_cmp show.gpg verify.2 &&
diff --combined t/t9903-bash-prompt.sh
index 46d7d37a51023296033eae2e5576bb36f9c38f7b,0c6acddc1b9e6fbf155e735749cd67f21d0ebaaf..49d58e6726836194e7a716365007465056744fc5
@@@ -166,7 -166,7 +166,7 @@@ test_expect_success 'prompt - inside ba
  '
  
  test_expect_success 'prompt - interactive rebase' '
-       printf " (b1|REBASE-i 2/3)" >expected
+       printf " (b1|REBASE-i 2/3)" >expected &&
        write_script fake_editor.sh <<-\EOF &&
                echo "exec echo" >"$1"
                echo "edit $(git log -1 --format="%h")" >>"$1"
@@@ -397,17 -397,6 +397,17 @@@ test_expect_success 'prompt - untracke
        test_cmp expected "$actual"
  '
  
 +test_expect_success 'prompt - untracked files status indicator - untracked files outside cwd' '
 +      printf " (master %%)" >expected &&
 +      (
 +              mkdir -p ignored_dir &&
 +              cd ignored_dir &&
 +              GIT_PS1_SHOWUNTRACKEDFILES=y &&
 +              __git_ps1 >"$actual"
 +      ) &&
 +      test_cmp expected "$actual"
 +'
 +
  test_expect_success 'prompt - untracked files status indicator - shell variable unset with config disabled' '
        printf " (master)" >expected &&
        test_config bash.showUntrackedFiles false &&
diff --combined t/test-lib.sh
index 9914d3e1cfe20f09b47fdc02896dc18ed0f61e45,50b3d3f45dde25b63d1bff636056565be70a17ba..4ea99a209d74d7d052a880a2a69d99a65a9dd0a6
@@@ -152,7 -152,10 +152,7 @@@ unset UNZI
  
  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 ! *"
 +      GIT_TRACE=4
        ;;
  esac
  
        --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
@@@ -296,7 -305,6 +302,7 @@@ die () 
  
  GIT_EXIT_OK=
  trap 'die' EXIT
 +trap 'exit $?' INT
  
  # The user-facing functions are loaded from a separate file so that
  # test_perf subshells can have them too
@@@ -522,6 -530,16 +528,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=$?
@@@ -1062,9 -1080,3 +1078,9 @@@ test_lazy_prereq UNZIP 
        "$GIT_UNZIP" -v
        test $? -ne 127
  '
 +
 +run_with_limited_cmdline () {
 +      (ulimit -s 128 && "$@")
 +}
 +
 +test_lazy_prereq CMDLINE_LIMIT 'run_with_limited_cmdline true'