提交 7531b3a6 编写于 作者: R Richard Levitte

Tapify libtestutil a bit better

This includes better signals of skips and subtests according to TAP 12,
and flushing stdout and stderr at the end of every test function to
make sure we get the output in good order.
Reviewed-by: NRich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3309)
上级 4114f8f0
...@@ -138,13 +138,23 @@ int run_tests(const char *test_prog_name) ...@@ -138,13 +138,23 @@ int run_tests(const char *test_prog_name)
char *verdict = NULL; char *verdict = NULL;
int i, j; int i, j;
helper_printf_stdout("%*s%d..%d\n", level, "", 1, num_tests); if (num_tests < 1)
helper_printf_stdout("%*s1..0 # Skipped: %s\n", level, "",
test_prog_name);
else if (level > 0)
helper_printf_stdout("%*s1..%d # Subtest: %s\n", level, "", num_tests,
test_prog_name);
else
helper_printf_stdout("%*s1..%d\n", level, "", num_tests);
test_flush_stdout(); test_flush_stdout();
for (i = 0; i != num_tests; ++i) { for (i = 0; i != num_tests; ++i) {
if (all_tests[i].num == -1) { if (all_tests[i].num == -1) {
int ret = all_tests[i].test_fn(); int ret = all_tests[i].test_fn();
test_flush_stdout();
test_flush_stderr();
verdict = "ok"; verdict = "ok";
if (!ret) { if (!ret) {
verdict = "not ok"; verdict = "not ok";
...@@ -169,6 +179,9 @@ int run_tests(const char *test_prog_name) ...@@ -169,6 +179,9 @@ int run_tests(const char *test_prog_name)
for (j = 0; j < all_tests[i].num; j++) { for (j = 0; j < all_tests[i].num; j++) {
int ret = all_tests[i].param_test_fn(j); int ret = all_tests[i].param_test_fn(j);
test_flush_stdout();
test_flush_stderr();
if (!ret) if (!ret)
++num_failed_inner; ++num_failed_inner;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册