Iron out /WX errors in VC-WIN32.
[openssl.git] / test / shlibloadtest.c
index 8c27bfc111014977f9bf7b53cba8d89eb6b8fe61..131d1f63dc1b460b6d63ddced278099926bf8d20 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -117,6 +117,7 @@ static int test_lib(void)
         if (!TEST_true(shlib_load(path_crypto, &cryptolib))
                 || !TEST_true(shlib_load(path_ssl, &ssllib)))
             goto end;
+        break;
     case SSL_FIRST:
         if (!TEST_true(shlib_load(path_ssl, &ssllib))
                 || !TEST_true(shlib_load(path_crypto, &cryptolib)))
@@ -158,6 +159,7 @@ static int test_lib(void)
         if (!TEST_true(shlib_close(cryptolib))
                 || !TEST_true(shlib_close(ssllib)))
             goto end;
+        break;
     case SSL_FIRST:
         if (!TEST_true(shlib_close(ssllib))
                 || !TEST_true(shlib_close(cryptolib)))
@@ -173,28 +175,26 @@ end:
 #endif
 
 
-int test_main(int argc, char **argv)
+int setup_tests(void)
 {
-    if (argc != 4) {
-        TEST_error("Unexpected number of arguments");
-        return EXIT_FAILURE;
-    }
+    const char *p = test_get_argument(0);
 
-    if (strcmp(argv[1], "-crypto_first") == 0) {
+    if (strcmp(p, "-crypto_first") == 0) {
         test_type = CRYPTO_FIRST;
-    } else if (strcmp(argv[1], "-ssl_first") == 0) {
+    } else if (strcmp(p, "-ssl_first") == 0) {
         test_type = SSL_FIRST;
-    } else if (strcmp(argv[1], "-just_crypto") == 0) {
+    } else if (strcmp(p, "-just_crypto") == 0) {
         test_type = JUST_CRYPTO;
     } else {
         TEST_error("Unrecognised argument");
-        return EXIT_FAILURE;
+        return 0;
     }
-    path_crypto = argv[2];
-    path_ssl = argv[3];
+    if (!TEST_ptr(path_crypto = test_get_argument(1))
+            || !TEST_ptr(path_ssl = test_get_argument(2)))
+        return 0;
 
 #if defined(DSO_DLFCN) || defined(DSO_WIN32)
     ADD_TEST(test_lib);
 #endif
-    return run_tests(argv[0]);
+    return 1;
 }