Skip to content

Commit 9a720be

Browse files
committed
Small improvements to reporting build failures
1 parent 373e8c4 commit 9a720be

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

workspace_tools/build.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,12 @@
254254
print "Completed in: (%.2f)s" % (time() - start)
255255
print
256256

257-
print print_build_results(successes, "Build successes:"),
258-
print print_build_results(skipped, "Build skipped:"),
259-
print print_build_results(failures, "Build failures:"),
257+
for report, report_name in [(successes, "Build successes:"),
258+
(skipped, "Build skipped:"),
259+
(failures, "Build failures:"),
260+
]:
261+
if report:
262+
print print_build_results(report, report_name),
260263

261264
if failures:
262265
sys.exit(1)

workspace_tools/build_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ def static_analysis_scan_library(src_paths, build_path, target, toolchain_name,
526526
def print_build_results(result_list, build_name):
527527
""" Generate result string for build results """
528528
result = ""
529-
if result_list:
529+
if len(result_list) > 0:
530530
result += build_name + "\n"
531531
result += "\n".join([" * %s" % f for f in result_list])
532532
result += "\n"

workspace_tools/test_api.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,6 @@ def execute_thread_slice(self, q, target, toolchains, clean, test_ids, build_rep
426426
print self.logger.log_line(self.logger.LogType.ERROR, 'There were errors while building library %s'% (lib_id))
427427
build_report[toolchain]["library_failure"] = True
428428
build_report[toolchain]["library_build_failing"].append(lib_id)
429-
#return self.test_summary, self.shuffle_random_seed, self.test_summary_ext, self.test_suite_properties_ext
430429
continue
431430

432431

@@ -456,6 +455,8 @@ def execute_thread_slice(self, q, target, toolchains, clean, test_ids, build_rep
456455
if target not in self.test_summary_ext[toolchain]:
457456
self.test_summary_ext[toolchain][target] = {} # test_summary_ext : toolchain : target
458457

458+
tt_test_id = "%s::%s::%s" % (toolchain, target, test_id) # For logging only
459+
459460
project_name = self.opts_firmware_global_name if self.opts_firmware_global_name else None
460461
try:
461462
path = build_project(test.source_dir,
@@ -476,6 +477,7 @@ def execute_thread_slice(self, q, target, toolchains, clean, test_ids, build_rep
476477
project_name_str = project_name if project_name is not None else test_id
477478
print self.logger.log_line(self.logger.LogType.ERROR, 'There were errors while building project %s'% (project_name_str))
478479
build_report[toolchain]["test_build_failing"].append(test_id)
480+
self.build_failures.append(tt_test_id)
479481

480482
# Append test results to global test summary
481483
self.test_summary.append(
@@ -1470,12 +1472,17 @@ def singletest_in_cli_mode(single_test):
14701472
# prints well-formed summary with results (SQL table like)
14711473
# table shows text x toolchain test result matrix
14721474
print single_test.generate_test_summary_by_target(test_summary, shuffle_seed)
1473-
print
1475+
14741476
print "Completed in %.2f sec"% (elapsed_time)
14751477
print
1476-
print print_build_results(single_test.build_successes, "Build successes:"),
1477-
print print_build_results(single_test.build_skipped, "Build skipped:"),
1478-
print print_build_results(single_test.build_failures, "Build failures:"),
1478+
# Write summary of the builds
1479+
1480+
for report, report_name in [(single_test.build_successes, "Build successes:"),
1481+
(single_test.build_skipped, "Build skipped:"),
1482+
(single_test.build_failures, "Build failures:"),
1483+
]:
1484+
if report:
1485+
print print_build_results(report, report_name)
14791486

14801487
# Store extra reports in files
14811488
if single_test.opts_report_html_file_name:

0 commit comments

Comments
 (0)