path: root/tests
diff options
authorIlan Peer <ilan.peer@intel.com>2014-10-26 07:06:33 (GMT)
committerJouni Malinen <j@w1.fi>2014-10-26 21:27:26 (GMT)
commit3bfa5f10a9e2adc62755832f89aa2ba34e25e54c (patch)
tree4bca67d58c6970eb51dff2e8e5acd38d96ee357e /tests
parent6492a9cada42b03c998b02c09434fa9c280646de (diff)
tests: Add support for reading modules list from a file
The new run-tests.py argument "-l <file>" can now be used to specify the test modules using a text file. Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Diffstat (limited to 'tests')
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py
index 52cb7f9..7352a1c 100755
--- a/tests/hwsim/run-tests.py
+++ b/tests/hwsim/run-tests.py
@@ -195,14 +195,16 @@ def main():
parser.add_argument('-f', dest='testmodules', metavar='<test module>',
help='execute only tests from these test modules',
type=str, choices=[[]] + test_modules, nargs='+')
+ parser.add_argument('-l', metavar='<modules file>', dest='mfile',
+ help='test modules file name')
parser.add_argument('tests', metavar='<test>', nargs='*', type=str,
help='tests to run (only valid without -f)',
choices=[[]] + test_names)
args = parser.parse_args()
- if args.tests and args.testmodules:
- print 'Invalid arguments - both test module and tests given'
+ if (args.tests and args.testmodules) or (args.tests and args.mfile) or (args.testmodules and args.mfile):
+ print 'Invalid arguments - only one of (test, test modules, modules file) can be given.'
if not args.logdir:
@@ -290,6 +292,16 @@ 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)