mirror of https://github.com/ARMmbed/mbed-os.git
commit
d364d367fe
|
@ -1,5 +1,6 @@
|
||||||
import sys
|
import sys
|
||||||
from io import open
|
from io import open
|
||||||
|
from os import sep
|
||||||
from os.path import isfile, join, dirname
|
from os.path import isfile, join, dirname
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
@ -20,9 +21,12 @@ PARSED_ARM_DATA = {
|
||||||
def test_parse_armcc():
|
def test_parse_armcc():
|
||||||
memap = MemapParser()
|
memap = MemapParser()
|
||||||
memap.parse(join(dirname(__file__), "arm.map"), "ARM")
|
memap.parse(join(dirname(__file__), "arm.map"), "ARM")
|
||||||
assert memap.modules == PARSED_ARM_DATA
|
|
||||||
memap.parse(join(dirname(__file__), "arm.map"), "UARM")
|
parsed_data_os_agnostic = dict()
|
||||||
assert memap.modules == PARSED_ARM_DATA
|
for k in PARSED_ARM_DATA:
|
||||||
|
parsed_data_os_agnostic[k.replace('/', sep)] = PARSED_ARM_DATA[k]
|
||||||
|
|
||||||
|
assert memap.modules == parsed_data_os_agnostic
|
||||||
|
|
||||||
PARSED_IAR_DATA = {
|
PARSED_IAR_DATA = {
|
||||||
"startup/startup.o": {".text": 0xc0},
|
"startup/startup.o": {".text": 0xc0},
|
||||||
|
@ -35,7 +39,12 @@ PARSED_IAR_DATA = {
|
||||||
def test_parse_iar():
|
def test_parse_iar():
|
||||||
memap = MemapParser()
|
memap = MemapParser()
|
||||||
memap.parse(join(dirname(__file__), "iar.map"), "IAR")
|
memap.parse(join(dirname(__file__), "iar.map"), "IAR")
|
||||||
assert memap.modules == PARSED_IAR_DATA
|
|
||||||
|
parsed_data_os_agnostic = dict()
|
||||||
|
for k in PARSED_IAR_DATA:
|
||||||
|
parsed_data_os_agnostic[k.replace('/', sep)] = PARSED_IAR_DATA[k]
|
||||||
|
|
||||||
|
assert memap.modules == parsed_data_os_agnostic
|
||||||
|
|
||||||
PARSED_GCC_DATA = {
|
PARSED_GCC_DATA = {
|
||||||
"startup/startup.o": {".text": 0xc0},
|
"startup/startup.o": {".text": 0xc0},
|
||||||
|
@ -49,9 +58,14 @@ PARSED_GCC_DATA = {
|
||||||
def test_parse_gcc():
|
def test_parse_gcc():
|
||||||
memap = MemapParser()
|
memap = MemapParser()
|
||||||
memap.parse(join(dirname(__file__), "gcc.map"), "GCC_ARM")
|
memap.parse(join(dirname(__file__), "gcc.map"), "GCC_ARM")
|
||||||
assert memap.modules == PARSED_GCC_DATA
|
|
||||||
|
parsed_data_os_agnostic = dict()
|
||||||
|
for k in PARSED_GCC_DATA:
|
||||||
|
parsed_data_os_agnostic[k.replace('/', sep)] = PARSED_GCC_DATA[k]
|
||||||
|
|
||||||
|
assert memap.modules == parsed_data_os_agnostic
|
||||||
memap.parse(join(dirname(__file__), "gcc.map"), "GCC_CR")
|
memap.parse(join(dirname(__file__), "gcc.map"), "GCC_CR")
|
||||||
assert memap.modules == PARSED_GCC_DATA
|
assert memap.modules == parsed_data_os_agnostic
|
||||||
|
|
||||||
|
|
||||||
def test_add_empty_module():
|
def test_add_empty_module():
|
||||||
|
|
|
@ -59,39 +59,3 @@ def test_find_tests_app_config(base_dir, target, toolchain_name, app_config):
|
||||||
"prepare_toolchain was not called with app_config"
|
"prepare_toolchain was not called with app_config"
|
||||||
assert args[1]['app_config'] == app_config,\
|
assert args[1]['app_config'] == app_config,\
|
||||||
"prepare_toolchain was called with an incorrect app_config"
|
"prepare_toolchain was called with an incorrect app_config"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("build_path", ["build_path"])
|
|
||||||
@pytest.mark.parametrize("target", ["K64F"])
|
|
||||||
@pytest.mark.parametrize("toolchain_name", ["ARM"])
|
|
||||||
@pytest.mark.parametrize("app_config", ["app_config", None])
|
|
||||||
def test_find_tests_app_config(build_path, target, toolchain_name, app_config):
|
|
||||||
"""
|
|
||||||
Test find_tests for correct use of app_config
|
|
||||||
|
|
||||||
:param base_dir: dummy value for the test base directory
|
|
||||||
:param target: the target to "test" for
|
|
||||||
:param toolchain_name: the toolchain to use for "testing"
|
|
||||||
:param app_config: Application configuration parameter to find tests
|
|
||||||
"""
|
|
||||||
tests = {'test1': 'test1_path','test2': 'test2_path'}
|
|
||||||
src_paths = ['.']
|
|
||||||
set_targets_json_location()
|
|
||||||
with patch('tools.test_api.scan_resources') as mock_scan_resources,\
|
|
||||||
patch('tools.test_api.build_project') as mock_build_project,\
|
|
||||||
patch('tools.test_api.get_config') as mock_get_config:
|
|
||||||
mock_build_project.return_value = "build_project"
|
|
||||||
mock_scan_resources().inc_dirs.return_value = []
|
|
||||||
mock_get_config.return_value = ({}, "", "")
|
|
||||||
|
|
||||||
build_tests(tests, src_paths, build_path, target, toolchain_name,
|
|
||||||
app_config=app_config)
|
|
||||||
|
|
||||||
arg_list = mock_build_project.call_args_list
|
|
||||||
for args in arg_list:
|
|
||||||
assert 'app_config' in args[1],\
|
|
||||||
"build_tests was not called with app_config"
|
|
||||||
assert args[1]['app_config'] == app_config,\
|
|
||||||
"build_tests was called with an incorrect app_config"
|
|
||||||
mock_get_config.called_with(src_paths, target,
|
|
||||||
toolchain_name, app_conifg=app_config)
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ from tools.toolchains import TOOLCHAIN_CLASSES, LEGACY_TOOLCHAIN_NAMES,\
|
||||||
from tools.targets import TARGET_MAP
|
from tools.targets import TARGET_MAP
|
||||||
from tools.notifier.mock import MockNotifier
|
from tools.notifier.mock import MockNotifier
|
||||||
|
|
||||||
ALPHABET = [char for char in printable if char not in [u'.', u'/']]
|
ALPHABET = [char for char in printable if char not in [u'.', u'/', u'\\']]
|
||||||
|
|
||||||
@given(fixed_dictionaries({
|
@given(fixed_dictionaries({
|
||||||
'common': lists(text()),
|
'common': lists(text()),
|
||||||
|
@ -175,7 +175,7 @@ def test_detect_duplicates(filenames):
|
||||||
assert "dupe.c" in notification["message"]
|
assert "dupe.c" in notification["message"]
|
||||||
assert "dupe.cpp" in notification["message"]
|
assert "dupe.cpp" in notification["message"]
|
||||||
|
|
||||||
@given(text(alphabet=ALPHABET + ["/"], min_size=1))
|
@given(text(alphabet=ALPHABET + [os.sep], min_size=1))
|
||||||
@given(booleans())
|
@given(booleans())
|
||||||
@given(booleans())
|
@given(booleans())
|
||||||
@settings(max_examples=20)
|
@settings(max_examples=20)
|
||||||
|
|
Loading…
Reference in New Issue