mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #4984 from theotherjimmy/unify-unit-tests
Unify mbed OS tools testing style with what's used in mbed-ls, htrun, greenteapull/5043/merge
commit
5bcd97a2bc
17
.travis.yml
17
.travis.yml
|
|
@ -19,14 +19,13 @@ script:
|
|||
- |
|
||||
find -name "*.s" | tee BUILD/badasm | sed -e "s/^/Bad Assembler file name found: /" && [ ! -s BUILD/badasm ]
|
||||
- make -C events/equeue test clean
|
||||
- PYTHONPATH=. python tools/test/config_test/config_test.py
|
||||
- PYTHONPATH=. python tools/test/build_api/build_api_test.py
|
||||
- PYTHONPATH=. python tools/test/targets/target_test.py
|
||||
- python tools/test/pylint.py
|
||||
- py.test tools/test/toolchains/api.py
|
||||
- python tools/test/memap/memap_test.py
|
||||
- python tools/project.py -S
|
||||
- python tools/build_travis.py
|
||||
- PYTHONPATH=. coverage run -a -m pytest tools/test
|
||||
- python2 tools/test/pylint.py
|
||||
- coverage run -a tools/project.py -S
|
||||
- python2 tools/build_travis.py
|
||||
- coverage html
|
||||
after_success:
|
||||
- coveralls
|
||||
before_install:
|
||||
- sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
|
||||
- sudo add-apt-repository -y ppa:libreoffice/libreoffice-4-2
|
||||
|
|
@ -42,3 +41,5 @@ install:
|
|||
- pip install pylint
|
||||
- pip install hypothesis
|
||||
- pip install mock
|
||||
- pip install coverage
|
||||
- pip install coveralls
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ We run continuous integration on all of our branches and pull requests to verify
|
|||
- Master branch [](https://travis-ci.org/ARMmbed/mbed-os)
|
||||
- Latest release [](https://travis-ci.org/ARMmbed/mbed-os/branches)
|
||||
|
||||
Tools coverage [](https://coveralls.io/github/ARMmbed/mbed-os?branch=master)
|
||||
|
||||
## Getting Started for Developers
|
||||
|
||||
You need [mbed CLI](https://github.com/ARMmbed/mbed-cli) to build mbed OS. For more details, read the [mbed OS Handbook](https://docs.mbed.com/docs/mbed-os-handbook/en/latest/).
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"test_target": {
|
||||
"lib1.p1": "v_p1_lib1_app",
|
||||
"lib1.p2": "v_p2_lib1",
|
||||
"lib1.p3": "v_p3_lib1",
|
||||
"lib2.p1": "v_p1_lib2_app",
|
||||
"lib2.p2": "v_p2_lib2"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"K64F": {
|
||||
"exception_msg": "not found"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"b1": {
|
||||
"base": {
|
||||
"extra_labels": [],
|
||||
"default_lib": "std",
|
||||
"core": "Cortex-M0",
|
||||
|
|
@ -9,8 +9,8 @@
|
|||
"base1_3": "v_base1_3_b1"
|
||||
}
|
||||
},
|
||||
"d1": {
|
||||
"inherits": ["b1"],
|
||||
"left_middle": {
|
||||
"inherits": ["base"],
|
||||
"config": {
|
||||
"derived1": "v_derived1_d1",
|
||||
"derived2": "v_derived2_d1"
|
||||
|
|
@ -20,8 +20,8 @@
|
|||
"base1_2": "v_base1_2_d1"
|
||||
}
|
||||
},
|
||||
"b2": {
|
||||
"inherits": ["b1"],
|
||||
"right_middle": {
|
||||
"inherits": ["base"],
|
||||
"config": {
|
||||
"base2_1": "v_base2_1_b2",
|
||||
"base2_2": "v_base2_2_b2"
|
||||
|
|
@ -30,8 +30,8 @@
|
|||
"base1_2": "v_base1_2_b2"
|
||||
}
|
||||
},
|
||||
"f": {
|
||||
"inherits": ["d1", "b2"],
|
||||
"inherits_diamond": {
|
||||
"inherits": ["left_middle", "right_middle"],
|
||||
"config": {
|
||||
"f1_1": "v_f1_1_f",
|
||||
"f1_2": "v_f1_2_f"
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"inherits_diamond": {
|
||||
"target.base1_1": "v_base1_1_f",
|
||||
"target.base1_2": "v_base1_2_b2",
|
||||
"target.base1_3": "v_base1_3_b1",
|
||||
"target.derived1": "v_derived1_d1",
|
||||
"target.derived2": "v_derived2_f",
|
||||
"target.base2_1": "v_base2_1_f",
|
||||
"target.base2_2": "v_base2_2_b2",
|
||||
"target.f1_1": "v_f1_1_f_override",
|
||||
"target.f1_2": "v_f1_2_f"
|
||||
},
|
||||
"right_middle": {
|
||||
"target.base1_1": "v_base1_1_b1",
|
||||
"target.base1_2": "v_base1_2_b2",
|
||||
"target.base1_3": "v_base1_3_b1",
|
||||
"target.base2_1": "v_base2_1_b2",
|
||||
"target.base2_2": "v_base2_2_b2"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
"""
|
||||
mbed SDK
|
||||
Copyright (c) 2016 ARM Limited
|
||||
Copyright (c) 2011-2017 ARM Limited
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
@ -15,118 +15,161 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
"""
|
||||
|
||||
import os.path
|
||||
import unittest
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import pytest
|
||||
from mock import patch
|
||||
from tools.config import Config
|
||||
from hypothesis import given
|
||||
from hypothesis.strategies import sampled_from
|
||||
from os.path import join, isfile, dirname, abspath
|
||||
from tools.build_api import get_config
|
||||
from tools.targets import set_targets_json_location, Target, TARGET_NAMES
|
||||
from tools.config import ConfigException, Config
|
||||
|
||||
"""
|
||||
Tests for config.py
|
||||
"""
|
||||
def compare_config(cfg, expected):
|
||||
"""Compare the output of config against a dictionary of known good results
|
||||
|
||||
class ConfigTests(unittest.TestCase):
|
||||
"""
|
||||
Test cases for Config class
|
||||
:param cfg: the configuration to check
|
||||
:param expected: what to expect in that config
|
||||
"""
|
||||
try:
|
||||
for k in cfg:
|
||||
if cfg[k].value != expected[k]:
|
||||
return "'%s': expected '%s', got '%s'" % (k, expected[k], cfg[k].value)
|
||||
except KeyError:
|
||||
return "Unexpected key '%s' in configuration data" % k
|
||||
for k in expected:
|
||||
if k not in ["expected_macros", "expected_features"] + cfg.keys():
|
||||
return "Expected key '%s' was not found in configuration data" % k
|
||||
return ""
|
||||
|
||||
def setUp(self):
|
||||
"""
|
||||
Called before each test case
|
||||
def data_path(path):
|
||||
"""The expected data file for a particular test
|
||||
|
||||
:return:
|
||||
:param path: the path to the test
|
||||
"""
|
||||
self.target = "K64F"
|
||||
return join(path, "test_data.json")
|
||||
|
||||
def tearDown(self):
|
||||
def is_test(path):
|
||||
"""Does a directory represent a test?
|
||||
|
||||
:param path: the path to the test
|
||||
"""
|
||||
Called after each test case
|
||||
return isfile(data_path(path))
|
||||
|
||||
:return:
|
||||
root_dir = abspath(dirname(__file__))
|
||||
|
||||
@pytest.mark.parametrize("name", filter(lambda d: is_test(join(root_dir, d)),
|
||||
os.listdir(root_dir)))
|
||||
def test_config(name):
|
||||
"""Run a particular configuration test
|
||||
|
||||
:param name: test name (same as directory name)
|
||||
"""
|
||||
pass
|
||||
test_dir = join(root_dir, name)
|
||||
test_data = json.load(open(data_path(test_dir)))
|
||||
targets_json = os.path.join(test_dir, "targets.json")
|
||||
set_targets_json_location(targets_json if isfile(targets_json) else None)
|
||||
for target, expected in test_data.items():
|
||||
try:
|
||||
cfg, macros, features = get_config(test_dir, target, "GCC_ARM")
|
||||
res = compare_config(cfg, expected)
|
||||
assert not(res), res
|
||||
expected_macros = expected.get("expected_macros", None)
|
||||
expected_features = expected.get("expected_features", None)
|
||||
|
||||
@patch.object(Config, '_process_config_and_overrides')
|
||||
@patch('tools.config.json_file_to_dict')
|
||||
def test_init_app_config(self, mock_json_file_to_dict, _):
|
||||
if expected_macros is not None:
|
||||
macros = Config.config_macros_to_macros(macros)
|
||||
assert sorted(expected_macros) == sorted(macros)
|
||||
if expected_features is not None:
|
||||
assert sorted(expected_features) == sorted(features)
|
||||
except ConfigException as e:
|
||||
err_msg = e.message
|
||||
if "exception_msg" not in expected:
|
||||
assert not(err_msg), "Unexpected Error: %s" % e
|
||||
else:
|
||||
assert expected["exception_msg"] in err_msg
|
||||
|
||||
|
||||
@pytest.mark.parametrize("target", ["K64F"])
|
||||
def test_init_app_config(target):
|
||||
"""
|
||||
Test that the initialisation correctly uses app_config
|
||||
|
||||
:param mock_json_file_to_dict: mock of function json_file_to_dict
|
||||
:param _: mock of function _process_config_and_overrides (not tested)
|
||||
:return:
|
||||
:param target: The target to use
|
||||
"""
|
||||
set_targets_json_location()
|
||||
with patch.object(Config, '_process_config_and_overrides'),\
|
||||
patch('tools.config.json_file_to_dict') as mock_json_file_to_dict:
|
||||
app_config = "app_config"
|
||||
mock_return = {'config': 'test'}
|
||||
mock_return = {'config': {'test': False}}
|
||||
mock_json_file_to_dict.return_value = mock_return
|
||||
|
||||
config = Config(self.target, app_config=app_config)
|
||||
config = Config(target, app_config=app_config)
|
||||
|
||||
mock_json_file_to_dict.assert_called_with(app_config)
|
||||
self.assertEqual(config.app_config_data, mock_return,
|
||||
"app_config_data should be set to the returned value")
|
||||
assert config.app_config_data == mock_return
|
||||
|
||||
@patch.object(Config, '_process_config_and_overrides')
|
||||
@patch('tools.config.json_file_to_dict')
|
||||
def test_init_no_app_config(self, mock_json_file_to_dict, _):
|
||||
|
||||
@pytest.mark.parametrize("target", ["K64F"])
|
||||
def test_init_no_app_config(target):
|
||||
"""
|
||||
Test that the initialisation works without app config
|
||||
|
||||
:param mock_json_file_to_dict: mock of function json_file_to_dict
|
||||
:param _: patch of function _process_config_and_overrides (not tested)
|
||||
:return:
|
||||
:param target: The target to use
|
||||
"""
|
||||
config = Config(self.target)
|
||||
set_targets_json_location()
|
||||
with patch.object(Config, '_process_config_and_overrides'),\
|
||||
patch('tools.config.json_file_to_dict') as mock_json_file_to_dict:
|
||||
config = Config(target)
|
||||
|
||||
mock_json_file_to_dict.assert_not_called()
|
||||
self.assertEqual(config.app_config_data, {},
|
||||
"app_config_data should be set an empty dictionary")
|
||||
assert config.app_config_data == {}
|
||||
|
||||
@patch.object(Config, '_process_config_and_overrides')
|
||||
@patch('os.path.isfile')
|
||||
@patch('tools.config.json_file_to_dict')
|
||||
def test_init_no_app_config_with_dir(self, mock_json_file_to_dict, mock_isfile, _):
|
||||
|
||||
@pytest.mark.parametrize("target", ["K64F"])
|
||||
def test_init_no_app_config_with_dir(target):
|
||||
"""
|
||||
Test that the initialisation works without app config and with a
|
||||
specified top level directory
|
||||
|
||||
:param mock_json_file_to_dict: mock of function json_file_to_dict
|
||||
:param _: patch of function _process_config_and_overrides (not tested)
|
||||
:return:
|
||||
:param target: The target to use
|
||||
"""
|
||||
set_targets_json_location()
|
||||
with patch.object(Config, '_process_config_and_overrides'),\
|
||||
patch('os.path.isfile') as mock_isfile, \
|
||||
patch('tools.config.json_file_to_dict') as mock_json_file_to_dict:
|
||||
directory = '.'
|
||||
path = os.path.join('.', 'mbed_app.json')
|
||||
mock_return = {'config': 'test'}
|
||||
mock_return = {'config': {'test': False}}
|
||||
mock_json_file_to_dict.return_value = mock_return
|
||||
mock_isfile.return_value = True
|
||||
|
||||
config = Config(self.target, [directory])
|
||||
config = Config(target, [directory])
|
||||
|
||||
mock_isfile.assert_called_with(path)
|
||||
mock_json_file_to_dict.assert_called_once_with(path)
|
||||
self.assertEqual(config.app_config_data, mock_return,
|
||||
"app_config_data should be set to the returned value")
|
||||
assert config.app_config_data == mock_return
|
||||
|
||||
@patch.object(Config, '_process_config_and_overrides')
|
||||
@patch('tools.config.json_file_to_dict')
|
||||
def test_init_override_app_config(self, mock_json_file_to_dict, _):
|
||||
|
||||
@pytest.mark.parametrize("target", ["K64F"])
|
||||
def test_init_override_app_config(target):
|
||||
"""
|
||||
Test that the initialisation uses app_config instead of top_level_dir
|
||||
when both are specified
|
||||
|
||||
:param mock_json_file_to_dict: mock of function json_file_to_dict
|
||||
:param _: patch of function _process_config_and_overrides (not tested)
|
||||
:return:
|
||||
:param target: The target to use
|
||||
"""
|
||||
set_targets_json_location()
|
||||
with patch.object(Config, '_process_config_and_overrides'),\
|
||||
patch('tools.config.json_file_to_dict') as mock_json_file_to_dict:
|
||||
app_config = "app_config"
|
||||
directory = '.'
|
||||
mock_return = {'config': 'test'}
|
||||
mock_return = {'config': {'test': False}}
|
||||
mock_json_file_to_dict.return_value = mock_return
|
||||
|
||||
config = Config(self.target, [directory], app_config=app_config)
|
||||
config = Config(target, [directory], app_config=app_config)
|
||||
|
||||
mock_json_file_to_dict.assert_called_once_with(app_config)
|
||||
self.assertEqual(config.app_config_data, mock_return,
|
||||
"app_config_data should be set to the returned value")
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
assert config.app_config_data == mock_return
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"b1": {
|
||||
"first_base": {
|
||||
"extra_labels": [],
|
||||
"default_lib": "std",
|
||||
"core": "Cortex-M0",
|
||||
|
|
@ -9,18 +9,7 @@
|
|||
"base1_3": "v_base1_3_b1"
|
||||
}
|
||||
},
|
||||
"d1": {
|
||||
"inherits": ["b1"],
|
||||
"config": {
|
||||
"derived1": "v_derived1_d1",
|
||||
"derived2": "v_derived2_d1"
|
||||
},
|
||||
"overrides": {
|
||||
"base1_1": "v_base1_1_d1",
|
||||
"base1_2": "v_base1_2_d1"
|
||||
}
|
||||
},
|
||||
"b2": {
|
||||
"second_base": {
|
||||
"extra_labels": [],
|
||||
"default_lib": "std",
|
||||
"core": "Cortex-M0",
|
||||
|
|
@ -30,8 +19,8 @@
|
|||
"base1_1": "v_base1_1_b2"
|
||||
}
|
||||
},
|
||||
"f": {
|
||||
"inherits": ["b2", "d1"],
|
||||
"double_config": {
|
||||
"inherits": ["first_base", "second_base"],
|
||||
"config": {
|
||||
"f1_1": "v_f1_1_f",
|
||||
"f1_2": "v_f1_2_f"
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"double_config": {
|
||||
"exception_msg": "Parameter name 'base1_1' defined in both 'target:second_base' and 'target:first_base'"
|
||||
},
|
||||
"second_base": {
|
||||
"target.base2_1": "v_base2_1_b2",
|
||||
"target.base2_2": "v_base2_2_b2",
|
||||
"target.base1_1": "v_base1_1_b2"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"K64F": {
|
||||
"exception_msg": "Library name 'lib1' is not unique"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"test_target": {
|
||||
"expected_features": ["IPV4", "STORAGE"]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,5 @@
|
|||
# Testing when two features collide
|
||||
|
||||
expected_results = {
|
||||
{
|
||||
"K64F": {
|
||||
"desc": "test feature collisions",
|
||||
"exception_msg": "Configuration conflict. The feature IPV4 both added and removed."
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"test_target": {
|
||||
"expected_features": ["IPV4", "STORAGE", "UVISOR"]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"test_target": {
|
||||
"lib2.test": "GOOD"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"test_target": {
|
||||
"expected_features": []
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"test_target": {
|
||||
"expected_features": ["UVISOR"]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"K64F": {
|
||||
"exception_msg": "Configuration conflict. The feature UVISOR both added and removed."
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"K64F": {
|
||||
"exception_msg": "Macro 'LIB2_1' defined in both 'library:lib2' and 'application' with incompatible values"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"K64F": {
|
||||
"exception_msg": "Unknown key(s)"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"K64F": {
|
||||
"exception_msg": "Unknown key(s)"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"K64F": {
|
||||
"exception_msg": "defined in both"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"test_target": {
|
||||
"expected_macros": ["APP1=10", "APP2", "LIB1_1=1","LIB1_2", "LIB2_1=5"]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,5 @@
|
|||
# This build on top of test5 by adding a few libraries with their own configurations
|
||||
# and overrides. The same targets are used for building and testing (base, b1, b2, both)
|
||||
|
||||
expected_results = {
|
||||
{
|
||||
"base": {
|
||||
"desc": "override values based on labels with libs (no labels)",
|
||||
"app.app1": "v_app1",
|
||||
"app.app2": "v_app2",
|
||||
"lib1.p1": "v_p1_lib1",
|
||||
|
|
@ -13,7 +9,6 @@ expected_results = {
|
|||
"lib2.p2": "v_p2_lib2"
|
||||
},
|
||||
"b1": {
|
||||
"desc": "override values based on labels with libs (first label)",
|
||||
"app.app1": "v_app1[b1_label]",
|
||||
"app.app2": "v_app2",
|
||||
"lib1.p1": "v_p1_lib1[b1_label]",
|
||||
|
|
@ -23,7 +18,6 @@ expected_results = {
|
|||
"lib2.p2": "v_p2_lib2[b1_label]"
|
||||
},
|
||||
"b2": {
|
||||
"desc": "override values based on labels with libs (second label)",
|
||||
"app.app1": "v_app1",
|
||||
"app.app2": "v_app2[b2_label]",
|
||||
"lib1.p1": "v_p1_lib1",
|
||||
|
|
@ -32,12 +26,7 @@ expected_results = {
|
|||
"lib2.p1": "v_p1_lib2[b2_label]",
|
||||
"lib2.p2": "v_p2_lib2[b2_label]"
|
||||
},
|
||||
# The values for lib2.p1 and lib2.p2 illustrate how overriding on multiple
|
||||
# labels work. In lib2, both lib2.p1 and lib2.p2 are overriden for both
|
||||
# labels (b1_label and b2_label). However, since "b2_label" is specified
|
||||
# after "b1_label", it sets the final values of the overrides.
|
||||
"both": {
|
||||
"desc": "override values based on labels with libs (both labels)",
|
||||
"app.app1": "v_app1[b1_label]",
|
||||
"app.app2": "v_app2[b2_label]",
|
||||
"lib1.p1": "v_p1_lib1[b1_label]",
|
||||
|
|
@ -45,5 +34,5 @@ expected_results = {
|
|||
"lib1.p3": "v_p3_lib1",
|
||||
"lib2.p1": "v_p1_lib2[b2_label]",
|
||||
"lib2.p2": "v_p2_lib2[b2_label]"
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,5 @@
|
|||
# This build on top of test6 by adding overrides for libs in the application
|
||||
|
||||
expected_results = {
|
||||
{
|
||||
"base": {
|
||||
"desc": "override values based on labels with libs (no labels)",
|
||||
"app.app1": "v_app1",
|
||||
"app.app2": "v_app2",
|
||||
"lib1.p1": "v_p1_lib1_app",
|
||||
|
|
@ -12,7 +9,6 @@ expected_results = {
|
|||
"lib2.p2": "v_p2_lib2"
|
||||
},
|
||||
"b1": {
|
||||
"desc": "override values based on labels with libs (first label)",
|
||||
"app.app1": "v_app1[b1_label]",
|
||||
"app.app2": "v_app2",
|
||||
"lib1.p1": "v_p1_lib1_app",
|
||||
|
|
@ -22,7 +18,6 @@ expected_results = {
|
|||
"lib2.p2": "v_p2_lib2[b1_label]"
|
||||
},
|
||||
"b2": {
|
||||
"desc": "override values based on labels with libs (second label)",
|
||||
"app.app1": "v_app1",
|
||||
"app.app2": "v_app2[b2_label]",
|
||||
"lib1.p1": "v_p1_lib1_app",
|
||||
|
|
@ -31,12 +26,7 @@ expected_results = {
|
|||
"lib2.p1": "v_p1_lib2_app",
|
||||
"lib2.p2": "v_p2_lib2[b2_label]"
|
||||
},
|
||||
# The values for lib2.p1 and lib2.p2 illustrate how overriding on multiple
|
||||
# labels work. In lib2, both lib2.p1 and lib2.p2 are overriden for both
|
||||
# labels (b1_label and b2_label). However, since "b2_label" is specified
|
||||
# after "b1_label", it sets the final values of the overrides.
|
||||
"both": {
|
||||
"desc": "override values based on labels with libs (both labels)",
|
||||
"app.app1": "v_app1[b1_label]",
|
||||
"app.app2": "v_app2[b2_label]",
|
||||
"lib1.p1": "v_p1_lib1_app",
|
||||
|
|
@ -1,9 +1,5 @@
|
|||
# This build on top of test7 by adding some configuration values in targets
|
||||
# and overriding them in the application
|
||||
|
||||
expected_results = {
|
||||
{
|
||||
"base": {
|
||||
"desc": "override values based on labels with libs and target params (no labels)",
|
||||
"app.app1": "v_app1",
|
||||
"app.app2": "v_app2",
|
||||
"lib1.p1": "v_p1_lib1_app",
|
||||
|
|
@ -16,7 +12,6 @@ expected_results = {
|
|||
"target.par3": "v_par3_base"
|
||||
},
|
||||
"b1": {
|
||||
"desc": "override values based on labels with libs and target params (first label)",
|
||||
"app.app1": "v_app1[b1_label]",
|
||||
"app.app2": "v_app2",
|
||||
"lib1.p1": "v_p1_lib1_app",
|
||||
|
|
@ -29,7 +24,6 @@ expected_results = {
|
|||
"target.par3": "v_par3_base"
|
||||
},
|
||||
"b2": {
|
||||
"desc": "override values based on labels with libs and target params (second label)",
|
||||
"app.app1": "v_app1",
|
||||
"app.app2": "v_app2[b2_label]",
|
||||
"lib1.p1": "v_p1_lib1_app",
|
||||
|
|
@ -42,7 +36,6 @@ expected_results = {
|
|||
"target.par3": "v_par3_base"
|
||||
},
|
||||
"both": {
|
||||
"desc": "override values based on labels with libs and target params (both labels)",
|
||||
"app.app1": "v_app1[b1_label]",
|
||||
"app.app2": "v_app2[b2_label]",
|
||||
"lib1.p1": "v_p1_lib1_app",
|
||||
|
|
@ -1,8 +1,5 @@
|
|||
# This builds on top of test8 by adding target-conditional overrides in mbed_app_config.json.
|
||||
|
||||
expected_results = {
|
||||
{
|
||||
"base": {
|
||||
"desc": "override values based on labels with libs, target params and target overrides (no labels)",
|
||||
"app.app1": "v_app1",
|
||||
"app.app2": "v_app2",
|
||||
"lib1.p1": "v_p1_lib1_app",
|
||||
|
|
@ -15,7 +12,6 @@ expected_results = {
|
|||
"target.par3": "v_par3_base"
|
||||
},
|
||||
"b1": {
|
||||
"desc": "override values based on labels with libs, target params and target overrides (first label)",
|
||||
"app.app1": "v_app1[b1_label_label]",
|
||||
"app.app2": "v_app2",
|
||||
"lib1.p1": "v_p1_lib1_app",
|
||||
|
|
@ -28,7 +24,6 @@ expected_results = {
|
|||
"target.par3": "v_par3_base"
|
||||
},
|
||||
"b2": {
|
||||
"desc": "override values based on labels with libs, target params and target overrides (second label)",
|
||||
"app.app1": "v_app1",
|
||||
"app.app2": "v_app2[b2_label]",
|
||||
"lib1.p1": "v_p1_lib1_app",
|
||||
|
|
@ -41,7 +36,6 @@ expected_results = {
|
|||
"target.par3": "v_par3_base"
|
||||
},
|
||||
"both": {
|
||||
"desc": "override values based on labels with libs, target params and target overrides (both labels)",
|
||||
"app.app1": "v_app1[b1_label_label]",
|
||||
"app.app2": "v_app2[b2_label]",
|
||||
"lib1.p1": "v_p1_lib1_app",
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"b1": {
|
||||
"first_base_target": {
|
||||
"extra_labels": [],
|
||||
"default_lib": "std",
|
||||
"core": "Cortex-M0",
|
||||
|
|
@ -9,8 +9,8 @@
|
|||
"base1_3": "v_base1_3_b1"
|
||||
}
|
||||
},
|
||||
"d1": {
|
||||
"inherits": ["b1"],
|
||||
"intermediate": {
|
||||
"inherits": ["first_base_target"],
|
||||
"config": {
|
||||
"derived1": "v_derived1_d1",
|
||||
"derived2": "v_derived2_d1"
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
"base1_2": "v_base1_2_d1"
|
||||
}
|
||||
},
|
||||
"b2": {
|
||||
"second_base_target": {
|
||||
"config": {
|
||||
"base2_1": "v_base2_1_b2",
|
||||
"base2_2": "v_base2_2_b2"
|
||||
|
|
@ -29,8 +29,8 @@
|
|||
"base1_1": "v_base1_1_b2"
|
||||
}
|
||||
},
|
||||
"f": {
|
||||
"inherits": ["b2", "d1"],
|
||||
"should_fail": {
|
||||
"inherits": ["second_base_target", "intermediate"],
|
||||
"config": {
|
||||
"f1_1": "v_f1_1_f",
|
||||
"f1_2": "v_f1_2_f"
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"should_fail": {
|
||||
"exception_msg": "Attempt to override undefined parameter 'base1_1' in 'target:second_base_target'"
|
||||
},
|
||||
"intermediate": {
|
||||
"target.base1_1": "v_base1_1_d1",
|
||||
"target.base1_2": "v_base1_2_d1",
|
||||
"target.base1_3": "v_base1_3_b1",
|
||||
"target.derived1": "v_derived1_d1",
|
||||
"target.derived2": "v_derived2_d1"
|
||||
}
|
||||
}
|
||||
|
|
@ -4,15 +4,15 @@
|
|||
"default_lib": "std",
|
||||
"core": "Cortex-M0"
|
||||
},
|
||||
"b1": {
|
||||
"left_intermediate": {
|
||||
"inherits": ["base"],
|
||||
"extra_labels_add": ["b1_label"]
|
||||
},
|
||||
"b2": {
|
||||
"right_intermediate": {
|
||||
"inherits": ["base"],
|
||||
"extra_labels_add": ["b2_label"]
|
||||
},
|
||||
"both": {
|
||||
"inherits": ["b1", "b2"]
|
||||
"inherits": ["left_intermediate", "right_intermediate"]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
# This build on top of test6 by adding an invalid override in mbed_app_override.json for b1_label.
|
||||
# This will prevent the configuration for working for b1 and both, but it should still
|
||||
# work for base and b2.
|
||||
|
||||
expected_results = {
|
||||
{
|
||||
"base": {
|
||||
"desc": "override values based on labels with libs (no labels)",
|
||||
"app.app1": "v_app1",
|
||||
"app.app2": "v_app2",
|
||||
"lib1.p1": "v_p1_lib1",
|
||||
|
|
@ -13,12 +8,10 @@ expected_results = {
|
|||
"lib2.p1": "v_p1_lib2",
|
||||
"lib2.p2": "v_p2_lib2"
|
||||
},
|
||||
"b1": {
|
||||
"desc": "override values based on labels with libs - invalid override (first label)",
|
||||
"left_intermediate": {
|
||||
"exception_msg": "Attempt to override undefined parameter 'app.app_wrong' in 'application[b1_label]"
|
||||
},
|
||||
"b2": {
|
||||
"desc": "override values based on labels with libs (second label)",
|
||||
"right_intermediate": {
|
||||
"app.app1": "v_app1",
|
||||
"app.app2": "v_app2[b2_label]",
|
||||
"lib1.p1": "v_p1_lib1",
|
||||
|
|
@ -28,7 +21,6 @@ expected_results = {
|
|||
"lib2.p2": "v_p2_lib2[b2_label]"
|
||||
},
|
||||
"both": {
|
||||
"desc": "override values based on labels with libs - invalid override (both labels)",
|
||||
"exception_msg": "Attempt to override undefined parameter 'app.app_wrong' in 'application[b1_label]"
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -4,11 +4,11 @@
|
|||
"app2": "v_app2"
|
||||
},
|
||||
"target_overrides": {
|
||||
"b1_label": {
|
||||
"app1": "v_app1[b1_label]"
|
||||
"left_intermediate_label": {
|
||||
"app1": "v_app1[left_intermediate_label]"
|
||||
},
|
||||
"b2_label": {
|
||||
"app2": "v_app2[b2_label]"
|
||||
"right_intermediate_label": {
|
||||
"app2": "v_app2[right_intermediate_label]"
|
||||
},
|
||||
"dummy_label": {
|
||||
"app1": "dummy.app1",
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"base": {
|
||||
"extra_labels": [],
|
||||
"default_lib": "std",
|
||||
"core": "Cortex-M0"
|
||||
},
|
||||
"left_intermediate": {
|
||||
"inherits": ["base"],
|
||||
"extra_labels_add": ["left_intermediate_label"]
|
||||
},
|
||||
"right_intermediate": {
|
||||
"inherits": ["base"],
|
||||
"extra_labels_add": ["right_intermediate_label"]
|
||||
},
|
||||
"both": {
|
||||
"inherits": ["left_intermediate", "right_intermediate"]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"left_intermediate": {
|
||||
"app.app1": "v_app1[left_intermediate_label]",
|
||||
"app.app2": "v_app2"
|
||||
},
|
||||
"right_intermediate": {
|
||||
"app.app1": "v_app1",
|
||||
"app.app2": "v_app2[right_intermediate_label]"
|
||||
},
|
||||
"both": {
|
||||
"app.app1": "v_app1[left_intermediate_label]",
|
||||
"app.app2": "v_app2[right_intermediate_label]"
|
||||
},
|
||||
"base": {
|
||||
"app.app1": "v_app1",
|
||||
"app.app2": "v_app2"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"K64F": {
|
||||
"exception_msg": "Invalid prefix 'lib2' for parameter name 'lib2.p1' in 'library:lib1[K64F]'"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"test_target": {
|
||||
"expected_features": ["IPV4"]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"b1": {
|
||||
"first_base": {
|
||||
"extra_labels": [],
|
||||
"default_lib": "std",
|
||||
"core": "Cortex-M0",
|
||||
|
|
@ -9,8 +9,8 @@
|
|||
"base1_3": "v_base1_3_b1"
|
||||
}
|
||||
},
|
||||
"d1": {
|
||||
"inherits": ["b1"],
|
||||
"intermediate": {
|
||||
"inherits": ["first_base"],
|
||||
"config": {
|
||||
"derived1": "v_derived1_d1",
|
||||
"derived2": "v_derived2_d1"
|
||||
|
|
@ -20,14 +20,14 @@
|
|||
"base1_2": "v_base1_2_d1"
|
||||
}
|
||||
},
|
||||
"b2": {
|
||||
"second_base": {
|
||||
"config": {
|
||||
"base2_1": "v_base2_1_b2",
|
||||
"base2_2": "v_base2_2_b2"
|
||||
}
|
||||
},
|
||||
"f": {
|
||||
"inherits": ["b2", "d1"],
|
||||
"inherits_tree": {
|
||||
"inherits": ["second_base", "intermediate"],
|
||||
"config": {
|
||||
"f1_1": "v_f1_1_f",
|
||||
"f1_2": "v_f1_2_f"
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"inherits_tree": {
|
||||
"target.base1_1": "v_base1_1_f",
|
||||
"target.base1_2": "v_base1_2_d1",
|
||||
"target.base1_3": "v_base1_3_b1",
|
||||
"target.derived1": "v_derived1_d1",
|
||||
"target.derived2": "v_derived2_f",
|
||||
"target.base2_1": "v_base2_1_f",
|
||||
"target.base2_2": "v_base2_2_b2",
|
||||
"target.f1_1": "v_f1_1_f_override",
|
||||
"target.f1_2": "v_f1_2_f"
|
||||
},
|
||||
"first_base": {
|
||||
"target.base1_1": "v_base1_1_b1",
|
||||
"target.base1_2": "v_base1_2_b1",
|
||||
"target.base1_3": "v_base1_3_b1"
|
||||
},
|
||||
"intermediate": {
|
||||
"target.base1_1": "v_base1_1_d1",
|
||||
"target.base1_2": "v_base1_2_d1",
|
||||
"target.base1_3": "v_base1_3_b1",
|
||||
"target.derived1": "v_derived1_d1",
|
||||
"target.derived2": "v_derived2_d1"
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue