mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #971 from PrzemekWirkus/mcu_filter_for_auto
Added to option --auto handler for -f <mcu> filter switch.pull/973/head
commit
fdc75bf508
|
@ -85,7 +85,7 @@ def get_version():
|
|||
""" Returns test script version
|
||||
"""
|
||||
single_test_version_major = 1
|
||||
single_test_version_minor = 3
|
||||
single_test_version_minor = 4
|
||||
return (single_test_version_major, single_test_version_minor)
|
||||
|
||||
|
||||
|
@ -154,11 +154,13 @@ if __name__ == '__main__':
|
|||
use_default_toolchain = 'default' in opts.toolchains_filter.split(',') if opts.toolchains_filter is not None else True
|
||||
use_supported_toolchains = 'all' in opts.toolchains_filter.split(',') if opts.toolchains_filter is not None else False
|
||||
toolchain_filter = opts.toolchains_filter
|
||||
platform_name_filter = opts.general_filter_regex.split(',') if opts.general_filter_regex is not None else opts.general_filter_regex
|
||||
# Test specification with information about each target and associated toolchain
|
||||
test_spec = get_autodetected_TEST_SPEC(muts_list,
|
||||
use_default_toolchain=use_default_toolchain,
|
||||
use_supported_toolchains=use_supported_toolchains,
|
||||
toolchain_filter=toolchain_filter)
|
||||
toolchain_filter=toolchain_filter,
|
||||
platform_name_filter=platform_name_filter)
|
||||
# MUTs configuration auto-detection
|
||||
MUTs = get_autodetected_MUTS(muts_list)
|
||||
else:
|
||||
|
|
|
@ -1451,13 +1451,16 @@ def get_module_avail(module_name):
|
|||
return module_name in sys.modules.keys()
|
||||
|
||||
|
||||
def get_autodetected_MUTS(mbeds_list):
|
||||
def get_autodetected_MUTS(mbeds_list, platform_name_filter=None):
|
||||
""" Function detects all connected to host mbed-enabled devices and generates artificial MUTS file.
|
||||
If function fails to auto-detect devices it will return empty dictionary.
|
||||
|
||||
if get_module_avail('mbed_lstools'):
|
||||
mbeds = mbed_lstools.create()
|
||||
mbeds_list = mbeds.list_mbeds()
|
||||
|
||||
@param mbeds_list list of mbeds captured from mbed_lstools
|
||||
@param platform_name You can filter 'platform_name' with list of filtered targets from 'platform_name_filter'
|
||||
"""
|
||||
result = {} # Should be in muts_all.json format
|
||||
# Align mbeds_list from mbed_lstools to MUT file format (JSON dictionary with muts)
|
||||
|
@ -1476,7 +1479,11 @@ def get_autodetected_MUTS(mbeds_list):
|
|||
return result
|
||||
|
||||
|
||||
def get_autodetected_TEST_SPEC(mbeds_list, use_default_toolchain=True, use_supported_toolchains=False, toolchain_filter=None):
|
||||
def get_autodetected_TEST_SPEC(mbeds_list,
|
||||
use_default_toolchain=True,
|
||||
use_supported_toolchains=False,
|
||||
toolchain_filter=None,
|
||||
platform_name_filter=None):
|
||||
""" Function detects all connected to host mbed-enabled devices and generates artificial test_spec file.
|
||||
If function fails to auto-detect devices it will return empty 'targets' test_spec description.
|
||||
|
||||
|
@ -1488,23 +1495,24 @@ def get_autodetected_TEST_SPEC(mbeds_list, use_default_toolchain=True, use_suppo
|
|||
|
||||
for mut in mbeds_list:
|
||||
mcu = mut['platform_name']
|
||||
if mcu in TARGET_MAP:
|
||||
default_toolchain = TARGET_MAP[mcu].default_toolchain
|
||||
supported_toolchains = TARGET_MAP[mcu].supported_toolchains
|
||||
if platform_name_filter is None or (platform_name_filter and mut['platform_name'] in platform_name_filter):
|
||||
if mcu in TARGET_MAP:
|
||||
default_toolchain = TARGET_MAP[mcu].default_toolchain
|
||||
supported_toolchains = TARGET_MAP[mcu].supported_toolchains
|
||||
|
||||
# Decide which toolchains should be added to test specification toolchain pool for each target
|
||||
toolchains = []
|
||||
if use_default_toolchain:
|
||||
toolchains.append(default_toolchain)
|
||||
if use_supported_toolchains:
|
||||
toolchains += supported_toolchains
|
||||
if toolchain_filter is not None:
|
||||
all_toolchains = supported_toolchains + [default_toolchain]
|
||||
for toolchain in toolchain_filter.split(','):
|
||||
if toolchain in all_toolchains:
|
||||
toolchains.append(toolchain)
|
||||
# Decide which toolchains should be added to test specification toolchain pool for each target
|
||||
toolchains = []
|
||||
if use_default_toolchain:
|
||||
toolchains.append(default_toolchain)
|
||||
if use_supported_toolchains:
|
||||
toolchains += supported_toolchains
|
||||
if toolchain_filter is not None:
|
||||
all_toolchains = supported_toolchains + [default_toolchain]
|
||||
for toolchain in toolchain_filter.split(','):
|
||||
if toolchain in all_toolchains:
|
||||
toolchains.append(toolchain)
|
||||
|
||||
result['targets'][mcu] = list(set(toolchains))
|
||||
result['targets'][mcu] = list(set(toolchains))
|
||||
return result
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue