tests: Allow test selection with prefix wildcards
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>
This commit is contained in:
parent
4eab36595e
commit
88b6c6e244
1 changed files with 16 additions and 2 deletions
|
@ -257,7 +257,17 @@ def main():
|
|||
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:
|
||||
|
@ -292,7 +302,11 @@ def main():
|
|||
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:
|
||||
|
|
Loading…
Reference in a new issue