mirror of https://github.com/ARMmbed/mbed-os.git
Add option to add a configuration file for modules
parent
8c0bc781d9
commit
e982eed4ad
|
|
@ -87,6 +87,9 @@ if __name__ == '__main__':
|
|||
parser.add_argument("--net-config", dest="net_config", type=str,
|
||||
default="EthernetInterface", help="Limit the tests to a networkinterface")
|
||||
|
||||
parser.add_argument("--module-config", dest="module_config", type=str,
|
||||
default=None, help="Test config for a module")
|
||||
|
||||
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")
|
||||
|
||||
|
|
@ -136,11 +139,12 @@ if __name__ == '__main__':
|
|||
"Currently set search path: %s"
|
||||
% (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
|
||||
# Assign config file. Precedence: module_config>net_config>app_config
|
||||
# TODO: merge configs if there are multiple
|
||||
if options.module_config:
|
||||
config = options.module_config
|
||||
elif find_configs(mcu):
|
||||
net_configs = find_configs(mcu) # will be {} if target has no network configs
|
||||
config = net_configs[options.net_config]
|
||||
else:
|
||||
config = options.app_config
|
||||
|
|
@ -148,7 +152,8 @@ if __name__ == '__main__':
|
|||
# Find all tests in the relevant paths
|
||||
for path in all_paths:
|
||||
all_tests.update(find_tests(path, mcu, toolchain,
|
||||
app_config=config))
|
||||
app_config=config,
|
||||
module_config=options.module_config))
|
||||
|
||||
# Filter tests by name if specified
|
||||
if options.names:
|
||||
|
|
|
|||
|
|
@ -2006,7 +2006,7 @@ def find_configs(target_name):
|
|||
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, module_config=None):
|
||||
""" Finds all tests in a directory recursively
|
||||
base_dir: path to the directory to scan for tests (ex. 'path/to/project')
|
||||
target_name: name of the target to use for scanning (ex. 'K64F')
|
||||
|
|
@ -2046,6 +2046,11 @@ def find_tests(base_dir, target_name, toolchain_name, app_config=None):
|
|||
test_group_directory_path, test_case_directory = os.path.split(d)
|
||||
test_group_directory = os.path.basename(test_group_directory_path)
|
||||
|
||||
# If the target has no network interface configuration, netsocket tests fail to compile
|
||||
if not module_config and not configs and \
|
||||
(test_case_directory == 'netsocket' or test_group_directory == 'netsocket'):
|
||||
continue
|
||||
|
||||
# Check to make sure discoverd folder is not in a host test directory
|
||||
if test_case_directory != 'host_tests' and test_group_directory != 'host_tests':
|
||||
test_name = test_path_to_name(d, base_dir)
|
||||
|
|
|
|||
Loading…
Reference in New Issue