Add TEST_check
[openssl.git] / test / ssl_test_ctx_test.c
index b7f888a4186ce4eaf8addc73010d5682002a275e..60bd573fbd9603bf15a8e1eadaac3854c439e03c 100644 (file)
@@ -54,6 +54,12 @@ static int SSL_TEST_CLIENT_CONF_equal(SSL_TEST_CLIENT_CONF *client,
     if (!strings_equal("Client ALPNProtocols", client->alpn_protocols,
                        client2->alpn_protocols))
         return 0;
+    if (client->ct_validation != client2->ct_validation) {
+        fprintf(stderr, "CTValidation mismatch: %s vs %s.\n",
+                ssl_ct_validation_name(client->ct_validation),
+                ssl_ct_validation_name(client2->ct_validation));
+        return 0;
+    }
     return 1;
 }
 
@@ -168,7 +174,7 @@ static SSL_TEST_CTX_TEST_FIXTURE set_up(const char *const test_case_name)
     SSL_TEST_CTX_TEST_FIXTURE fixture;
     fixture.test_case_name = test_case_name;
     fixture.expected_ctx = SSL_TEST_CTX_new();
-    OPENSSL_assert(fixture.expected_ctx != NULL);
+    TEST_check(fixture.expected_ctx != NULL);
     return fixture;
 }
 
@@ -248,7 +254,7 @@ static int test_good_configuration()
     fixture.expected_ctx->extra.client.servername = SSL_TEST_SERVERNAME_SERVER2;
     fixture.expected_ctx->extra.client.npn_protocols =
         OPENSSL_strdup("foo,bar");
-    OPENSSL_assert(fixture.expected_ctx->extra.client.npn_protocols != NULL);
+    TEST_check(fixture.expected_ctx->extra.client.npn_protocols != NULL);
 
     fixture.expected_ctx->extra.server.servername_callback =
         SSL_TEST_SERVERNAME_IGNORE_MISMATCH;
@@ -256,9 +262,12 @@ static int test_good_configuration()
 
     fixture.expected_ctx->resume_extra.server2.alpn_protocols =
         OPENSSL_strdup("baz");
-    OPENSSL_assert(
+    TEST_check(
         fixture.expected_ctx->resume_extra.server2.alpn_protocols != NULL);
 
+    fixture.expected_ctx->resume_extra.client.ct_validation =
+        SSL_TEST_CT_VALIDATION_STRICT;
+
     EXECUTE_SSL_TEST_CTX_TEST();
 }
 
@@ -275,6 +284,7 @@ static const char *bad_configurations[] = {
     "ssltest_unknown_method",
     "ssltest_unknown_handshake_mode",
     "ssltest_unknown_resumption_expected",
+    "ssltest_unknown_ct_validation",
 };
 
 static int test_bad_configuration(int idx)
@@ -292,11 +302,10 @@ int main(int argc, char **argv)
         return 1;
 
     conf = NCONF_new(NULL);
-    OPENSSL_assert(conf != NULL);
+    TEST_check(conf != NULL);
 
     /* argv[1] should point to test/ssl_test_ctx_test.conf */
-    OPENSSL_assert(NCONF_load(conf, argv[1], NULL) > 0);
-
+    TEST_check(NCONF_load(conf, argv[1], NULL) > 0);
 
     ADD_TEST(test_empty_configuration);
     ADD_TEST(test_good_configuration);