summaryrefslogtreecommitdiff
path: root/test/asn1_internal_test.c
diff options
context:
space:
mode:
authorEmilia Kasper <emilia@openssl.org>2016-11-07 16:53:15 +0100
committerEmilia Kasper <emilia@openssl.org>2016-11-09 16:07:16 +0100
commite364c3b24e38bd60d40487e0a532261348a9bb10 (patch)
tree82e621604899af53aebd34ced7d7dbc381678d84 /test/asn1_internal_test.c
parent7380737d77e89edd17651b04e439223a47ea833e (diff)
downloadopenssl-new-e364c3b24e38bd60d40487e0a532261348a9bb10.tar.gz
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>
Diffstat (limited to 'test/asn1_internal_test.c')
-rw-r--r--test/asn1_internal_test.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/test/asn1_internal_test.c b/test/asn1_internal_test.c
index 6a5fce4081..b7e8af0e2c 100644
--- a/test/asn1_internal_test.c
+++ b/test/asn1_internal_test.c
@@ -15,6 +15,7 @@
#include <openssl/asn1.h>
#include <openssl/evp.h>
#include <openssl/objects.h>
+#include "test_main.h"
#include "testutil.h"
#include "e_os.h"
@@ -90,10 +91,8 @@ static int test_standard_methods()
return 0;
}
-int main(int argc, char **argv)
+void register_tests(void)
{
ADD_TEST(test_tbl_standard);
ADD_TEST(test_standard_methods);
-
- return run_tests(argv[0]);
}