diff mbox series

[isar-cip-core,1/3] ci: submit_lava: Improve detection of failed jobs

Message ID 0f90dc2b-227a-42fd-964e-4086d00e9694@siemens.com (mailing list archive)
State Accepted
Headers show
Series [isar-cip-core,1/3] ci: submit_lava: Improve detection of failed jobs | expand

Commit Message

Jan Kiszka July 5, 2024, 3:36 p.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

Rather than counting errors and failures, only query for the failed
testcase "job". That avoids reporting failures when some job was
successfully retried, specifically download jobs.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 scripts/submit_lava.sh | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/scripts/submit_lava.sh b/scripts/submit_lava.sh
index 7f151697..b9015f3d 100755
--- a/scripts/submit_lava.sh
+++ b/scripts/submit_lava.sh
@@ -35,7 +35,7 @@  image_args[qemu-arm]="-cpu cortex-a15 -machine virt -device virtio-serial-device
 
 set_up (){
 	echo "Installing dependencies to run this script..."
-	sudo apt update && sudo apt install -y --no-install-recommends lavacli curl
+	sudo apt update && sudo apt install -y --no-install-recommends lavacli curl xmlstarlet
 	job_dir="$(mktemp -d)"
 }
 
@@ -225,9 +225,7 @@  get_junit_test_results () {
 	curl -s -o "${RESULTS_DIR}"/results_"$1".xml "${LAVA_API_URL}"/jobs/"$1"/junit/
 
 	# change return code to generate a error in gitlab-ci if a test is failed
-	errors=$(get_first_xml_attr_value "${RESULTS_DIR}"/results_"$1".xml errors)
-	failures=$(get_first_xml_attr_value "${RESULTS_DIR}"/results_"$1".xml failures)
-	if [ "${errors}" -gt "0" ] || [ "${failures}" -gt "0" ]; then
+	if xmlstarlet sel -t  -v "/testsuites/testsuite/testcase[@name='job']/failure/@type" "${RESULTS_DIR}"/results_"$1".xml; then
 		ERROR=true
 	fi
 }