xref: /netbsd-src/crypto/external/bsd/openssl/dist/test/testutil/main.c (revision 8dcce544aba31dd7bac77b173e50bc1830256eb0)
113d40330Schristos /*
2*8dcce544Schristos  * Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved.
313d40330Schristos  *
48fbed61eSchristos  * Licensed under the Apache License 2.0 (the "License").  You may not use
513d40330Schristos  * this file except in compliance with the License.  You can obtain a copy
613d40330Schristos  * in the file LICENSE in the source distribution or at
713d40330Schristos  * https://www.openssl.org/source/license.html
813d40330Schristos  */
913d40330Schristos 
1013d40330Schristos #include "../testutil.h"
1113d40330Schristos #include "output.h"
1213d40330Schristos #include "tu_local.h"
1313d40330Schristos 
1413d40330Schristos 
main(int argc,char * argv[])1513d40330Schristos int main(int argc, char *argv[])
1613d40330Schristos {
1713d40330Schristos     int ret = EXIT_FAILURE;
18*8dcce544Schristos     int setup_res;
1913d40330Schristos 
2013d40330Schristos     test_open_streams();
2113d40330Schristos 
2213d40330Schristos     if (!global_init()) {
2313d40330Schristos         test_printf_stderr("Global init failed - aborting\n");
2413d40330Schristos         return ret;
2513d40330Schristos     }
2613d40330Schristos 
278fbed61eSchristos     if (!setup_test_framework(argc, argv))
288fbed61eSchristos         goto end;
2913d40330Schristos 
30*8dcce544Schristos     if ((setup_res = setup_tests()) > 0) {
3113d40330Schristos         ret = run_tests(argv[0]);
3213d40330Schristos         cleanup_tests();
338fbed61eSchristos         opt_check_usage();
34*8dcce544Schristos     } else if (setup_res == 0) {
358fbed61eSchristos         opt_help(test_get_options());
368fbed61eSchristos     }
378fbed61eSchristos end:
3813d40330Schristos     ret = pulldown_test_framework(ret);
3913d40330Schristos     test_close_streams();
4013d40330Schristos     return ret;
4113d40330Schristos }
42