From 9693fc8fee68ea66de470f5fe7f70adbe56e6000 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Tue, 20 Apr 2021 18:37:51 -0500 Subject: [PATCH] ci: Handle twister.xml junit files being empty junitparse doesn't deal well with being given an empty file. So build a filterted list of non-empty files to pass to junitparser. Additionally handle the case that all junit xml files are empty, if that is the case skip calling junitparser and junit2html. Signed-off-by: Kumar Gala --- .buildkite/daily.yml | 11 ++--------- .buildkite/mergejunit.sh | 19 +++++++++++++++++++ .buildkite/pipeline.yml | 11 ++--------- 3 files changed, 23 insertions(+), 18 deletions(-) create mode 100755 .buildkite/mergejunit.sh diff --git a/.buildkite/daily.yml b/.buildkite/daily.yml index 4f21fd29f57..c5fc99e8e1f 100644 --- a/.buildkite/daily.yml +++ b/.buildkite/daily.yml @@ -27,15 +27,8 @@ steps: - junit-annotate#v1.7.0: artifacts: twister-*.xml - - command: | - buildkite-agent artifact download twister-*.xml . - junitparser merge twister-*.xml junit.xml - buildkite-agent artifact upload junit.xml - junit2html junit.xml - buildkite-agent artifact upload junit.xml.html - cat << EOF | buildkite-agent annotate --style "info" - Read the JUnit test report - EOF + - command: + - .buildkite/mergejunit.sh notify: - email: "builds+int+399+7809482394022958124@lists.zephyrproject.org" diff --git a/.buildkite/mergejunit.sh b/.buildkite/mergejunit.sh new file mode 100755 index 00000000000..17ac9f137a7 --- /dev/null +++ b/.buildkite/mergejunit.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright (c) 2021 Linaro Limited +# +# SPDX-License-Identifier: Apache-2.0 +set -eE + +buildkite-agent artifact download twister-*.xml . + +xmls="" + +for f in twister-*xml; do [ -s ${f} ] && xmls+="${f} "; done + +if [ "${xmls}" ]; then + junitparser merge ${xmls} junit.xml + buildkite-agent artifact upload junit.xml + junit2html junit.xml + buildkite-agent artifact upload junit.xml.html + buildkite-agent annotate --style "info" "Read the JUnit test report" +fi diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 9f06e7daf47..1f9be61d1a3 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -27,12 +27,5 @@ steps: - junit-annotate#v1.7.0: artifacts: twister-*.xml - - command: | - buildkite-agent artifact download twister-*.xml . - junitparser merge twister-*.xml junit.xml - buildkite-agent artifact upload junit.xml - junit2html junit.xml - buildkite-agent artifact upload junit.xml.html - cat << EOF | buildkite-agent annotate --style "info" - Read the JUnit test report - EOF + - command: + - .buildkite/mergejunit.sh