aboutsummaryrefslogtreecommitdiffstats
path: root/test/ssl_test_ctx_test.c
diff options
context:
space:
mode:
authorEmilia Kasper <emilia@openssl.org>2016-11-04 16:06:12 +0100
committerEmilia Kasper <emilia@openssl.org>2016-11-07 16:55:16 +0100
commitd836d71b2da026b4ed9a2233657b2289ab8e4be0 (patch)
treec4c9b9e2112eaea750871d66914868ea8585a6da /test/ssl_test_ctx_test.c
parent8e47ee18c8f7e59575effdd8dfcfbfff1a365ede (diff)
downloadopenssl-d836d71b2da026b4ed9a2233657b2289ab8e4be0.tar.gz
Simplify tests part 2
1) Remove some unnecessary fixtures 2) Add EXECUTE_TEST_NO_TEARDOWN shorthand when a fixture exists but has no teardown. 3) Fix return values in ct_test.c (introduced by an earlier refactoring, oops) Note that for parameterized tests, the index (test vector) usually holds all the customization, and there should be no need for a separate test fixture. The CTS test is an exception: it demonstrates how to combine customization with parameterization. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'test/ssl_test_ctx_test.c')
-rw-r--r--test/ssl_test_ctx_test.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/test/ssl_test_ctx_test.c b/test/ssl_test_ctx_test.c
index c601e903ed..d8b9f830ee 100644
--- a/test/ssl_test_ctx_test.c
+++ b/test/ssl_test_ctx_test.c
@@ -216,20 +216,6 @@ static int execute_test(SSL_TEST_CTX_TEST_FIXTURE fixture)
return success;
}
-static int execute_failure_test(SSL_TEST_CTX_TEST_FIXTURE fixture)
-{
- SSL_TEST_CTX *ctx = SSL_TEST_CTX_create(conf, fixture.test_section);
-
- if (ctx != NULL) {
- fprintf(stderr, "Parsing bad configuration %s succeeded.\n",
- fixture.test_section);
- SSL_TEST_CTX_free(ctx);
- return 0;
- }
-
- return 1;
-}
-
static void tear_down(SSL_TEST_CTX_TEST_FIXTURE fixture)
{
SSL_TEST_CTX_free(fixture.expected_ctx);
@@ -239,8 +225,6 @@ static void tear_down(SSL_TEST_CTX_TEST_FIXTURE fixture)
SETUP_TEST_FIXTURE(SSL_TEST_CTX_TEST_FIXTURE, set_up)
#define EXECUTE_SSL_TEST_CTX_TEST() \
EXECUTE_TEST(execute_test, tear_down)
-#define EXECUTE_SSL_TEST_CTX_FAILURE_TEST() \
- EXECUTE_TEST(execute_failure_test, tear_down)
static int test_empty_configuration()
{
@@ -307,9 +291,16 @@ static const char *bad_configurations[] = {
static int test_bad_configuration(int idx)
{
- SETUP_SSL_TEST_CTX_TEST_FIXTURE();
- fixture.test_section = bad_configurations[idx];
- EXECUTE_SSL_TEST_CTX_FAILURE_TEST();
+ SSL_TEST_CTX *ctx = SSL_TEST_CTX_create(conf, bad_configurations[idx]);
+
+ if (ctx != NULL) {
+ fprintf(stderr, "Parsing bad configuration %s succeeded.\n",
+ bad_configurations[idx]);
+ SSL_TEST_CTX_free(ctx);
+ return 0;
+ }
+
+ return 1;
}
int main(int argc, char **argv)