[openssl] master update

Dr. Paul Dale pauli at openssl.org
Wed Jun 30 07:55:15 UTC 2021


The branch master has been updated
       via  b9bc8eb0546b22d7b23b25dc62eb5a459f745b98 (commit)
      from  5e56f4587de2f2e06c079272fa4d6712d56dbcf0 (commit)


- Log -----------------------------------------------------------------
commit b9bc8eb0546b22d7b23b25dc62eb5a459f745b98
Author: Pauli <pauli at openssl.org>
Date:   Wed Jun 30 11:13:35 2021 +1000

    test: fix test ordering in threads test
    
    Fixes #15953
    
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/15954)

-----------------------------------------------------------------------

Summary of changes:
 test/threadstest.c | 42 ++++++++++++++++++++++++++++--------------
 1 file 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,


More information about the openssl-commits mailing list