From: John Mulligan Date: Thu, 29 May 2025 17:41:45 +0000 (-0400) Subject: mgr/dashboard: add a cobertura xml file workaround variable X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=f80dad2e0adfb5bca33fab292728f5c085ca3a78;p=ceph.git mgr/dashboard: add a cobertura xml file workaround variable 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 --- diff --git a/src/pybind/mgr/dashboard/run-frontend-unittests.sh b/src/pybind/mgr/dashboard/run-frontend-unittests.sh index 0ef10fadd4958..1fb7d9fdda788 100755 --- a/src/pybind/mgr/dashboard/run-frontend-unittests.sh +++ b/src/pybind/mgr/dashboard/run-frontend-unittests.sh @@ -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