From d6561dc178294ee01ff00d3e899e0c61bc7cad2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= <vladimir.cunat@nic.cz>
Date: Thu, 15 Apr 2021 19:21:55 +0200
Subject: [PATCH] ci: try to improve meson's junit.xml

GitLab doesn't show the <system-*> tags, so let's replace them.
For now it's just hacky sed; I can't use xsltproc or similar.
---
 .gitlab-ci.yml        | 2 ++
 ci/fix-meson-junit.sh | 5 +++++
 2 files changed, 7 insertions(+)
 create mode 100755 ci/fix-meson-junit.sh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 29d349177..ea9d3fddc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -73,6 +73,8 @@ stages:
       - build_dist/meson-dist/*.tar.xz
     reports:
       junit: build_ci*/meson-logs/testlog.junit.xml
+  after_script:
+    - ci/fix-meson-junit.sh build_ci*/meson-logs/testlog.junit.xml
 
 archive:
   <<: *build
diff --git a/ci/fix-meson-junit.sh b/ci/fix-meson-junit.sh
new file mode 100755
index 000000000..02cf4880b
--- /dev/null
+++ b/ci/fix-meson-junit.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+sed 's|</testcase>|</testcase>\n|g' -i "$@"
+sed -e '/<failure \/>/,/<\/testcase>/s/<\(\/\?\)system-\(out\|err\)>/<\1failure>/g' \
+	-e 's/<failure \/>//g' \
+	-i "$@"
-- 
GitLab