Use new notifier API in test infra

pull/6781/head
Jimmy Brisson 2018-04-26 09:32:43 -05:00
parent 3bd691a342
commit de91c93108
2 changed files with 7 additions and 17 deletions

View File

@ -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 merge_build_data
from tools.targets import TARGET_MAP
from tools.notifier.term import TerminalNotifier
from tools.utils import mkdir, ToolException, NotSupportedException, args_error
from tools.test_exporters import ReportExporter, ResultExporterType
from tools.utils import argparse_filestring_type, argparse_lowercase_type, argparse_many
@ -170,16 +171,7 @@ if __name__ == '__main__':
else:
tests = all_tests
if options.color:
# 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
notify = TerminalNotifier(options.verbose)
if options.list:
# Print available tests in order and exit
@ -207,7 +199,7 @@ if __name__ == '__main__':
toolchain, jobs=options.jobs,
clean=options.clean, report=build_report,
properties=build_properties, name="mbed-build",
macros=options.macros, verbose=options.verbose,
macros=options.macros,
notify=notify, archive=False,
app_config=config,
build_profile=profile)
@ -227,13 +219,11 @@ if __name__ == '__main__':
print("Failed to build library")
else:
# Build all the tests
test_build_success, test_build = build_tests(tests, [options.build_dir], options.build_dir, mcu, toolchain,
clean=options.clean,
report=build_report,
properties=build_properties,
macros=options.macros,
verbose=options.verbose,
notify=notify,
jobs=options.jobs,
continue_on_build_fail=options.continue_on_build_fail,

View File

@ -2078,7 +2078,7 @@ def find_tests(base_dir, target_name, toolchain_name, app_config=None):
# Prepare the toolchain
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
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,
clean=False, notify=None, verbose=False, jobs=1, macros=None,
clean=False, notify=None, jobs=1, macros=None,
silent=False, report=None, properties=None,
continue_on_build_fail=False, app_config=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,
'report': report,
'properties': properties,
'verbose': verbose,
'app_config': app_config,
'build_profile': build_profile,
'silent': True,
'toolchain_paths': TOOLCHAIN_PATHS,
'stats_depth': stats_depth
'stats_depth': stats_depth,
'notify': notify
}
results.append(p.apply_async(build_test_worker, args, kwargs))