diff options
author | Emilia Kasper <emilia@openssl.org> | 2016-11-07 16:53:15 +0100 |
---|---|---|
committer | Emilia Kasper <emilia@openssl.org> | 2016-11-09 16:07:16 +0100 |
commit | e364c3b24e38bd60d40487e0a532261348a9bb10 (patch) | |
tree | 82e621604899af53aebd34ced7d7dbc381678d84 /test/test_main_custom.h | |
parent | 7380737d77e89edd17651b04e439223a47ea833e (diff) |
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/test_main_custom.h')
-rw-r--r-- | test/test_main_custom.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/test_main_custom.h b/test/test_main_custom.h new file mode 100644 index 0000000000..22bc8f51a6 --- /dev/null +++ b/test/test_main_custom.h @@ -0,0 +1,20 @@ +/* + * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_TEST_MAIN_CUSTOM_H +# define HEADER_TEST_MAIN_CUSTOM_H + +/* + * Unit tests that need a custom main() should implement test_main and link to + * test_main_custom.c + * test_main() should return the result of run_tests(). + */ +extern int test_main(int argc, char *argv[]); + +#endif /* HEADER_TEST_MAIN_CUSTOM_H */ |