Add main() test methods to reduce test boilerplate. Simple tests only need to implement register_tests(). Tests that need a custom main() should implement test_main(). This will be wrapped in a main() that performs common setup/teardown (currently crypto-mdebug). Note that for normal development, enable-asan is usually sufficient for detecting leaks, and more versatile. enable-crypto-mdebug is stricter as it will also insist that all static variables be freed. This is useful for debugging library init/deinit; however, it also means that test_main() must free everything it allocates. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
diff --git a/test/cipherlist_test.c b/test/cipherlist_test.c index b5dd7d9..40596bc 100644 --- a/test/cipherlist_test.c +++ b/test/cipherlist_test.c
@@ -18,6 +18,7 @@ #include <openssl/tls1.h> #include "e_os.h" +#include "test_main.h" #include "testutil.h" typedef struct cipherlist_test_fixture { @@ -189,14 +190,8 @@ EXECUTE_CIPHERLIST_TEST(); } -int main(int argc, char **argv) +void register_tests() { - int result = 0; - ADD_TEST(test_default_cipherlist_implicit); ADD_TEST(test_default_cipherlist_explicit); - - result = run_tests(argv[0]); - - return result; }