]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: add a cobertura xml file workaround variable 64069/head
authorJohn Mulligan <jmulligan@redhat.com>
Thu, 29 May 2025 17:41:45 +0000 (13:41 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Fri, 20 Jun 2025 17:26:11 +0000 (13:26 -0400)
Add an environment variable REWRITE_COVERAGE_ROOTDIR that
changes the "hardcoded" path in the cobertura-coverage.xml file.
This can be used to map the paths used in a container build to
the paths known to a jenkins job (or whatever else you want to
do with the file).

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/dashboard/run-frontend-unittests.sh

index 0ef10fadd4958b6a6f1ddd6bd8ac9f5a6ee7cfef..1fb7d9fdda78879b791cb848835efaa3d90cc81b 100755 (executable)
@@ -41,6 +41,16 @@ else
   fi
 fi
 
+# The coverage tool embeds an absolute path in the coverage xml file.
+# This causes issues when the suite is run within a container and external
+# tools
+cov_xml="coverage/cobertura-coverage.xml"
+if [ -f "${cov_xml}" -a -n "$REWRITE_COVERAGE_ROOTDIR" ]; then
+  echo "Updating ${cov_xml}"
+  cp "${cov_xml}" "${cov_xml}.orig"
+  xmlstarlet ed --inplace -u /coverage/sources/source -v "${REWRITE_COVERAGE_ROOTDIR}"  "${cov_xml}"
+fi
+
 if [ `uname` != "FreeBSD" ]; then
   deactivate
 fi