diff --git a/targets/targets.json b/targets/targets.json index 25d315ba2a..452e29db01 100644 --- a/targets/targets.json +++ b/targets/targets.json @@ -1688,13 +1688,8 @@ "supported_form_factors": ["ARDUINO"], "core": "Cortex-M4F", "extra_labels_add": ["STM32F4", "STM32F439", "STM32F439ZI","STM32F439xx", "STM32F439xI"], -<<<<<<< HEAD "macros": ["MBEDTLS_CONFIG_HW_SUPPORT", "HSE_VALUE=24000000", "HSE_STARTUP_TIMEOUT=5000", "CB_INTERFACE_SDIO","CB_CHIP_WL18XX","SUPPORT_80211D_ALWAYS","WLAN_ENABLED","MBEDTLS_ARC4_C","MBEDTLS_DES_C","MBEDTLS_MD4_C","MBEDTLS_MD5_C","MBEDTLS_SHA1_C"], "device_has_add": ["CAN", "EMAC", "TRNG", "FLASH"], -======= - "macros": ["HSE_VALUE=24000000", "HSE_STARTUP_TIMEOUT=5000", "CB_INTERFACE_SDIO","CB_CHIP_WL18XX","SUPPORT_80211D_ALWAYS","WLAN_ENABLED","MBEDTLS_ARC4_C","MBEDTLS_DES_C","MBEDTLS_MD4_C","MBEDTLS_MD5_C","MBEDTLS_SHA1_C"], - "device_has_add": ["CAN", "EMAC", "TRNG", "FLASH", "ETHERNET", "ODIN_WIFI"], ->>>>>>> Add ETHERNET and ODIN_WIFI to odin device has. Add odin WiFi test configuration "device_has_remove": ["RTC", "SLEEP"], "features": ["LWIP"], "release_versions": ["5"], diff --git a/tools/test.py b/tools/test.py index 81b0c1b2c8..48b7a92349 100644 --- a/tools/test.py +++ b/tools/test.py @@ -28,7 +28,7 @@ sys.path.insert(0, ROOT) from tools.config import ConfigException from tools.test_api import test_path_to_name, find_tests, get_test_config, print_tests, build_tests, test_spec_from_test_builds -from tools.test_configs import TestConfig +import tools.test_configs as TestConfig from tools.options import get_default_options_parser, extract_profile, extract_mcus from tools.build_api import build_project, build_library from tools.build_api import print_build_memory_usage diff --git a/tools/test_api.py b/tools/test_api.py index e5f915f16f..302cbbd06f 100644 --- a/tools/test_api.py +++ b/tools/test_api.py @@ -50,7 +50,7 @@ from tools.utils import NotSupportedException from tools.utils import construct_enum from tools.memap import MemapParser from tools.targets import TARGET_MAP -from tools.test_configs import TestConfig +import tools.test_configs as TestConfig from tools.test_db import BaseDBAccess from tools.build_api import build_project, build_mbed_libs, build_lib from tools.build_api import get_target_supported_toolchains diff --git a/tools/test_configs/__init__.py b/tools/test_configs/__init__.py index 07e0a170fa..4242819fa0 100644 --- a/tools/test_configs/__init__.py +++ b/tools/test_configs/__init__.py @@ -1,34 +1,33 @@ from os.path import dirname, abspath, join from tools.utils import json_file_to_dict -from tools.targets import TARGET_MAP -class TestConfig: - CONFIG_DIR = dirname(abspath(__file__)) - CONFIG_MAP = json_file_to_dict(join(CONFIG_DIR, "config_paths.json")) +CONFIG_DIR = dirname(abspath(__file__)) +CONFIG_MAP = json_file_to_dict(join(CONFIG_DIR, "config_paths.json")) +TARGET_CONFIGS = json_file_to_dict(join(CONFIG_DIR, "target_configs.json")) - @classmethod - def get_valid_configs(cls, target_name): - target = TARGET_MAP[target_name] - config_dict = {} - for attr in cls.CONFIG_MAP: - if attr in target.device_has: - config_dict[attr] = cls.CONFIG_MAP[attr] - return config_dict +def get_valid_configs(target_name): + if target_name in TARGET_CONFIGS: + target_config = TARGET_CONFIGS[target_name] + else: + return {} - @classmethod - def get_config_path(cls, conf_name, target_name): - configs = cls.get_valid_configs(target_name) - if configs and conf_name.upper() in configs: - return join(cls.CONFIG_DIR, configs[conf_name.upper()]) - else: - return None + config_dict = {} + for attr in CONFIG_MAP: + if attr in target_config['test_configurations']: + config_dict[attr] = CONFIG_MAP[attr] + return config_dict - @classmethod - def get_default_config(cls, target_name): - configs = cls.get_valid_configs(target_name) - if configs: - keys = configs.keys() - return join(cls.CONFIG_DIR, configs[keys[0]]) - else: - return None +def get_config_path(conf_name, target_name): + configs = get_valid_configs(target_name) + if configs and conf_name.upper() in configs: + return join(CONFIG_DIR, configs[conf_name.upper()]) + else: + return None + +def get_default_config(target_name): + if target_name in TARGET_CONFIGS: + config_name = TARGET_CONFIGS[target_name]['default_test_configuration'] + return join(CONFIG_DIR, CONFIG_MAP[config_name]) + else: + return None diff --git a/tools/test_configs/target_configs.json b/tools/test_configs/target_configs.json new file mode 100644 index 0000000000..ba615ddb8f --- /dev/null +++ b/tools/test_configs/target_configs.json @@ -0,0 +1,10 @@ +{ + "UBLOX_EVK_ODIN_W2": { + "default_test_configuration": "ODIN_WIFI", + "test_configurations": ["ODIN_WIFI", "ETHERNET"] + }, + "K64F": { + "default_test_configuration": "ETHERNET", + "test_configurations": ["ETHERNET"] + } +}