Commit 81a898b3 authored by Steffen Müthing's avatar Steffen Müthing

Fix placement of JUnit reports

Right now, they end up in an inconvenient location under the build directory,
wherever that might be. This patch moves them into junit/path/to/repo/cmake.xml,
which should also simplify supermodule setups that want to test multiple
modules.
parent f334b1f8
......@@ -18,6 +18,8 @@ import shutil
import subprocess
import sys
import xml.etree.ElementTree as et
from pathlib import Path
import os
class CTestParser:
......@@ -46,8 +48,15 @@ class CTestParser:
print(" ", line)
print()
def __init__(self):
def __init__(self,junitpath=None):
self.inputpath = self.findCTestOutput()
if junitpath is None:
buildroot = Path(os.environ["CI_PROJECT_DIR"])
junitdir = buildroot / "junit" / os.environ["CI_PROJECT_PATH_SLUG"]
junitdir.mkdir(parents=True,exist_ok=True)
self.junitpath = junitdir / "cmake.xml"
else:
self.junitpath = Path(junitpath)
self.tests = 0
self.passed = 0
self.failures = 0
......@@ -126,7 +135,7 @@ class CTestParser:
self.fillJUnitStatistics()
with open("Testing/cmake.xml", "wb") as fh:
with self.junitpath.open("wb") as fh:
fh.write(et.tostring(self.testsuites,encoding="utf-8"))
return self.errors + self.failures
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment