tests: Make run-tests.py process test case selection arguments
This allows a list of matching test cases to be produced without having to run the test cases. Previously, -L output included all defined test cases regardless of what else was included on the command line. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
38cb0a2db6
commit
5e3c0b02a7
1 changed files with 22 additions and 22 deletions
|
@ -240,8 +240,29 @@ def main():
|
|||
if conn:
|
||||
run = int(time.time())
|
||||
|
||||
if args.update_tests_db:
|
||||
# read the modules from the modules file
|
||||
if args.mfile:
|
||||
args.testmodules = []
|
||||
with open(args.mfile) as f:
|
||||
for line in f.readlines():
|
||||
line = line.strip()
|
||||
if not line or line.startswith('#'):
|
||||
continue
|
||||
args.testmodules.append(line)
|
||||
|
||||
tests_to_run = []
|
||||
for t in tests:
|
||||
name = t.__name__.replace('test_', '', 1)
|
||||
if args.tests:
|
||||
if not name in args.tests:
|
||||
continue
|
||||
if args.testmodules:
|
||||
if not t.__module__.replace('test_', '', 1) in args.testmodules:
|
||||
continue
|
||||
tests_to_run.append(t)
|
||||
|
||||
if args.update_tests_db:
|
||||
for t in tests_to_run:
|
||||
name = t.__name__.replace('test_', '', 1)
|
||||
if t.__doc__ is None:
|
||||
print name + " - MISSING DESCRIPTION"
|
||||
|
@ -292,27 +313,6 @@ def main():
|
|||
if args.dmesg:
|
||||
subprocess.call(['sudo', 'dmesg', '-c'], stdout=open('/dev/null', 'w'))
|
||||
|
||||
# read the modules from the modules file
|
||||
if args.mfile:
|
||||
args.testmodules = []
|
||||
with open(args.mfile) as f:
|
||||
for line in f.readlines():
|
||||
line = line.strip()
|
||||
if not line or line.startswith('#'):
|
||||
continue
|
||||
args.testmodules.append(line)
|
||||
|
||||
tests_to_run = []
|
||||
for t in tests:
|
||||
name = t.__name__.replace('test_', '', 1)
|
||||
if args.tests:
|
||||
if not name in args.tests:
|
||||
continue
|
||||
if args.testmodules:
|
||||
if not t.__module__.replace('test_', '', 1) in args.testmodules:
|
||||
continue
|
||||
tests_to_run.append(t)
|
||||
|
||||
if conn and args.prefill:
|
||||
for t in tests_to_run:
|
||||
name = t.__name__.replace('test_', '', 1)
|
||||
|
|
Loading…
Reference in a new issue