zephyr/.buildkite/mergejunit.sh
Kumar Gala 9693fc8fee 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 <kumar.gala@linaro.org>
2021-04-21 14:31:56 +02:00

20 lines
517 B
Bash
Executable file

#!/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 <a href=\"artifact://junit.xml.html\">JUnit test report</a>"
fi