Import Mbed OS hard-float snapshot

This commit is contained in:
Beslan
2026-06-01 20:15:04 +03:00
commit d3738e2f89
16278 changed files with 10628036 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
"""
Copyright 2017 ARM Limited
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

View File

@@ -0,0 +1,39 @@
"""
Copyright 2018 ARM Limited
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from icetea_lib.bench import Bench
class Testcase(Bench):
def __init__(self):
Bench.__init__(self,
name="test_pass",
title="Test icetea integration",
status="released",
purpose="Just for testing scripts",
component=[],
type="smoke"
)
def setup(self):
pass
def case(self):
print("Test2 running")
def teardown(self):
pass

View File

@@ -0,0 +1,39 @@
"""
Copyright 2018 ARM Limited
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from icetea_lib.bench import Bench
class Testcase(Bench):
def __init__(self):
Bench.__init__(self,
name="test_print",
title="Test icetea integration",
status="released",
purpose="Just for testing scripts",
component=[],
type="smoke"
)
def setup(self):
pass
def case(self):
print("Test running")
def teardown(self):
pass

View File

@@ -0,0 +1 @@
This folder contains hardware test data for icetea integration

View File

@@ -0,0 +1,16 @@
"""
Copyright (c) 2020 Arm Limited
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

View File

@@ -0,0 +1,51 @@
"""
Copyright 2018 ARM Limited
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from icetea_lib.bench import Bench
class Testcase(Bench):
def __init__(self):
Bench.__init__(self,
name="test_K64F_only",
title="Test a test case which have only K64F support",
status="released",
purpose="Just for testing scripts",
component=[],
type="smoke",
requirements={
"duts": {
'*': {
"count": 1,
"type": "hardware",
"allowed_platforms": ['K64F'],
"application": {
"name": "TEST_APPS-device-exampleapp"
}
}
}
}
)
def setup(self):
pass
def case(self):
pass
def teardown(self):
pass

View File

@@ -0,0 +1,60 @@
"""
Copyright 2018 ARM Limited
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from icetea_lib.bench import Bench
class Testcase(Bench):
def __init__(self):
Bench.__init__(self,
name="test_predefined_platforms",
title="Test a test case which have support for multiple platforms",
status="released",
purpose="Just for testing scripts",
component=[],
type="regression",
requirements={
"duts": {
'*': {
"count": 1,
"type": "hardware",
"allowed_platforms": [
"LPC1768", "KL25Z", "K64F", "K66F", "K22F",
"NUCLEO_F072RB", "NUCLEO_F091RC", "NUCLEO_F303K8",
"NUCLEO_F303RE", "NUCLEO_F207ZG", "NUCLEO_F303ZE",
"DISCO_L072CZ_LRWAN1", "NUCLEO_L073RZ", "NUCLEO_L152RE",
"NUCLEO_F446RE", "NUCLEO_F446ZE", "NUCLEO_F429ZI",
"NUCLEO_F746ZG", "NUCLEO_L476RG",
"DISCO_L475VG_IOT01A", "DISCO_L476VG", "DISCO_F469NI", "DISCO_F429ZI",
"DISCO_F769NI", "ARCH_MAX", "MAX32600MBED", "MOTE_L152RC",
],
"application": {
"name": "TEST_APPS-device-exampleapp"
}
}
}
}
)
def setup(self):
pass
def case(self):
pass
def teardown(self):
pass

View File

View File

@@ -0,0 +1,3 @@
{
"builds": []
}

View File

@@ -0,0 +1,104 @@
"""
Copyright 2018 ARM Limited
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from os.path import realpath, join, dirname, isfile
import subprocess
"""
Tests for run_icetea.py
"""
this_file_dir = dirname(realpath(__file__))
hw_test_dir = join(this_file_dir, 'TEST_DIR_HW')
test_dir = join(this_file_dir, 'TEST_DIR')
empty_build_data = join(this_file_dir, 'empty_build_data.json')
test_suite = join(this_file_dir, 'test_suite.json')
run_icetea_py = join(dirname(dirname(this_file_dir)), 'run_icetea.py')
assert isfile(run_icetea_py)
def _execute_icetea(*params):
command = ["python", run_icetea_py] + list(params)
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stout, sterr = process.communicate()
status = process.poll()
if status != 0:
raise Exception("Error with {}, \nreturn code: {}, \nerror message: {}, \noutput:{}".format(
" ".join(command), status, sterr, stout
))
return stout.decode()
def test_help():
"""
Just test that something works
:return:
"""
_execute_icetea('--help')
def test_list_tests_k64f():
out = _execute_icetea('--compile-list', '--mcu', 'K64F', '--toolchain', 'GCC_ARM', '--tcdir', hw_test_dir)
assert 'test_K64F_only' in out
assert 'test_predefined_platforms' in out
def test_list_tests_nucleo_l073rz():
out = _execute_icetea('--compile-list', '--mcu', 'NUCLEO_L073RZ', '--toolchain', 'GCC_ARM', '--tcdir', hw_test_dir)
assert 'test_predefined_platforms' in out
assert 'test_K64F_only' not in out
def test_run():
out = _execute_icetea('--mcu', 'K64F', '--toolchain', 'GCC_ARM', '--tcdir', test_dir, '--build-data',
empty_build_data, '--test-suite', test_suite, '--ignore-checks')
assert 'test_print' in out
assert 'test_pass' in out
def test_run_by_name():
out = _execute_icetea('--mcu', 'K64F', '--toolchain', 'GCC_ARM', '--tcdir', test_dir, '--build-data',
empty_build_data, '--test-suite', test_suite, '--tests-by-name', 'test_pass',
'--ignore-checks')
assert 'test_pass' in out
assert 'test_print' not in out
def test_run_hw_with_not_build_tests():
"""
When test binaries are not found tests will be skipped
:return:
"""
out = _execute_icetea('--mcu', 'K64F', '--toolchain', 'GCC_ARM', '--tcdir', hw_test_dir, '--build-data',
empty_build_data, '--test-suite', test_suite)
output_lines = out.split('\n')
# Assert that
temp = list(filter(lambda x: 'test_K64F_only' in x, output_lines))[0]
assert 'skip' in temp
temp = list(filter(lambda x: 'test_predefined_platforms' in x, output_lines))[0]
assert 'skip' in temp
def test_data_validation():
exception_happened = False
try:
_execute_icetea('--mcu', 'K64F', '--toolchain', 'GCC_ARM', '--tcdir', test_dir, '--build-data',
empty_build_data, '--test-suite', test_suite)
except BaseException:
exception_happened = True
assert exception_happened

View File

@@ -0,0 +1,180 @@
"""
Copyright 2018 ARM Limited
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import os
import sys
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, set_allowed_platform
"""
Unit tests for run_icetea.py
"""
test_build_data = {
'builds': [
{
"id": "TEST_APPS-DEVICE-SOCKET_APP",
"target_name": "K64F",
"toolchain_name": "GCC_ARM",
"result": "OK"
}
]
}
def test_find_build_from_build_data_empty():
assert find_build_from_build_data(build_data={'builds': []}, id="something", target="K64F",
toolchain="GCC_ARM") is None
def test_find_build_from_build_data_wrong_target():
assert find_build_from_build_data(build_data=test_build_data, id="TEST_APPS-DEVICE-SOCKET_APP", target="AAAA",
toolchain="GCC_ARM") is None
def test_find_build_from_build_data():
assert find_build_from_build_data(build_data=test_build_data, id="TEST_APPS-DEVICE-SOCKET_APP", target="K64F",
toolchain="GCC_ARM") is not None
icetea_json_output = [
{
"status": "released",
"requirements": {
"duts": {
"1": {
"nick": "dut1"
},
"*": {
"count": 1,
"application": {
"bin": None,
"name": "TEST_APPS-device-socket_app"
},
"type": "hardware"
}
},
"external": {
"apps": []
}
},
"name": "UDPSOCKET_BIND_PORT",
"filepath": "/Users/test/mbed-os/TEST_APPS/testcases/SOCKET_BIND_PORT.py",
"title": "udpsocket open and bind port",
"component": [
"mbed-os",
"netsocket"
],
"compatible": {
"framework": {
"version": ">=1.0.0",
"name": "Icetea"
},
"hw": {
"value": True
},
"automation": {
"value": True
}
},
"subtype": "socket",
"purpose": "Verify UDPSocket can be created, opened and port binded",
"type": "smoke",
"sub_type": None
}
]
def test_filter_test_by_build_data_when_data_is_empty():
assert filter_test_by_build_data(
icetea_json_output=icetea_json_output,
build_data=None,
target="K64F",
toolchain="GCC_ARM"
) == icetea_json_output
def test_filter_test_by_build_data():
temp = filter_test_by_build_data(
icetea_json_output=icetea_json_output,
build_data=test_build_data,
target="K64F",
toolchain="GCC_ARM"
)
assert len(temp) > 0
def test_filter_test_by_name():
assert len(filter_test_by_name(icetea_json_output, ['UDPSOCKET_BIND_PORT'])) > 0
def test_filter_test_by_name_when_not_found():
assert filter_test_by_name(icetea_json_output, ['AAA']) == list()
def test_filter_test_by_name_when_name_is_empty():
assert filter_test_by_name(icetea_json_output, None) == icetea_json_output
def test_get_application_list():
assert 'TEST_APPS-device-socket_app' in get_application_list(icetea_json_output, ['UDPSOCKET_BIND_PORT'])
def test_get_application_list_not_found():
assert 'TEST_APPS-device-socket_app' not in get_application_list(icetea_json_output, ['SOMETHING_ELSE'])
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")