Skip to content

Icetea hw restriction #8137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")