|
11 | 11 | #include <zephyr/tc_util.h>
|
12 | 12 | #include <zephyr/ztest_test.h>
|
13 | 13 | #include "nsi_host_trampolines.h"
|
| 14 | +#include <nsi_tracing.h> |
14 | 15 |
|
15 | 16 | static const char *test_args;
|
16 | 17 | static bool list_tests;
|
@@ -161,10 +162,18 @@ static bool z_ztest_testargs_contains(const char *suite_name, const char *test_n
|
161 | 162 | suite_arg = strtok_r(suite_test_pair, ":", &last_arg);
|
162 | 163 | test_arg = strtok_r(NULL, ":", &last_arg);
|
163 | 164 |
|
| 165 | + /* Validate format: must be test_suite::* or test_suite::test_case */ |
| 166 | + if (!suite_arg || !test_arg || strtok_r(NULL, ":", &last_arg) != NULL) { |
| 167 | + /* Invalid format, report error and exit */ |
| 168 | + nsi_print_error_and_exit( |
| 169 | + "Invalid test argument format '%s'. Expected a set of pairs like" |
| 170 | + "'suite::test' or 'suite::*', got instead '%s'.\n", |
| 171 | + test_args, suite_test_pair); |
| 172 | + } |
| 173 | + |
164 | 174 | found = !strcmp(suite_arg, suite_name);
|
165 | 175 | if (test_name) {
|
166 |
| - found &= !strcmp(test_arg, "*") || |
167 |
| - !strcmp(test_arg, test_name); |
| 176 | + found &= (!strcmp(test_arg, "*") || !strcmp(test_arg, test_name)); |
168 | 177 | }
|
169 | 178 |
|
170 | 179 | suite_test_pair = strtok_r(NULL, ",", &last_suite_test_pair);
|
|
0 commit comments