From: Junio C Hamano Date: Mon, 13 Apr 2026 17:29:26 GMT Subject: Re: [PATCH 12/12] t: detect errors outside of test cases Message-ID: In-Reply-To: <20260413-b4-pks-tests-with-set-e-v1-12-5b83763a0e84@pks.im> Patrick Steinhardt writes: > 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 > --- > 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 Yay. Very nice. > # 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"