mirror of https://github.com/ARMmbed/mbed-os.git
Use new notifier API in test infra
parent
3bd691a342
commit
de91c93108
|
@ -35,6 +35,7 @@ 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
|
||||||
from tools.build_api import merge_build_data
|
from tools.build_api import merge_build_data
|
||||||
from tools.targets import TARGET_MAP
|
from tools.targets import TARGET_MAP
|
||||||
|
from tools.notifier.term import TerminalNotifier
|
||||||
from tools.utils import mkdir, ToolException, NotSupportedException, args_error
|
from tools.utils import mkdir, ToolException, NotSupportedException, args_error
|
||||||
from tools.test_exporters import ReportExporter, ResultExporterType
|
from tools.test_exporters import ReportExporter, ResultExporterType
|
||||||
from tools.utils import argparse_filestring_type, argparse_lowercase_type, argparse_many
|
from tools.utils import argparse_filestring_type, argparse_lowercase_type, argparse_many
|
||||||
|
@ -170,16 +171,7 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
tests = all_tests
|
tests = all_tests
|
||||||
|
|
||||||
if options.color:
|
notify = TerminalNotifier(options.verbose)
|
||||||
# This import happens late to prevent initializing colorization when we don't need it
|
|
||||||
import colorize
|
|
||||||
if options.verbose:
|
|
||||||
notify = mbedToolchain.print_notify_verbose
|
|
||||||
else:
|
|
||||||
notify = mbedToolchain.print_notify
|
|
||||||
notify = colorize.print_in_color_notifier(CLI_COLOR_MAP, notify)
|
|
||||||
else:
|
|
||||||
notify = None
|
|
||||||
|
|
||||||
if options.list:
|
if options.list:
|
||||||
# Print available tests in order and exit
|
# Print available tests in order and exit
|
||||||
|
@ -207,7 +199,7 @@ if __name__ == '__main__':
|
||||||
toolchain, jobs=options.jobs,
|
toolchain, jobs=options.jobs,
|
||||||
clean=options.clean, report=build_report,
|
clean=options.clean, report=build_report,
|
||||||
properties=build_properties, name="mbed-build",
|
properties=build_properties, name="mbed-build",
|
||||||
macros=options.macros, verbose=options.verbose,
|
macros=options.macros,
|
||||||
notify=notify, archive=False,
|
notify=notify, archive=False,
|
||||||
app_config=config,
|
app_config=config,
|
||||||
build_profile=profile)
|
build_profile=profile)
|
||||||
|
@ -227,13 +219,11 @@ if __name__ == '__main__':
|
||||||
print("Failed to build library")
|
print("Failed to build library")
|
||||||
else:
|
else:
|
||||||
# Build all the tests
|
# Build all the tests
|
||||||
|
|
||||||
test_build_success, test_build = build_tests(tests, [options.build_dir], options.build_dir, mcu, toolchain,
|
test_build_success, test_build = build_tests(tests, [options.build_dir], options.build_dir, mcu, toolchain,
|
||||||
clean=options.clean,
|
clean=options.clean,
|
||||||
report=build_report,
|
report=build_report,
|
||||||
properties=build_properties,
|
properties=build_properties,
|
||||||
macros=options.macros,
|
macros=options.macros,
|
||||||
verbose=options.verbose,
|
|
||||||
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,
|
||||||
|
|
|
@ -2078,7 +2078,7 @@ def find_tests(base_dir, target_name, toolchain_name, app_config=None):
|
||||||
|
|
||||||
# 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)
|
app_config=app_config)
|
||||||
|
|
||||||
# Scan the directory for paths to probe for 'TESTS' folders
|
# Scan the directory for paths to probe for 'TESTS' folders
|
||||||
base_resources = scan_resources([base_dir], toolchain)
|
base_resources = scan_resources([base_dir], toolchain)
|
||||||
|
@ -2206,7 +2206,7 @@ def build_test_worker(*args, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
|
def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
|
||||||
clean=False, notify=None, verbose=False, jobs=1, macros=None,
|
clean=False, notify=None, jobs=1, macros=None,
|
||||||
silent=False, report=None, properties=None,
|
silent=False, report=None, properties=None,
|
||||||
continue_on_build_fail=False, app_config=None,
|
continue_on_build_fail=False, app_config=None,
|
||||||
build_profile=None, stats_depth=None):
|
build_profile=None, stats_depth=None):
|
||||||
|
@ -2258,12 +2258,12 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
|
||||||
'project_id': test_name,
|
'project_id': test_name,
|
||||||
'report': report,
|
'report': report,
|
||||||
'properties': properties,
|
'properties': properties,
|
||||||
'verbose': verbose,
|
|
||||||
'app_config': app_config,
|
'app_config': app_config,
|
||||||
'build_profile': build_profile,
|
'build_profile': build_profile,
|
||||||
'silent': True,
|
'silent': True,
|
||||||
'toolchain_paths': TOOLCHAIN_PATHS,
|
'toolchain_paths': TOOLCHAIN_PATHS,
|
||||||
'stats_depth': stats_depth
|
'stats_depth': stats_depth,
|
||||||
|
'notify': notify
|
||||||
}
|
}
|
||||||
|
|
||||||
results.append(p.apply_async(build_test_worker, args, kwargs))
|
results.append(p.apply_async(build_test_worker, args, kwargs))
|
||||||
|
|
Loading…
Reference in New Issue