Test names can now use wildcard in the end (e.g., ap_wpa2_psk*) to match
all test cases with the specified prefix.
Signed-off-by: Jouni Malinen <j@w1.fi>
if args.tests:
fail = False
for t in args.tests:
- if t not in test_names:
+ if t.endswith('*'):
+ prefix = t.rstrip('*')
+ found = False
+ for tn in test_names:
+ if tn.startswith(prefix):
+ found = True
+ break
+ if not found:
+ print('Invalid arguments - test "%s" wildcard did not match' % t)
+ fail = True
+ elif t not in test_names:
print('Invalid arguments - test "%s" not known' % t)
fail = True
if fail:
for selected in args.tests:
for t in tests:
name = t.__name__.replace('test_', '', 1)
- if name == selected:
+ if selected.endswith('*'):
+ prefix = selected.rstrip('*')
+ if name.startswith(prefix):
+ tests_to_run.append(t)
+ elif name == selected:
tests_to_run.append(t)
else:
for t in tests: