diff --git a/Buildscr b/Buildscr index a7cb49df..bc225673 100644 --- a/Buildscr +++ b/Buildscr @@ -140,6 +140,8 @@ delegate - in putty do cmake . -DCMAKE_C_COMPILER=clang -DCMAKE_C_FLAGS="-fsanitize=address -fsanitize=leak" -DSTRICT=ON in putty do make -j$(nproc) VERBOSE=1 in putty do python3 test/cryptsuite.py +in putty do ./test_lineedit +in putty do ./test_terminal enddelegate delegate - diff --git a/test/test_lineedit.c b/test/test_lineedit.c index 488eca56..fe0be162 100644 --- a/test/test_lineedit.c +++ b/test/test_lineedit.c @@ -44,6 +44,8 @@ typedef struct Mock { strbuf *context; /* for printing in failed tests */ + bool any_test_failed; + TermWin tw; Seat seat; Backend backend; @@ -193,6 +195,7 @@ static void expect_backend(Mock *mk, const char *file, int line, printf("\", got \""); write_c_string_literal(stdout, actual); printf("\"\n"); + mk->any_test_failed = true; } } @@ -207,6 +210,7 @@ static void expect_terminal(Mock *mk, const char *file, int line, printf("\", got \""); write_c_string_literal(stdout, actual); printf("\"\n"); + mk->any_test_failed = true; } } @@ -252,6 +256,7 @@ static void expect_specials(Mock *mk, const char *file, int line, mk->specials[i].arg); } printf(" ]\n"); + mk->any_test_failed = true; } } @@ -754,6 +759,15 @@ int main(void) test_edit(mk, false); ldisc_free(ldisc); + + bool failed = mk->any_test_failed; mock_free(mk); - return 0; + + if (failed) { + printf("Test suite FAILED!\n"); + return 1; + } else { + printf("Test suite passed\n"); + return 0; + } } diff --git a/test/test_terminal.c b/test/test_terminal.c index d8bf3cb7..9fdca6cc 100644 --- a/test/test_terminal.c +++ b/test/test_terminal.c @@ -34,6 +34,8 @@ typedef struct Mock { strbuf *context; + bool any_test_failed; + TermWin tw; } Mock; @@ -118,6 +120,7 @@ static void report_fail(Mock *mk, const char *file, int line, vprintf(fmt, ap); va_end(ap); printf("\n"); + mk->any_test_failed = true; } static inline void check_iequal(Mock *mk, const char *file, int line, @@ -492,6 +495,14 @@ int main(void) test_wrap(mk); test_nonwrap(mk); + bool failed = mk->any_test_failed; mock_free(mk); - return 0; + + if (failed) { + printf("Test suite FAILED!\n"); + return 1; + } else { + printf("Test suite passed\n"); + return 0; + } }