summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2022-10-24 12:28:58 +0200
committerTomas Mraz <tomas@openssl.org>2022-10-27 18:36:44 +0200
commit4bae06d47ae26b37a948d31f11884e1813f6d669 (patch)
tree5ba3ea58d39ba98fee6b2ed884e7a1624d3f3c19 /test
parente6623693597429dc7d2506a2385bbf4bff15c0a8 (diff)
tests: clear error queue before executing a testcase
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 https://github.com/openssl/openssl/pull/19483)
Diffstat (limited to 'test')
-rw-r--r--test/cmsapitest.c2
-rw-r--r--test/recordlentest.c2
-rw-r--r--test/sslcorrupttest.c2
-rw-r--r--test/testutil/driver.c2
4 files changed, 2 insertions, 6 deletions
diff --git a/test/cmsapitest.c b/test/cmsapitest.c
index a19fb0683c..d5c4cb8481 100644
--- a/test/cmsapitest.c
+++ b/test/cmsapitest.c
@@ -327,8 +327,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;
diff --git a/test/recordlentest.c b/test/recordlentest.c
index 8567964ce1..c693b08913 100644
--- a/test/recordlentest.c
+++ b/test/recordlentest.c
@@ -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,
diff --git a/test/sslcorrupttest.c b/test/sslcorrupttest.c
index d270d42351..11a0e5fdeb 100644
--- a/test/sslcorrupttest.c
+++ b/test/sslcorrupttest.c
@@ -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(),
diff --git a/test/testutil/driver.c b/test/testutil/driver.c
index efb5785d7d..6427d235af 100644
--- a/test/testutil/driver.c
+++ b/test/testutil/driver.c
@@ -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);
@@ -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) {