diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2017-01-05 15:47:06 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2017-01-05 15:58:11 +0000 |
commit | c660afba5804763cdd59811bac1915a8f2fd0904 (patch) | |
tree | fa35195512d9ae1631afad8f55aaab547c8d589b /tests | |
parent | 6cbd45af603bc976c8334f839cebefbad2b3a622 (diff) |
test suite: Do not tolerate any stderr output from git-fsck
We must tolerate
notice: HEAD points to an unborn branch (master)
notice: No default references
which are generated by some of our existing test cases and are pretty
much harmless.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib | 27 |
1 files changed, 25 insertions, 2 deletions
@@ -350,11 +350,34 @@ t-git-dir-check () { } t-expect-fsck-fail () { - expect_fsck_fail+=" $1" + echo >>$tmp/fsck.expected-errors "$1" } t-git-fsck () { - git fsck --no-dangling --strict || ${expect_fsck_fail:+true} false + set +e + LC_MESSAGES=C git fsck --no-dangling --strict 2>&1 \ + | tee dgit-test-fsck.errs + ps="${PIPESTATUS[*]}" + set -e + + local pats + if [ -f $tmp/fsck.expected-errors ]; then + pats=(-w -f $tmp/fsck.expected-errors) + else + test "$ps" = "0 0" + fi + pats+=(-e 'notice: HEAD points to an unborn branch') + pats+=(-e 'notice: No default references') + + set +e + grep -v "${pats[@]}" dgit-test-fsck.errs + rc=$? + set -e + case $rc in + 1) ;; # no unexpected errors + 0) fail "unexpected messages from git-fsck" ;; + *) fail "grep of git-fsck failed" ;; + esac } t-fscks () { |