Add test groups.

Group tests with the same functionality into groups that can be used by autotest.py.
The groups can be overriden from private_settings.py.
pull/23/head
Bogdan Marinescu 2013-08-07 14:51:24 +03:00
parent 9ee1fc9f55
commit ad5516f898
2 changed files with 31 additions and 4 deletions

View File

@ -24,7 +24,7 @@ ROOT = abspath(join(dirname(__file__), ".."))
sys.path.append(ROOT)
from workspace_tools.build_api import build_project, build_mbed_libs
from workspace_tools.tests import TEST_MAP
from workspace_tools.tests import TEST_MAP, GROUPS
from workspace_tools.client import request_test, get_muts
from workspace_tools.settings import *
from workspace_tools.paths import BUILD_DIR
@ -83,8 +83,17 @@ if __name__ == "__main__":
f = open(test_spec_file)
test_spec = json.load(f)
clean = test_spec.get('clean', False)
test_ids = test_spec.get('test_ids', None)
test_ids = test_spec.get('test_ids', [])
groups = test_spec.get('test_groups', [])
for group in groups:
tests = GROUPS.get(group, [])
if not tests:
print "WARNING: test group '%s' not found." % group
continue
for test in tests:
if not test in test_ids:
test_ids.append(test)
# Test Server
test_server = TestServer()
@ -109,7 +118,7 @@ if __name__ == "__main__":
build_dir = join(BUILD_DIR, "test", target, toolchain)
for test_id, test in TEST_MAP.iteritems():
if test_ids is not None and test_id not in test_ids:
if test_ids and test_id not in test_ids:
continue
if test.automated and test.is_supported(target, toolchain):

View File

@ -687,6 +687,24 @@ TESTS = [
},
]
# Group tests with the same goals into categories
GROUPS = {
"core": ["MBED_A1", "MBED_A2", "MBED_A3", "MBED_A18"],
"digital_io": ["MBED_A5", "MBED_A6", "MBED_A7", "MBED_A10", "MBED_A11"],
"analog_io": ["MBED_A8"],
"i2c": ["MBED_A19", "MBED_A20"],
"spi": ["MBED_A12"],
}
GROUPS["rtos"] = [test["id"] for test in TESTS if test["id"].startswith("RTOS_")]
GROUPS["net"] = [test["id"] for test in TESTS if test["id"].startswith("NET_")]
# Look for 'TEST_GROUPS' in private_settings.py and update the GROUPS dictionary
# with the information in test_groups if found
try:
from workspace_tools.private_settings import TEST_GROUPS
except:
TEST_GROUPS = {}
GROUPS.update(TEST_GROUPS)
class Test:
DEFAULTS = {
'dependencies': None,