diff options
Diffstat (limited to 'userspace/src/args.c')
-rw-r--r-- | userspace/src/args.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/userspace/src/args.c b/userspace/src/args.c index d91c6f6e..cf17c983 100644 --- a/userspace/src/args.c +++ b/userspace/src/args.c | |||
@@ -36,11 +36,12 @@ static struct option core_opts[] = { | |||
36 | { "no-color", 0, NULL, 'C' }, | 36 | { "no-color", 0, NULL, 'C' }, |
37 | 37 | ||
38 | { "unit-load-path", 1, NULL, 'L' }, | 38 | { "unit-load-path", 1, NULL, 'L' }, |
39 | { "num-threads", 1, NULL, 'j' }, | ||
39 | 40 | ||
40 | { NULL, 0, NULL, 0 } | 41 | { NULL, 0, NULL, 0 } |
41 | }; | 42 | }; |
42 | 43 | ||
43 | static const char *core_opts_str = "hvqCL:"; | 44 | static const char *core_opts_str = "hvqCL:j:"; |
44 | 45 | ||
45 | void core_print_help(struct unit_fw *fw) | 46 | void core_print_help(struct unit_fw *fw) |
46 | { | 47 | { |
@@ -63,6 +64,8 @@ void core_print_help(struct unit_fw *fw) | |||
63 | " corrupt that file.\n", | 64 | " corrupt that file.\n", |
64 | " -L, --unit-load-path <PATH>\n", | 65 | " -L, --unit-load-path <PATH>\n", |
65 | " Path to where the unit test libraries reside.\n", | 66 | " Path to where the unit test libraries reside.\n", |
67 | " -j, --num-threads <COUNT>\n", | ||
68 | " Number of threads to use while running all tests.\n", | ||
66 | "\n", | 69 | "\n", |
67 | "Note: mandatory arguments to long arguments are mandatory for short\n", | 70 | "Note: mandatory arguments to long arguments are mandatory for short\n", |
68 | "arguments as well.\n", | 71 | "arguments as well.\n", |
@@ -79,6 +82,7 @@ NULL | |||
79 | static void set_arg_defaults(struct unit_fw_args *args) | 82 | static void set_arg_defaults(struct unit_fw_args *args) |
80 | { | 83 | { |
81 | args->unit_load_path = DEFAULT_ARG_UNIT_LOAD_PATH; | 84 | args->unit_load_path = DEFAULT_ARG_UNIT_LOAD_PATH; |
85 | args->thread_count = 1; | ||
82 | } | 86 | } |
83 | 87 | ||
84 | /* | 88 | /* |
@@ -121,6 +125,13 @@ int core_parse_args(struct unit_fw *fw, int argc, char **argv) | |||
121 | case 'L': | 125 | case 'L': |
122 | args->unit_load_path = optarg; | 126 | args->unit_load_path = optarg; |
123 | break; | 127 | break; |
128 | case 'j': | ||
129 | args->thread_count = strtol(optarg, NULL, 10); | ||
130 | if (args->thread_count == 0) { | ||
131 | core_err(fw, "Invalid number of threads\n"); | ||
132 | return -1; | ||
133 | } | ||
134 | break; | ||
124 | case '?': | 135 | case '?': |
125 | args->help = true; | 136 | args->help = true; |
126 | return -1; | 137 | return -1; |