Simplify tests part 2
[oweals/openssl.git] / test / ssl_test.c
index fb6214e9fed14d916bf6e430a6043dd44233d7cd..e53889b37a2780b26ad7d673fb4269d671c3f179 100644 (file)
@@ -23,18 +23,6 @@ static CONF *conf = NULL;
 /* Currently the section names are of the form test-<number>, e.g. test-15. */
 #define MAX_TESTCASE_NAME_LENGTH 100
 
-typedef struct ssl_test_ctx_test_fixture {
-    const char *test_case_name;
-    char test_app[MAX_TESTCASE_NAME_LENGTH];
-} SSL_TEST_FIXTURE;
-
-static SSL_TEST_FIXTURE set_up(const char *const test_case_name)
-{
-    SSL_TEST_FIXTURE fixture;
-    fixture.test_case_name = test_case_name;
-    return fixture;
-}
-
 static const char *print_alert(int alert)
 {
     return alert ? SSL_alert_desc_string_long(alert) : "no alert";
@@ -222,15 +210,18 @@ static int check_test(HANDSHAKE_RESULT *result, SSL_TEST_CTX *test_ctx)
     return ret;
 }
 
-static int execute_test(SSL_TEST_FIXTURE fixture)
+static int test_handshake(int idx)
 {
     int ret = 0;
     SSL_CTX *server_ctx = NULL, *server2_ctx = NULL, *client_ctx = NULL,
         *resume_server_ctx = NULL, *resume_client_ctx = NULL;
     SSL_TEST_CTX *test_ctx = NULL;
     HANDSHAKE_RESULT *result = NULL;
+    char test_app[MAX_TESTCASE_NAME_LENGTH];
+
+    BIO_snprintf(test_app, sizeof(test_app), "test-%d", idx);
 
-    test_ctx = SSL_TEST_CTX_create(conf, fixture.test_app);
+    test_ctx = SSL_TEST_CTX_create(conf, test_app);
     if (test_ctx == NULL)
         goto err;
 
@@ -272,7 +263,7 @@ static int execute_test(SSL_TEST_FIXTURE fixture)
     TEST_check(server_ctx != NULL);
     TEST_check(client_ctx != NULL);
 
-    TEST_check(CONF_modules_load(conf, fixture.test_app, 0) > 0);
+    TEST_check(CONF_modules_load(conf, test_app, 0) > 0);
 
     if (!SSL_CTX_config(server_ctx, "server")
         || !SSL_CTX_config(client_ctx, "client")) {
@@ -305,23 +296,6 @@ err:
     return ret;
 }
 
-static void tear_down(SSL_TEST_FIXTURE fixture)
-{
-}
-
-#define SETUP_SSL_TEST_FIXTURE()                        \
-    SETUP_TEST_FIXTURE(SSL_TEST_FIXTURE, set_up)
-#define EXECUTE_SSL_TEST()             \
-    EXECUTE_TEST(execute_test, tear_down)
-
-static int test_handshake(int idx)
-{
-    SETUP_SSL_TEST_FIXTURE();
-    BIO_snprintf(fixture.test_app, sizeof(fixture.test_app),
-                 "test-%d", idx);
-    EXECUTE_SSL_TEST();
-}
-
 int main(int argc, char **argv)
 {
     int result = 0;