mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 01:18:00 +00:00
Run test_lineedit and test_terminal in the main build.
These seem likely to carry on being useful, so let's make sure they pass before allowing any build to complete successfully. I've added code to both test programs to return a sensible exit status indicating pass/fail, and added runs of both to Buildscr.
This commit is contained in:
parent
ed5bf9b3b8
commit
259de04636
2
Buildscr
2
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 -
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user