Skip to content

Commit ad5516f

Browse files
author
Bogdan Marinescu
committed
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.
1 parent 9ee1fc9 commit ad5516f

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

workspace_tools/autotest.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
sys.path.append(ROOT)
2525

2626
from workspace_tools.build_api import build_project, build_mbed_libs
27-
from workspace_tools.tests import TEST_MAP
27+
from workspace_tools.tests import TEST_MAP, GROUPS
2828
from workspace_tools.client import request_test, get_muts
2929
from workspace_tools.settings import *
3030
from workspace_tools.paths import BUILD_DIR
@@ -83,8 +83,17 @@ def load_data(path):
8383
f = open(test_spec_file)
8484
test_spec = json.load(f)
8585
clean = test_spec.get('clean', False)
86-
test_ids = test_spec.get('test_ids', None)
87-
86+
test_ids = test_spec.get('test_ids', [])
87+
groups = test_spec.get('test_groups', [])
88+
for group in groups:
89+
tests = GROUPS.get(group, [])
90+
if not tests:
91+
print "WARNING: test group '%s' not found." % group
92+
continue
93+
for test in tests:
94+
if not test in test_ids:
95+
test_ids.append(test)
96+
8897
# Test Server
8998
test_server = TestServer()
9099

@@ -109,7 +118,7 @@ def load_data(path):
109118
build_dir = join(BUILD_DIR, "test", target, toolchain)
110119

111120
for test_id, test in TEST_MAP.iteritems():
112-
if test_ids is not None and test_id not in test_ids:
121+
if test_ids and test_id not in test_ids:
113122
continue
114123

115124
if test.automated and test.is_supported(target, toolchain):

workspace_tools/tests.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,24 @@
687687
},
688688
]
689689

690+
# Group tests with the same goals into categories
691+
GROUPS = {
692+
"core": ["MBED_A1", "MBED_A2", "MBED_A3", "MBED_A18"],
693+
"digital_io": ["MBED_A5", "MBED_A6", "MBED_A7", "MBED_A10", "MBED_A11"],
694+
"analog_io": ["MBED_A8"],
695+
"i2c": ["MBED_A19", "MBED_A20"],
696+
"spi": ["MBED_A12"],
697+
}
698+
GROUPS["rtos"] = [test["id"] for test in TESTS if test["id"].startswith("RTOS_")]
699+
GROUPS["net"] = [test["id"] for test in TESTS if test["id"].startswith("NET_")]
700+
# Look for 'TEST_GROUPS' in private_settings.py and update the GROUPS dictionary
701+
# with the information in test_groups if found
702+
try:
703+
from workspace_tools.private_settings import TEST_GROUPS
704+
except:
705+
TEST_GROUPS = {}
706+
GROUPS.update(TEST_GROUPS)
707+
690708
class Test:
691709
DEFAULTS = {
692710
'dependencies': None,

0 commit comments

Comments
 (0)