From 5e3c0b02a7ea6f80ae2b84b0cb48000a049fb167 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 19 Nov 2014 00:34:36 +0200 Subject: [PATCH] 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 --- tests/hwsim/run-tests.py | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py index 7352a1ce8..be9b77f6a 100755 --- a/tests/hwsim/run-tests.py +++ b/tests/hwsim/run-tests.py @@ -240,8 +240,29 @@ def main(): if conn: run = int(time.time()) + # 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: + 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)