[CMake] Adjusting CTest Test.xml results for Jenkins
Игорь Иванов
i.ivanov at trassir.com
Fri Aug 9 08:34:22 EDT 2019
We are using Jenkins and want it to parse CTest results. There is
already a plugin for that, that takes Test.xml produced by `ctest -T
Test` as an input. In `Test.xml` there are records like this:
<Test Status="passed">
<Name>TEST-netutils</Name>
<Path>/var/lib/jenkins/workspace/build/tech1utils</Path>
<FullName>/var/lib/jenkins/workspace/build/tech1utils/TEST-netutils</FullName>
<FullCommandLine>/var/lib/jenkins/workspace/build/tech1utils/test-netutils-core2</FullCommandLine>
We run `cmake --build; ctest` multiple times in different directories
for x86+x64 and Debug+Release builds, which results in multiple
`Test.xml` files. After aggregating them, Jenkins plugin outputs report
like this:
projectroot.var.lib.jenkins.workspace.build:
tech1utils:
TEST_netutils 5.3 sec Passed
TEST_netutils 5.1 sec Passed
TEST_netutils 2.8 sec Passed
TEST_netutils 2.9 sec Passed
which is kinda unreadable, you cannot immediately guess which test is
which one. Turns out that if we replace the <Path> property in XML from
`/var/lib/jenkins/workspace/build` to something like `build-32-debug`,
the report becomes more readable:
projectroot.build-32-debug:
tech1utils:
TEST_netutils 5.3 sec Passed
projectroot.build-64-debug:
tech1utils:
TEST_netutils 5.1 sec Passed
...
Is it possible to feed to CTest some -Dparameters or ENV_VARS to provide
needed values in Path, instead of writing a script to replace XML
contents afterwards?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190809/8b5dd7aa/attachment-0001.html>
More information about the CMake
mailing list