Skip to content

Commit de91c93

Browse files
committed
Use new notifier API in test infra
1 parent 3bd691a commit de91c93

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

tools/test.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from tools.build_api import print_build_memory_usage
3636
from tools.build_api import merge_build_data
3737
from tools.targets import TARGET_MAP
38+
from tools.notifier.term import TerminalNotifier
3839
from tools.utils import mkdir, ToolException, NotSupportedException, args_error
3940
from tools.test_exporters import ReportExporter, ResultExporterType
4041
from tools.utils import argparse_filestring_type, argparse_lowercase_type, argparse_many
@@ -170,16 +171,7 @@
170171
else:
171172
tests = all_tests
172173

173-
if options.color:
174-
# This import happens late to prevent initializing colorization when we don't need it
175-
import colorize
176-
if options.verbose:
177-
notify = mbedToolchain.print_notify_verbose
178-
else:
179-
notify = mbedToolchain.print_notify
180-
notify = colorize.print_in_color_notifier(CLI_COLOR_MAP, notify)
181-
else:
182-
notify = None
174+
notify = TerminalNotifier(options.verbose)
183175

184176
if options.list:
185177
# Print available tests in order and exit
@@ -207,7 +199,7 @@
207199
toolchain, jobs=options.jobs,
208200
clean=options.clean, report=build_report,
209201
properties=build_properties, name="mbed-build",
210-
macros=options.macros, verbose=options.verbose,
202+
macros=options.macros,
211203
notify=notify, archive=False,
212204
app_config=config,
213205
build_profile=profile)
@@ -227,13 +219,11 @@
227219
print("Failed to build library")
228220
else:
229221
# Build all the tests
230-
231222
test_build_success, test_build = build_tests(tests, [options.build_dir], options.build_dir, mcu, toolchain,
232223
clean=options.clean,
233224
report=build_report,
234225
properties=build_properties,
235226
macros=options.macros,
236-
verbose=options.verbose,
237227
notify=notify,
238228
jobs=options.jobs,
239229
continue_on_build_fail=options.continue_on_build_fail,

tools/test_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,7 +2078,7 @@ def find_tests(base_dir, target_name, toolchain_name, app_config=None):
20782078

20792079
# Prepare the toolchain
20802080
toolchain = prepare_toolchain([base_dir], None, target_name, toolchain_name,
2081-
silent=True, app_config=app_config)
2081+
app_config=app_config)
20822082

20832083
# Scan the directory for paths to probe for 'TESTS' folders
20842084
base_resources = scan_resources([base_dir], toolchain)
@@ -2206,7 +2206,7 @@ def build_test_worker(*args, **kwargs):
22062206

22072207

22082208
def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
2209-
clean=False, notify=None, verbose=False, jobs=1, macros=None,
2209+
clean=False, notify=None, jobs=1, macros=None,
22102210
silent=False, report=None, properties=None,
22112211
continue_on_build_fail=False, app_config=None,
22122212
build_profile=None, stats_depth=None):
@@ -2258,12 +2258,12 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
22582258
'project_id': test_name,
22592259
'report': report,
22602260
'properties': properties,
2261-
'verbose': verbose,
22622261
'app_config': app_config,
22632262
'build_profile': build_profile,
22642263
'silent': True,
22652264
'toolchain_paths': TOOLCHAIN_PATHS,
2266-
'stats_depth': stats_depth
2265+
'stats_depth': stats_depth,
2266+
'notify': notify
22672267
}
22682268

22692269
results.append(p.apply_async(build_test_worker, args, kwargs))

0 commit comments

Comments
 (0)