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"],
|
||||
"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"],
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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