mirror of https://github.com/ARMmbed/mbed-os.git
Use mocked notifier for individual tests
That way we separate the collection of notifications from everything elsepull/6781/head
parent
111f086796
commit
c186c3ce86
|
@ -599,7 +599,6 @@ def build_project(src_paths, build_path, target, toolchain_name,
|
|||
if report != None:
|
||||
end = time()
|
||||
cur_result["elapsed_time"] = end - start
|
||||
cur_result["output"] = notify.get_output() + memap_table
|
||||
cur_result["result"] = "OK"
|
||||
cur_result["memory_usage"] = (memap_instance.mem_report
|
||||
if memap_instance is not None else None)
|
||||
|
@ -622,12 +621,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
|
|||
|
||||
cur_result["elapsed_time"] = end - start
|
||||
|
||||
toolchain_output = notify.get_output()
|
||||
if toolchain_output:
|
||||
cur_result["output"] += toolchain_output
|
||||
|
||||
add_result_to_report(report, cur_result)
|
||||
|
||||
# Let Exception propagate
|
||||
raise
|
||||
|
||||
|
@ -754,7 +748,6 @@ def build_library(src_paths, build_path, target, toolchain_name,
|
|||
if report != None:
|
||||
end = time()
|
||||
cur_result["elapsed_time"] = end - start
|
||||
cur_result["output"] = notify.get_output()
|
||||
cur_result["result"] = "OK"
|
||||
|
||||
|
||||
|
@ -772,10 +765,6 @@ def build_library(src_paths, build_path, target, toolchain_name,
|
|||
|
||||
cur_result["elapsed_time"] = end - start
|
||||
|
||||
toolchain_output = notify.get_output()
|
||||
if toolchain_output:
|
||||
cur_result["output"] += toolchain_output
|
||||
|
||||
add_result_to_report(report, cur_result)
|
||||
|
||||
# Let Exception propagate
|
||||
|
@ -926,7 +915,6 @@ def build_lib(lib_id, target, toolchain_name, clean=False, macros=None,
|
|||
if report != None and needed_update:
|
||||
end = time()
|
||||
cur_result["elapsed_time"] = end - start
|
||||
cur_result["output"] = notify.get_output()
|
||||
cur_result["result"] = "OK"
|
||||
|
||||
add_result_to_report(report, cur_result)
|
||||
|
@ -938,10 +926,6 @@ def build_lib(lib_id, target, toolchain_name, clean=False, macros=None,
|
|||
cur_result["result"] = "FAIL"
|
||||
cur_result["elapsed_time"] = end - start
|
||||
|
||||
toolchain_output = notify.get_output()
|
||||
if toolchain_output:
|
||||
cur_result["output"] += toolchain_output
|
||||
|
||||
add_result_to_report(report, cur_result)
|
||||
|
||||
# Let Exception propagate
|
||||
|
@ -1085,7 +1069,6 @@ def build_mbed_libs(target, toolchain_name, clean=False, macros=None,
|
|||
if report != None:
|
||||
end = time()
|
||||
cur_result["elapsed_time"] = end - start
|
||||
cur_result["output"] = notify.get_output()
|
||||
cur_result["result"] = "OK"
|
||||
|
||||
add_result_to_report(report, cur_result)
|
||||
|
@ -1098,10 +1081,6 @@ def build_mbed_libs(target, toolchain_name, clean=False, macros=None,
|
|||
cur_result["result"] = "FAIL"
|
||||
cur_result["elapsed_time"] = end - start
|
||||
|
||||
toolchain_output = notify.get_output()
|
||||
if toolchain_output:
|
||||
cur_result["output"] += toolchain_output
|
||||
|
||||
cur_result["output"] += str(exc)
|
||||
|
||||
add_result_to_report(report, cur_result)
|
||||
|
|
|
@ -32,7 +32,7 @@ import ctypes
|
|||
import functools
|
||||
from colorama import Fore, Back, Style
|
||||
from prettytable import PrettyTable
|
||||
from copy import copy
|
||||
from copy import copy, deepcopy
|
||||
|
||||
from time import sleep, time
|
||||
try:
|
||||
|
@ -75,6 +75,7 @@ from tools.utils import argparse_filestring_type
|
|||
from tools.utils import argparse_uppercase_type
|
||||
from tools.utils import argparse_lowercase_type
|
||||
from tools.utils import argparse_many
|
||||
from tools.notifier.mock import MockNotifier
|
||||
|
||||
import tools.host_tests.host_tests_plugins as host_tests_plugins
|
||||
|
||||
|
@ -2262,7 +2263,7 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
|
|||
'build_profile': build_profile,
|
||||
'toolchain_paths': TOOLCHAIN_PATHS,
|
||||
'stats_depth': stats_depth,
|
||||
'notify': notify
|
||||
'notify': MockNotifier()
|
||||
}
|
||||
|
||||
results.append(p.apply_async(build_test_worker, args, kwargs))
|
||||
|
@ -2285,9 +2286,15 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
|
|||
worker_result = r.get()
|
||||
results.remove(r)
|
||||
|
||||
# Push all deferred notifications out to the actual notifier
|
||||
new_notify = deepcopy(notify)
|
||||
for message in worker_result['kwargs']['notify'].messages:
|
||||
new_notify.notify(message)
|
||||
|
||||
# Take report from the kwargs and merge it into existing report
|
||||
if report:
|
||||
report_entry = worker_result['kwargs']['report'][target_name][toolchain_name]
|
||||
report_entry[worker_result['kwargs']['project_id'].upper()][0][0]['output'] = new_notify.get_output()
|
||||
for test_key in report_entry.keys():
|
||||
report[target_name][toolchain_name][test_key] = report_entry[test_key]
|
||||
|
||||
|
@ -2298,6 +2305,7 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
|
|||
result = False
|
||||
break
|
||||
|
||||
|
||||
# Adding binary path to test build result
|
||||
if ('result' in worker_result and
|
||||
worker_result['result'] and
|
||||
|
@ -2313,8 +2321,6 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
|
|||
}
|
||||
|
||||
test_key = worker_result['kwargs']['project_id'].upper()
|
||||
if report:
|
||||
print(report[target_name][toolchain_name][test_key][0][0]['output'].rstrip())
|
||||
print('Image: %s\n' % bin_file)
|
||||
|
||||
except:
|
||||
|
|
Loading…
Reference in New Issue