Skip to content

Commit

Permalink
Merge pull request #8137 from OPpuolitaival/icetea_hw_restriction
Browse files Browse the repository at this point in the history
Icetea hw restriction
  • Loading branch information
Cruz Monrreal authored Sep 17, 2018
2 parents 87daf8f + ed18665 commit 7a0c9a6
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
14 changes: 12 additions & 2 deletions tools/run_icetea.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@


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")

Expand Down Expand Up @@ -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)
}
}

Expand All @@ -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():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
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
Expand All @@ -32,7 +32,8 @@
{
"id": "TEST_APPS-DEVICE-SOCKET_APP",
"target_name": "K64F",
"toolchain_name": "GCC_ARM"
"toolchain_name": "GCC_ARM",
"result": "OK"
}
]
}
Expand Down Expand Up @@ -142,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")

0 comments on commit 7a0c9a6

Please sign in to comment.