diff options
author | Richard Levitte <levitte@openssl.org> | 2020-06-05 17:04:33 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-06-06 19:18:30 +0200 |
commit | 66d8bd4b37c759e2db51324f5614438bf3db1dbd (patch) | |
tree | a15ccc86593e47a7ed3180b57dfe04abf489c3a6 /test/testutil/driver.c | |
parent | 8dce4aa2d974fa357bb3f7d8a77e581d487de732 (diff) |
TESTUTIL: Adjust the rest of testutil
Fixes #12054
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12057)
Diffstat (limited to 'test/testutil/driver.c')
-rw-r--r-- | test/testutil/driver.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/test/testutil/driver.c b/test/testutil/driver.c index 030fb1544c..775e3daf55 100644 --- a/test/testutil/driver.c +++ b/test/testutil/driver.c @@ -76,11 +76,6 @@ void add_all_tests(const char *test_case_name, int(*test_fn)(int idx), num_test_cases += num; } -int subtest_level(void) -{ - return level; -} - static int gcd(int a, int b) { while (b != 0) { @@ -96,7 +91,7 @@ static void set_seed(int s) seed = s; if (seed <= 0) seed = (int)time(NULL); - test_printf_stdout("%*s# RAND SEED %d\n", subtest_level(), "", seed); + test_printf_stdout("RAND SEED %d\n", seed); test_flush_stdout(); test_random_seed(seed); } @@ -109,6 +104,7 @@ int setup_test_framework(int argc, char *argv[]) if (TAP_levels != NULL) level = 4 * atoi(TAP_levels); + test_adjust_streams_tap_level(level); if (test_seed != NULL) set_seed(atoi(test_seed)); @@ -214,6 +210,7 @@ static int process_shared_options(void) if (!opt_int(opt_arg(), &value)) goto end; level = 4 * value; + test_adjust_streams_tap_level(level); break; case OPT_TEST_SEED: if (!opt_int(opt_arg(), &value)) @@ -260,13 +257,13 @@ PRINTF_FORMAT(2, 3) static void test_verdict(int verdict, test_flush_stdout(); test_flush_stderr(); - test_printf_stdout("%*s%s ", level, "", verdict != 0 ? "ok" : "not ok"); + test_printf_tapout("%s ", verdict != 0 ? "ok" : "not ok"); va_start(ap, description); - test_vprintf_stdout(description, ap); + test_vprintf_tapout(description, ap); va_end(ap); if (verdict == TEST_SKIP_CODE) - test_printf_stdout(" # skipped"); - test_printf_stdout("\n"); + test_printf_tapout(" # skipped"); + test_printf_tapout("\n"); test_flush_stdout(); } @@ -284,12 +281,11 @@ int run_tests(const char *test_prog_name) return EXIT_FAILURE; if (num_tests < 1) { - test_printf_stdout("%*s1..0 # Skipped: %s\n", level, "", - test_prog_name); + test_printf_tapout("1..0 # Skipped: %s\n", test_prog_name); } else if (show_list == 0 && single_test == -1) { if (level > 0) - test_printf_stdout("%*s# Subtest: %s\n", level, "", test_prog_name); - test_printf_stdout("%*s1..%d\n", level, "", num_tests); + test_printf_stdout("Subtest: %s\n", test_prog_name); + test_printf_tapout("1..%d\n", num_tests); } test_flush_stdout(); @@ -312,11 +308,11 @@ int run_tests(const char *test_prog_name) } else if (show_list) { if (all_tests[i].num != -1) { - test_printf_stdout("%d - %s (%d..%d)\n", ii + 1, + test_printf_tapout("%d - %s (%d..%d)\n", ii + 1, all_tests[i].test_case_name, 1, all_tests[i].num); } else { - test_printf_stdout("%d - %s\n", ii + 1, + test_printf_tapout("%d - %s\n", ii + 1, all_tests[i].test_case_name); } test_flush_stdout(); @@ -332,11 +328,11 @@ int run_tests(const char *test_prog_name) verdict = TEST_SKIP_CODE; level += 4; + test_adjust_streams_tap_level(level); if (all_tests[i].subtest && single_iter == -1) { - test_printf_stdout("%*s# Subtest: %s\n", level, "", + test_printf_stdout("Subtest: %s\n", all_tests[i].test_case_name); - test_printf_stdout("%*s%d..%d\n", level, "", 1, - all_tests[i].num); + test_printf_tapout("%d..%d\n", 1, all_tests[i].num); test_flush_stdout(); } @@ -375,6 +371,7 @@ int run_tests(const char *test_prog_name) } level -= 4; + test_adjust_streams_tap_level(level); if (verdict == 0) ++num_failed; test_verdict(verdict, "%d - %s", ii + 1, |