mirror of https://github.com/ARMmbed/mbed-os.git
Fix icetea run in case that user has different boards connected same time
parent
1981728be9
commit
ed18665807
|
|
@ -34,7 +34,6 @@ plugins_path = abspath(join(ROOT, 'TEST_APPS', 'icetea_plugins', 'plugins_to_loa
|
|||
|
||||
|
||||
def find_build_from_build_data(build_data, id, target, toolchain):
|
||||
|
||||
if 'builds' not in build_data:
|
||||
raise Exception("build data is in wrong format, does not include builds object")
|
||||
|
||||
|
|
@ -86,7 +85,7 @@ def create_test_suite(target, tool, icetea_json_output, build_data, tests_by_nam
|
|||
test_case = {
|
||||
'name': test['name'],
|
||||
'config': {
|
||||
'requirements': test['requirements']
|
||||
'requirements': set_allowed_platform(test['requirements'], target)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -104,6 +103,17 @@ def create_test_suite(target, tool, icetea_json_output, build_data, tests_by_nam
|
|||
return test_suite
|
||||
|
||||
|
||||
def set_allowed_platform(requirements, target):
|
||||
"""
|
||||
Allowed platform restrict icetea to run tests on specific board
|
||||
This targets tests to the right board in case that user has multiple ones connected same time
|
||||
"""
|
||||
if '*' not in requirements['duts'].keys():
|
||||
requirements['duts']['*'] = dict()
|
||||
requirements['duts']['*']['allowed_platforms'] = [target]
|
||||
return requirements
|
||||
|
||||
|
||||
def get_applications(test):
|
||||
ret = list()
|
||||
for dut in test['requirements']['duts'].values():
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..",
|
|||
sys.path.insert(0, ROOT)
|
||||
|
||||
from tools.run_icetea import find_build_from_build_data, filter_test_by_build_data, filter_test_by_name, \
|
||||
get_application_list
|
||||
get_application_list, set_allowed_platform
|
||||
|
||||
"""
|
||||
Unit tests for run_icetea.py
|
||||
|
|
@ -143,3 +143,36 @@ def test_get_application_list_not_found():
|
|||
|
||||
def test_get_application_list_none():
|
||||
assert 'TEST_APPS-device-socket_app' in get_application_list(icetea_json_output, None)
|
||||
|
||||
|
||||
def test_set_allowed_platform_simple():
|
||||
ret = set_allowed_platform({"duts": {}}, "K66F")
|
||||
assert ret['duts']['*']['allowed_platforms'] == ["K66F"]
|
||||
|
||||
|
||||
def test_set_allowed_platform_normal():
|
||||
ret = set_allowed_platform({
|
||||
"duts": {
|
||||
"*": {
|
||||
"count": 3,
|
||||
"allowed_platforms": ["K64F"],
|
||||
"application": {"bin": "hex.bin"}
|
||||
},
|
||||
1: {"application": {"bin": "my_hex.bin"}},
|
||||
2: {"application": {"bin": "my_hex2.bin"}}
|
||||
}
|
||||
}, "K66F")
|
||||
assert ret['duts']['*']['allowed_platforms'] == ["K66F"]
|
||||
|
||||
|
||||
def test_set_allowed_platform_no_changes():
|
||||
temp = {
|
||||
"duts": {
|
||||
"*": {
|
||||
"count": 3,
|
||||
"allowed_platforms": ["K64F"],
|
||||
"application": {"bin": "hex.bin"}
|
||||
},
|
||||
}
|
||||
}
|
||||
assert temp == set_allowed_platform(temp, "K64F")
|
||||
|
|
|
|||
Loading…
Reference in New Issue