Save results of a canceled CTest run
We use Jenkins to run CTest and collect the test results (using
ctest -T Test and the Jenkins xUnit plugin which can read CTest Dashboard XML files).
Sometimes the Jenkins build is canceled partway through, either because the job times out, or because we intentionally cancel it to make room to run other jobs. When that happens, Jenkins sends
SIGTERM to the
When the test run is canceled, it would still be useful to know the status of tests that already completed. But when CTest receives a
SIGINT, it stops without writing the usual
Testing/*/Test.xml file. Could CTest catch those signals and write out a report before it terminates?
Here's a sample Jenkins job that demonstrates the problem: Jenkinsfile — the timeout occurs before
test1 completes, so CTest doesn't write the XML file.