summaryrefslogtreecommitdiffstats
path: root/test/conf_include_test.c
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2018-08-16 12:36:01 +1000
committerRichard Levitte <levitte@openssl.org>2019-02-11 15:31:51 +0100
commita43ce58f5569a160272c492c680f2e42d38ec769 (patch)
treeacfaac32bee9b8e5dd832fbb49f95709c3b9741e /test/conf_include_test.c
parent9d5560331d86c6463e965321f774e4eed582ce0b (diff)
Updated test command line parsing to support commmon commands
Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6975)
Diffstat (limited to 'test/conf_include_test.c')
-rw-r--r--test/conf_include_test.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/test/conf_include_test.c b/test/conf_include_test.c
index 16939ed49e..ba40aa1b2d 100644
--- a/test/conf_include_test.c
+++ b/test/conf_include_test.c
@@ -178,26 +178,50 @@ static int test_check_overflow(void)
return 1;
}
+typedef enum OPTION_choice {
+ OPT_ERR = -1,
+ OPT_EOF = 0,
+ OPT_FAIL,
+ OPT_TEST_ENUM
+} OPTION_CHOICE;
+
+const OPTIONS *test_get_options(void)
+{
+ static const OPTIONS test_options[] = {
+ OPT_TEST_OPTIONS_WITH_EXTRA_USAGE("conf_file\n"),
+ { "f", OPT_FAIL, '-', "A failure is expected" },
+ { NULL }
+ };
+ return test_options;
+}
+
int setup_tests(void)
{
const char *conf_file;
- const char *arg2;
+ OPTION_CHOICE o;
if (!TEST_ptr(conf = NCONF_new(NULL)))
return 0;
- conf_file = test_get_argument(0);
+ while ((o = opt_next()) != OPT_EOF) {
+ switch (o) {
+ case OPT_FAIL:
+ expect_failure = 1;
+ break;
+ case OPT_TEST_CASES:
+ break;
+ default:
+ return 0;
+ }
+ }
+ conf_file = test_get_argument(0);
if (!TEST_ptr(conf_file)
|| !TEST_ptr(in = BIO_new_file(conf_file, "r"))) {
TEST_note("Unable to open the file argument");
return 0;
}
- if ((arg2 = test_get_argument(1)) != NULL && *arg2 == 'f') {
- expect_failure = 1;
- }
-
/*
* For this test we need to chdir as we use relative
* path names in the config files.