1
0
mirror of https://github.com/sstephenson/bats.git synced 2024-09-30 04:58:36 +02:00
bats/libexec
Mike Bland 0f6dde530e
exec-test: Work around Bash 3.2.57 ERR trap bug
When running under Bash 3.2.57(1)-release on macOS, the following tests
would fail because `BATS_ERROR_STACK_TRACE` would be empty, and hence no
information about the actual error would get printed:

- one failing test
- failing test with significant status
- failing test file outside of BATS_CWD

This is because each of these cases use `FIXTURE_ROOT/failing.bats`, and
the `ERR` trap would not fire for its `eval "( exit ${STATUS:-1} )"`
line. Changing it to `exit ${STATUS:-1}` produced the same effect, and
changing it to `return ${STATUS:-1}` would cause the output to point to
the previous line, which executes `true`.

However, the correct status would be reported to the `EXIT` trap, so now
we call `bats_error_trap` at the very beginning of `bats_teardown_trap`.

All the existing tests now pass under Bash 3.2.57(1)-release, Bash
4.2.25(1)-release (the version from the default Ubuntu 12.04.5/Precise
image on Travis CI), and Bash 4.4.12(1)-release.
2017-09-30 14:58:10 -04:00
..
bats Updating paths #5 2017-09-24 10:26:25 -07:00
bats-exec-suite
bats-exec-test exec-test: Work around Bash 3.2.57 ERR trap bug 2017-09-30 14:58:10 -04:00
bats-format-tap-stream
bats-preprocess