In d2i_test return error for malloc failure.
[openssl.git] / test / ssl_test.c
index 01ce5d5684d74f0fb11db6c5086bc59a4d7571c8..dfe71cbc5614547f85bdc14554ec16313098dfd9 100644 (file)
@@ -140,8 +140,7 @@ static int check_test(HANDSHAKE_RESULT result, SSL_TEST_CTX *test_ctx)
 
 static int execute_test(SSL_TEST_FIXTURE fixture)
 {
-    /* TODO(emilia): this is confusing. Flip to return 1 on success. */
-    int ret = 1;
+    int ret = 0;
     SSL_CTX *server_ctx = NULL, *client_ctx = NULL;
     SSL_TEST_CTX *test_ctx = NULL;
     HANDSHAKE_RESULT result;
@@ -163,15 +162,14 @@ static int execute_test(SSL_TEST_FIXTURE fixture)
 
     result = do_handshake(server_ctx, client_ctx);
 
-    if (check_test(result, test_ctx))
-        ret = 0;
+    ret = check_test(result, test_ctx);
 
 err:
     CONF_modules_unload(0);
     SSL_CTX_free(server_ctx);
     SSL_CTX_free(client_ctx);
     SSL_TEST_CTX_free(test_ctx);
-    if (ret != 0)
+    if (ret != 1)
         ERR_print_errors_fp(stderr);
     return ret;
 }
@@ -188,8 +186,8 @@ static void tear_down(SSL_TEST_FIXTURE fixture)
 static int test_handshake(int idx)
 {
     SETUP_SSL_TEST_FIXTURE();
-    snprintf(fixture.test_app, sizeof(fixture.test_app),
-             "test-%d", idx);
+    BIO_snprintf(fixture.test_app, sizeof(fixture.test_app),
+                 "test-%d", idx);
     EXECUTE_SSL_TEST();
 }
 
@@ -212,6 +210,5 @@ int main(int argc, char **argv)
     ADD_ALL_TESTS(test_handshake, (int)(num_tests));
     result = run_tests(argv[0]);
 
-    CONF_modules_free();
     return result;
 }