2 * Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #include "../testutil.h"
11 #include "internal/nelem.h"
17 static size_t arg_count;
19 static unsigned char arg_used[1000];
21 static void check_arg_usage(void)
23 size_t i, n = arg_count < OSSL_NELEM(arg_used) ? arg_count
24 : OSSL_NELEM(arg_used);
26 for (i = 0; i < n; i++)
28 test_printf_stderr("Warning ignored command-line argument %d: %s\n",
31 test_printf_stderr("Warning arguments %zu and later unchecked\n", i);
34 int main(int argc, char *argv[])
36 int ret = EXIT_FAILURE;
41 test_printf_stderr("Global init failed - aborting\n");
48 setup_test_framework();
51 ret = run_tests(argv[0]);
55 ret = pulldown_test_framework(ret);
60 const char *test_get_program_name(void)
65 char *test_get_argument(size_t n)
69 if (n + 1 < OSSL_NELEM(arg_used))
74 size_t test_get_argument_count(void)
79 int test_has_option(const char *option)
83 for (i = 1; i <= arg_count; i++)
84 if (strcmp(args[i], option) == 0) {
91 const char *test_get_option_argument(const char *option)
93 size_t i, n = strlen(option);
95 for (i = 1; i <= arg_count; i++)
96 if (strncmp(args[i], option, n) == 0) {
98 if (args[i][n] == '\0' && i + 1 < arg_count) {