From 605f18bad1ce1d34a97c873289bb4fdb995994ac Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Wed, 22 Jul 2020 15:45:53 +0200 Subject: [PATCH] Add link to ninja log instead of XML #216 XML tooks too long to load and not that helpful + link tell how many tests have failed + link is added only if something is off --- scripts/premerge_checks.py | 10 ++++++++++ scripts/test_results_report.py | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/premerge_checks.py b/scripts/premerge_checks.py index 5576a44..fc376a9 100755 --- a/scripts/premerge_checks.py +++ b/scripts/premerge_checks.py @@ -50,6 +50,8 @@ def ninja_all_report(step: Step, _: Report, filter_output: bool): 'ninja all', cwd=build_dir) logging.debug(f'ninja all: returned {rc}') step.set_status_from_exit_code(rc) + if not step.success: + report.add_artifact(artifacts_dir, 'ninja-all.log', 'build failed') def ninja_check_all_report(step: Step, _: Report, filter_output: bool): @@ -67,6 +69,14 @@ def ninja_check_all_report(step: Step, _: Report, filter_output: bool): logging.debug(f'ninja check-all: returned {rc}') step.set_status_from_exit_code(rc) test_results_report.run(build_dir, 'test-results.xml', step, report) + if not step.success: + message = 'tests failed' + f = report.test_stats['fail'] + if f == 1: + message = '1 test failed' + if f > 1: + message = f'{f} tests failed' + report.add_artifact(artifacts_dir, 'ninja-check-all.log', message) def run_step(name: str, report: Report, thunk: Callable[[Step, Report], None]) -> Step: diff --git a/scripts/test_results_report.py b/scripts/test_results_report.py index bc97267..f04ccfb 100755 --- a/scripts/test_results_report.py +++ b/scripts/test_results_report.py @@ -32,7 +32,6 @@ def run(working_dir: str, test_results: str, step: Optional[Step], report: Optio step.success = False step.messages.append(f'test report "{path}" is not found') return - report.add_artifact(working_dir, test_results, 'test results') try: success = True root_node = etree.parse(path)