mirror of https://github.com/ARMmbed/mbed-os.git
Allow tools to use networkinterface configs in tests
parent
8f9242fe40
commit
8c0bc781d9
|
|
@ -608,6 +608,9 @@
|
||||||
"detect_code": ["0240"],
|
"detect_code": ["0240"],
|
||||||
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPI_ASYNCH", "SPISLAVE", "STDIO_MESSAGES", "STORAGE", "TRNG", "FLASH"],
|
"device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPI_ASYNCH", "SPISLAVE", "STDIO_MESSAGES", "STORAGE", "TRNG", "FLASH"],
|
||||||
"features": ["LWIP", "STORAGE"],
|
"features": ["LWIP", "STORAGE"],
|
||||||
|
"network_test_configurations" : {
|
||||||
|
"EthernetInterface" : "mbed-os/tools/test/network_test_configs/EthernetInterface.json"
|
||||||
|
},
|
||||||
"release_versions": ["2", "5"],
|
"release_versions": ["2", "5"],
|
||||||
"device_name": "MK64FN1M0xxx12",
|
"device_name": "MK64FN1M0xxx12",
|
||||||
"bootloader_supported": true
|
"bootloader_supported": true
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
||||||
sys.path.insert(0, ROOT)
|
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, print_tests, build_tests, test_spec_from_test_builds
|
from tools.test_api import test_path_to_name, find_tests, find_configs, print_tests, build_tests, test_spec_from_test_builds
|
||||||
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
|
||||||
|
|
@ -84,6 +84,9 @@ if __name__ == '__main__':
|
||||||
parser.add_argument("-n", "--names", dest="names", type=argparse_many(str),
|
parser.add_argument("-n", "--names", dest="names", type=argparse_many(str),
|
||||||
default=None, help="Limit the tests to a comma separated list of names")
|
default=None, help="Limit the tests to a comma separated list of names")
|
||||||
|
|
||||||
|
parser.add_argument("--net-config", dest="net_config", type=str,
|
||||||
|
default="EthernetInterface", help="Limit the tests to a networkinterface")
|
||||||
|
|
||||||
parser.add_argument("--test-spec", dest="test_spec",
|
parser.add_argument("--test-spec", dest="test_spec",
|
||||||
default=None, help="Destination path for a test spec file that can be used by the Greentea automated test tool")
|
default=None, help="Destination path for a test spec file that can be used by the Greentea automated test tool")
|
||||||
|
|
||||||
|
|
@ -133,10 +136,19 @@ if __name__ == '__main__':
|
||||||
"Currently set search path: %s"
|
"Currently set search path: %s"
|
||||||
% (toolchain, search_path))
|
% (toolchain, search_path))
|
||||||
|
|
||||||
|
net_configs = find_configs(mcu) # will be {} if target has no network configs
|
||||||
|
# If there is no app config and the target has network configs
|
||||||
|
# TODO: merge app_config and net_config if there is both
|
||||||
|
if net_configs and not options.app_config:
|
||||||
|
# use a specified network config
|
||||||
|
config = net_configs[options.net_config]
|
||||||
|
else:
|
||||||
|
config = options.app_config
|
||||||
|
|
||||||
# Find all tests in the relevant paths
|
# Find all tests in the relevant paths
|
||||||
for path in all_paths:
|
for path in all_paths:
|
||||||
all_tests.update(find_tests(path, mcu, toolchain,
|
all_tests.update(find_tests(path, mcu, toolchain,
|
||||||
app_config=options.app_config))
|
app_config=config))
|
||||||
|
|
||||||
# Filter tests by name if specified
|
# Filter tests by name if specified
|
||||||
if options.names:
|
if options.names:
|
||||||
|
|
@ -192,7 +204,7 @@ if __name__ == '__main__':
|
||||||
properties=build_properties, name="mbed-build",
|
properties=build_properties, name="mbed-build",
|
||||||
macros=options.macros, verbose=options.verbose,
|
macros=options.macros, verbose=options.verbose,
|
||||||
notify=notify, archive=False,
|
notify=notify, archive=False,
|
||||||
app_config=options.app_config,
|
app_config=config,
|
||||||
build_profile=profile)
|
build_profile=profile)
|
||||||
|
|
||||||
library_build_success = True
|
library_build_success = True
|
||||||
|
|
@ -220,7 +232,7 @@ if __name__ == '__main__':
|
||||||
notify=notify,
|
notify=notify,
|
||||||
jobs=options.jobs,
|
jobs=options.jobs,
|
||||||
continue_on_build_fail=options.continue_on_build_fail,
|
continue_on_build_fail=options.continue_on_build_fail,
|
||||||
app_config=options.app_config,
|
app_config=config,
|
||||||
build_profile=profile,
|
build_profile=profile,
|
||||||
stats_depth=options.stats_depth)
|
stats_depth=options.stats_depth)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"header-file": {
|
||||||
|
"help" : "String for including your driver header file",
|
||||||
|
"value" : "\"EthernetInterface.h\""
|
||||||
|
},
|
||||||
|
"object-construction" : {
|
||||||
|
"value" : "new EthernetInterface()"
|
||||||
|
},
|
||||||
|
"connect-statement" : {
|
||||||
|
"help" : "Must use 'net' variable name",
|
||||||
|
"value" : "((EthernetInterface *)net)->connect()"
|
||||||
|
},
|
||||||
|
"echo-server-addr" : {
|
||||||
|
"help" : "IP address of echo server",
|
||||||
|
"value" : "\"195.34.89.241\""
|
||||||
|
},
|
||||||
|
"echo-server-port" : {
|
||||||
|
"help" : "Port of echo server",
|
||||||
|
"value" : "7"
|
||||||
|
},
|
||||||
|
"tcp-echo-prefix" : {
|
||||||
|
"help" : "Some servers send a prefix before echoed message",
|
||||||
|
"value" : "\"u-blox AG TCP/UDP test service\\n\""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1999,6 +1999,13 @@ def test_path_to_name(path, base):
|
||||||
|
|
||||||
return "-".join(name_parts).lower()
|
return "-".join(name_parts).lower()
|
||||||
|
|
||||||
|
def find_configs(target_name):
|
||||||
|
target = TARGET_MAP[target_name]
|
||||||
|
try:
|
||||||
|
return target.network_test_configurations
|
||||||
|
except AttributeError:
|
||||||
|
return {}
|
||||||
|
|
||||||
def find_tests(base_dir, target_name, toolchain_name, app_config=None):
|
def find_tests(base_dir, target_name, toolchain_name, app_config=None):
|
||||||
""" Finds all tests in a directory recursively
|
""" Finds all tests in a directory recursively
|
||||||
base_dir: path to the directory to scan for tests (ex. 'path/to/project')
|
base_dir: path to the directory to scan for tests (ex. 'path/to/project')
|
||||||
|
|
@ -2010,6 +2017,8 @@ def find_tests(base_dir, target_name, toolchain_name, app_config=None):
|
||||||
|
|
||||||
tests = {}
|
tests = {}
|
||||||
|
|
||||||
|
configs = find_configs(target_name)
|
||||||
|
|
||||||
# Prepare the toolchain
|
# Prepare the toolchain
|
||||||
toolchain = prepare_toolchain([base_dir], None, target_name, toolchain_name,
|
toolchain = prepare_toolchain([base_dir], None, target_name, toolchain_name,
|
||||||
silent=True, app_config=app_config)
|
silent=True, app_config=app_config)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue