mirror of https://github.com/ARMmbed/mbed-os.git
Move test config keys out of targets.json
Change TestConfig class methods to module methodspull/4795/head
parent
e48f9948a7
commit
4161e5c48d
|
@ -1688,13 +1688,8 @@
|
||||||
"supported_form_factors": ["ARDUINO"],
|
"supported_form_factors": ["ARDUINO"],
|
||||||
"core": "Cortex-M4F",
|
"core": "Cortex-M4F",
|
||||||
"extra_labels_add": ["STM32F4", "STM32F439", "STM32F439ZI","STM32F439xx", "STM32F439xI"],
|
"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"],
|
"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"],
|
"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"],
|
"device_has_remove": ["RTC", "SLEEP"],
|
||||||
"features": ["LWIP"],
|
"features": ["LWIP"],
|
||||||
"release_versions": ["5"],
|
"release_versions": ["5"],
|
||||||
|
|
|
@ -28,7 +28,7 @@ sys.path.insert(0, ROOT)
|
||||||
|
|
||||||
from tools.config import ConfigException
|
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_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.options import get_default_options_parser, extract_profile, extract_mcus
|
||||||
from tools.build_api import build_project, build_library
|
from tools.build_api import build_project, build_library
|
||||||
from tools.build_api import print_build_memory_usage
|
from tools.build_api import print_build_memory_usage
|
||||||
|
|
|
@ -50,7 +50,7 @@ from tools.utils import NotSupportedException
|
||||||
from tools.utils import construct_enum
|
from tools.utils import construct_enum
|
||||||
from tools.memap import MemapParser
|
from tools.memap import MemapParser
|
||||||
from tools.targets import TARGET_MAP
|
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.test_db import BaseDBAccess
|
||||||
from tools.build_api import build_project, build_mbed_libs, build_lib
|
from tools.build_api import build_project, build_mbed_libs, build_lib
|
||||||
from tools.build_api import get_target_supported_toolchains
|
from tools.build_api import get_target_supported_toolchains
|
||||||
|
|
|
@ -1,34 +1,33 @@
|
||||||
from os.path import dirname, abspath, join
|
from os.path import dirname, abspath, join
|
||||||
|
|
||||||
from tools.utils import json_file_to_dict
|
from tools.utils import json_file_to_dict
|
||||||
from tools.targets import TARGET_MAP
|
|
||||||
|
|
||||||
class TestConfig:
|
CONFIG_DIR = dirname(abspath(__file__))
|
||||||
CONFIG_DIR = dirname(abspath(__file__))
|
CONFIG_MAP = json_file_to_dict(join(CONFIG_DIR, "config_paths.json"))
|
||||||
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(target_name):
|
||||||
def get_valid_configs(cls, target_name):
|
if target_name in TARGET_CONFIGS:
|
||||||
target = TARGET_MAP[target_name]
|
target_config = TARGET_CONFIGS[target_name]
|
||||||
config_dict = {}
|
else:
|
||||||
for attr in cls.CONFIG_MAP:
|
return {}
|
||||||
if attr in target.device_has:
|
|
||||||
config_dict[attr] = cls.CONFIG_MAP[attr]
|
|
||||||
return config_dict
|
|
||||||
|
|
||||||
@classmethod
|
config_dict = {}
|
||||||
def get_config_path(cls, conf_name, target_name):
|
for attr in CONFIG_MAP:
|
||||||
configs = cls.get_valid_configs(target_name)
|
if attr in target_config['test_configurations']:
|
||||||
if configs and conf_name.upper() in configs:
|
config_dict[attr] = CONFIG_MAP[attr]
|
||||||
return join(cls.CONFIG_DIR, configs[conf_name.upper()])
|
return config_dict
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
@classmethod
|
def get_config_path(conf_name, target_name):
|
||||||
def get_default_config(cls, target_name):
|
configs = get_valid_configs(target_name)
|
||||||
configs = cls.get_valid_configs(target_name)
|
if configs and conf_name.upper() in configs:
|
||||||
if configs:
|
return join(CONFIG_DIR, configs[conf_name.upper()])
|
||||||
keys = configs.keys()
|
else:
|
||||||
return join(cls.CONFIG_DIR, configs[keys[0]])
|
return None
|
||||||
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
|
||||||
|
|
|
@ -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"]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue