[PATCH 12/12] t: detect errors outside of test cases
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Apr 13, 2026, 09:49 UTC
- Message-ID
- <20260413-b4-pks-tests-with-set-e-v1-12-5b83763a0e84@pks.im>
- In-Reply-To
- <20260413-b4-pks-tests-with-set-e-v1-0-5b83763a0e84@pks.im>
We have recently merged a patch series that had a simple misspelling of `test_expect_success`. Instead of making our tests fail though, this typo went completely undetected and all of our tests passed, which is of course unfortunate. This is a more general issue with our test suite: all commands that run outside of a specific test case can fail, and if we don't explicitly check for such failure then this failure will be silently ignored.
Improve the status quo by enabling the errexit option so that any such unchecked failures will cause us to abort immediately.
Signed-off-by: Patrick Steinhardt <ps@pks.im> --- t/test-lib.sh | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/t/test-lib.sh b/t/test-lib.sh index 81380fe978..c493e3c768 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -15,6 +15,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see https://www.gnu.org/licenses/ . +# Enable the use of errexit so that any unexpected failures will cause us to +# abort tests, even when outside of a specific test case. +set -e + # Test the binaries we have just built. The tests are kept in # t/ subdirectory and are run in 'trash directory' subdirectory. if test -z "$TEST_DIRECTORY"
-- 2.54.0.rc0.707.g0fbf48f4d6.dirty