Skip to content

Commit 3bc33df

Browse files
committed
t: detect errors outside of test cases
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 <[email protected]>
1 parent 89a3dbf commit 3bc33df

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

t/test-lib.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
# You should have received a copy of the GNU General Public License
1616
# along with this program. If not, see https://www.gnu.org/licenses/ .
1717

18+
# Enable the use of errexit so that any unexpected failures will cause us to
19+
# abort tests, even when outside of a specific test case.
20+
set -e
21+
1822
# Test the binaries we have just built. The tests are kept in
1923
# t/ subdirectory and are run in 'trash directory' subdirectory.
2024
if test -z "$TEST_DIRECTORY"

0 commit comments

Comments
 (0)