From 5bb7fe67e2ac4b18c5c2570f8f0064c955eb5aa2 Mon Sep 17 00:00:00 2001 From: Emma Foley Date: Thu, 13 Nov 2025 08:36:03 -0500 Subject: [PATCH 1/2] [report_result] Check if the logs dir exists --- ci/report_result.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ci/report_result.yml b/ci/report_result.yml index 3b44962e..2f7a74f2 100644 --- a/ci/report_result.yml +++ b/ci/report_result.yml @@ -5,7 +5,17 @@ vars_files: - vars/common.yml tasks: + - name: Check whether the log dir exists + ansible.builtin.stat: + path: "{{ logs_dir }}" + register: stat_out + + - name: show whetehr the log dir exists + ansible.builtin.debug: + var: stat_out + - name: Create log dir + when: not stat_out.stat.exists ansible.builtin.file: path: "{{ logs_dir }}" state: directory From 6d54472787f453dae4dcdaf28b526bbc114a9a8e Mon Sep 17 00:00:00 2001 From: Emma Foley Date: Fri, 14 Nov 2025 07:31:53 -0500 Subject: [PATCH 2/2] [report_result] Add testcase error detection and reporting Previously, report_result.yml only checked for testcase failures but ignored errors in the JUnit XML output. This meant that tests could error out without causing the CI job to fail. This change adds: - Extraction of 'errors' count from XML testsuites - Failure task that triggers when errors > 0 This ensures both failures and errors in testcases are properly reported and cause the CI job to fail as expected. --- ci/report_result.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ci/report_result.yml b/ci/report_result.yml index 2f7a74f2..e4095867 100644 --- a/ci/report_result.yml +++ b/ci/report_result.yml @@ -44,10 +44,20 @@ msg: "There were no XML files found in {{ logs_dir }}." when: verbose_matches.stdout_lines | length == 0 + - name: "Get the number of testcase errors" + ansible.builtin.set_fact: + tasks_errored: "{{ verbose_matches.stdout | regex_replace('.*errors=\"([0-9]*)\".*>', '\\1') | split('\n') | map('int') | sum }}" + - name: "Get the number of failed testcases" ansible.builtin.set_fact: tasks_failed: "{{ verbose_matches.stdout | regex_replace('.*failures=\"([0-9]*)\".*>', '\\1') | split('\n') | map('int') | sum }}" + # The RC from grep is 0 if the string is matched + - name: Fail when there's a testcase error + ansible.builtin.fail: + msg: There were {{ tasks_errored }} errors in the testcases. + when: tasks_errored | int > 0 and verbose_matches.rc == 0 + # The RC from grep is 0 if the string is matched - name: Fail when there's a testcase failure ansible.builtin.fail: