Skip to content

Commit

Permalink
tests: clear error queue before executing a testcase
Browse files Browse the repository at this point in the history
There can be errors in the queue from previous tests and
we look at it to verify we do not add spurious errors in
some testcases.

Fixes #19477

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from #19483)

(cherry picked from commit 4bae06d)
  • Loading branch information
t8m committed Oct 27, 2022
1 parent c8c678e commit d8eb0e1
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 6 deletions.
2 changes: 0 additions & 2 deletions test/cmsapitest.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,6 @@ static int test_d2i_CMS_decode(const int idx)
long buf_len = 0;
int ret = 0;

ERR_clear_error();

if (!TEST_ptr(bio = BIO_new_file(derin, "r")))
goto end;

Expand Down
2 changes: 0 additions & 2 deletions test/recordlentest.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ static int test_record_overflow(int idx)
return 1;
#endif

ERR_clear_error();

if (!TEST_true(create_ssl_ctx_pair(NULL, TLS_server_method(),
TLS_client_method(),
TLS1_VERSION, 0,
Expand Down
2 changes: 0 additions & 2 deletions test/sslcorrupttest.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ static int test_ssl_corrupt(int testidx)

docorrupt = 0;

ERR_clear_error();

TEST_info("Starting #%d, %s", testidx, cipher_list[testidx]);

if (!TEST_true(create_ssl_ctx_pair(NULL, TLS_server_method(),
Expand Down
2 changes: 2 additions & 0 deletions test/testutil/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ int run_tests(const char *test_prog_name)
test_flush_tapout();
} else if (all_tests[i].num == -1) {
set_test_title(all_tests[i].test_case_name);
ERR_clear_error();
verdict = all_tests[i].test_fn();
finalize(verdict != 0);
test_verdict(verdict, "%d - %s", test_case_count + 1, test_title);
Expand Down Expand Up @@ -365,6 +366,7 @@ int run_tests(const char *test_prog_name)
j = (j + jstep) % all_tests[i].num;
if (single_iter != -1 && ((jj + 1) != single_iter))
continue;
ERR_clear_error();
v = all_tests[i].param_test_fn(j);

if (v == 0) {
Expand Down

0 comments on commit d8eb0e1

Please sign in to comment.