From: Jouni Malinen Date: Sat, 9 Mar 2013 21:18:20 +0000 (+0200) Subject: tests: Register test cases automatically from test_p2p_*.py X-Git-Tag: aosp-kk-from-upstream~492 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a4291ffdc73803f839160f5e45444c580af3975;p=thirdparty%2Fhostap.git tests: Register test cases automatically from test_p2p_*.py This removes need for editing run-p2p-tests.py whenever new test files are added. Signed-hostap: Jouni Malinen --- diff --git a/tests/hwsim/run-p2p-tests.py b/tests/hwsim/run-p2p-tests.py index e8060b946..151c538d8 100755 --- a/tests/hwsim/run-p2p-tests.py +++ b/tests/hwsim/run-p2p-tests.py @@ -7,6 +7,7 @@ # See README for more details. import os +import re import sys import time @@ -14,9 +15,6 @@ import logging from wpasupplicant import WpaSupplicant -import test_p2p_grpform -import test_p2p_autogo - def main(): idx = 1 if len(sys.argv) > 1 and sys.argv[1] == '-d': @@ -46,8 +44,12 @@ def main(): print "DEV: " + d.ifname + ": " + d.p2p_dev_addr() tests = [] - test_p2p_grpform.add_tests(tests) - test_p2p_autogo.add_tests(tests) + for t in os.listdir("."): + m = re.match(r'(test_p2p_.*)\.py$', t) + if m: + print "Import test cases from " + t + mod = __import__(m.group(1)) + mod.add_tests(tests) passed = [] failed = []