diff options
author | Pauli <pauli@openssl.org> | 2021-06-30 11:13:35 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-06-30 17:54:45 +1000 |
commit | b9bc8eb0546b22d7b23b25dc62eb5a459f745b98 (patch) | |
tree | 47fff8e1ce34bdf75b033b5ff59049f74222e84f /test | |
parent | 5e56f4587de2f2e06c079272fa4d6712d56dbcf0 (diff) |
test: fix test ordering in threads test
Fixes #15953
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15954)
Diffstat (limited to 'test')
-rw-r--r-- | test/threadstest.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/test/threadstest.c b/test/threadstest.c index ce31738189..3160d9e334 100644 --- a/test/threadstest.c +++ b/test/threadstest.c @@ -25,6 +25,7 @@ static int do_fips = 0; static char *privkey; static char *config_file = NULL; +static int multidefault_run = 0; static int test_lock(void) { @@ -477,26 +478,19 @@ static void test_multi_load_worker(void) (void)TEST_true(OSSL_PROVIDER_unload(prov)); } -static int test_multi_load(void) -{ - thread_t threads[MULTI_LOAD_THREADS]; - int i; - - for (i = 0; i < MULTI_LOAD_THREADS; i++) - (void)TEST_true(run_thread(&threads[i], test_multi_load_worker)); - - for (i = 0; i < MULTI_LOAD_THREADS; i++) - (void)TEST_true(wait_for_thread(threads[i])); - - return 1; -} - static int test_multi_default(void) { thread_t thread1, thread2; int testresult = 0; OSSL_PROVIDER *prov = NULL; + /* Avoid running this test twice */ + if (multidefault_run) { + TEST_skip("multi default test already run"); + return 1; + } + multidefault_run = 1; + multi_success = 1; multi_libctx = NULL; prov = OSSL_PROVIDER_load(multi_libctx, "default"); @@ -521,6 +515,26 @@ static int test_multi_default(void) return testresult; } +static int test_multi_load(void) +{ + thread_t threads[MULTI_LOAD_THREADS]; + int i, res = 1; + + /* The multidefault test must run prior to this test */ + if (!multidefault_run) { + TEST_info("Running multi default test first"); + res = test_multi_default(); + } + + for (i = 0; i < MULTI_LOAD_THREADS; i++) + (void)TEST_true(run_thread(&threads[i], test_multi_load_worker)); + + for (i = 0; i < MULTI_LOAD_THREADS; i++) + (void)TEST_true(wait_for_thread(threads[i])); + + return res; +} + typedef enum OPTION_choice { OPT_ERR = -1, OPT_EOF = 0, |