mbox series

[0/6] tests: add a bash "set -o pipefail" test mode

Message ID 20210114233515.31298-1-avarab@gmail.com (mailing list archive)
Headers show
Series tests: add a bash "set -o pipefail" test mode | expand

Message

Ævar Arnfjörð Bjarmason Jan. 14, 2021, 11:35 p.m. UTC
There's been past attempts to add a "set -o pipefail" test mode. I
suspect it can't be done in any sane way the way it works in bash
now. See 6/6 for details.

This series makes it work because I patched it to work sanely in bash
itself when it comes to SIGPIPE. I'm partially submitting this so I
can prod the bash maintainer with a link to this thread.

But also because even though you need to patch your bash to benefit
from this new test mode, it doesn't break anything for anyone who
doesn't have the patch (we guard it with a detection for the sane
behavior), and at the very least 4/6 (or maybe just to 2/6) are
generally sane fixes even without the rest.

1. https://lore.kernel.org/git/cover.1573779465.git.liu.denton@gmail.com/

Ævar Arnfjörð Bjarmason (6):
  test-lib: add tests for test_might_fail
  test-lib: add ok=* support to test_might_fail
  test_lib: allow test_{must,might}_fail to accept non-git on "sigpipe"
  tests: use "test_might_fail ok=sigpipe grep" when appropriate
  tests: split up bash detection library
  tests: add a "set -o pipefail" for a patched bash

 t/README                           |  6 +++++
 t/lib-bash-detection.sh            |  8 +++++++
 t/lib-bash.sh                      |  4 +++-
 t/t0000-basic.sh                   | 38 ++++++++++++++++++++++++++++++
 t/t0005-signals.sh                 |  4 ++--
 t/t0090-cache-tree.sh              |  2 +-
 t/t5000-tar-tree.sh                |  2 +-
 t/t5703-upload-pack-ref-in-want.sh |  2 +-
 t/t9151-svn-mergeinfo.sh           |  6 ++---
 t/t9902-completion.sh              |  5 ++++
 t/test-lib-functions.sh            | 24 ++++++++++++++++++-
 t/test-lib.sh                      | 29 +++++++++++++++++++++++
 12 files changed, 120 insertions(+), 10 deletions(-)
 create mode 100644 t/lib-bash-detection.sh