xref: /freebsd-src/crypto/openssl/test/testutil/main.c (revision e0c4386e7e71d93b0edc0c8fa156263fc4a8b0b6)
1*e0c4386eSCy Schubert /*
2*e0c4386eSCy Schubert  * Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved.
3*e0c4386eSCy Schubert  *
4*e0c4386eSCy Schubert  * Licensed under the Apache License 2.0 (the "License").  You may not use
5*e0c4386eSCy Schubert  * this file except in compliance with the License.  You can obtain a copy
6*e0c4386eSCy Schubert  * in the file LICENSE in the source distribution or at
7*e0c4386eSCy Schubert  * https://www.openssl.org/source/license.html
8*e0c4386eSCy Schubert  */
9*e0c4386eSCy Schubert 
10*e0c4386eSCy Schubert #include "../testutil.h"
11*e0c4386eSCy Schubert #include "output.h"
12*e0c4386eSCy Schubert #include "tu_local.h"
13*e0c4386eSCy Schubert 
14*e0c4386eSCy Schubert 
main(int argc,char * argv[])15*e0c4386eSCy Schubert int main(int argc, char *argv[])
16*e0c4386eSCy Schubert {
17*e0c4386eSCy Schubert     int ret = EXIT_FAILURE;
18*e0c4386eSCy Schubert     int setup_res;
19*e0c4386eSCy Schubert 
20*e0c4386eSCy Schubert     test_open_streams();
21*e0c4386eSCy Schubert 
22*e0c4386eSCy Schubert     if (!global_init()) {
23*e0c4386eSCy Schubert         test_printf_stderr("Global init failed - aborting\n");
24*e0c4386eSCy Schubert         return ret;
25*e0c4386eSCy Schubert     }
26*e0c4386eSCy Schubert 
27*e0c4386eSCy Schubert     if (!setup_test_framework(argc, argv))
28*e0c4386eSCy Schubert         goto end;
29*e0c4386eSCy Schubert 
30*e0c4386eSCy Schubert     if ((setup_res = setup_tests()) > 0) {
31*e0c4386eSCy Schubert         ret = run_tests(argv[0]);
32*e0c4386eSCy Schubert         cleanup_tests();
33*e0c4386eSCy Schubert         opt_check_usage();
34*e0c4386eSCy Schubert     } else if (setup_res == 0) {
35*e0c4386eSCy Schubert         opt_help(test_get_options());
36*e0c4386eSCy Schubert     }
37*e0c4386eSCy Schubert end:
38*e0c4386eSCy Schubert     ret = pulldown_test_framework(ret);
39*e0c4386eSCy Schubert     test_close_streams();
40*e0c4386eSCy Schubert     return ret;
41*e0c4386eSCy Schubert }
42