[CMake] CTest - how to structure tests for different test jobs with a shared build-dir

Patrick Boettcher patrick.boettcher at posteo.de
Wed Jul 6 04:19:05 EDT 2016


Hi,

in my project I have several hundreds of non-regression and unit tests.

Generated by cmake/make (or ninja) and run with ctest.

Build jobs and test-run-jobs are separated and have their dedicated
workspace available. (within jenkins)

Tests are prefixed with an adjective to indicate when they should be
run. This somehow a kind of category.

For example we have 'short' and 'long' and their prefix is 'short::' and
'long::' . In the future we will have other categories.

This allows the test jobs to run a sub-selection of tests.

For example for each commit done we trigger a build and run all
short::-tests.

  cmake [..]
  ninja

triggers short-tests-job

  ctest -Rshort:: -T test

Once a night we run all the long-tests: 

  ctest -Rlong:: -T test

All of it is done within the workspace from the build-job.

My problem is, that ctest is writing all xUnit-results into the
build-dir. This makes it difficult (I haven't found a way) to
process the (xUnit)-results only concerned by the job (the short-job
only wants to digest the results from the short::-run).

I have several options at hand: 

- I could install the tests into the test-job-workspace (not sure if
  this will really work with ctest)
- I could copy the build-dir (what about the absolute paths used)
- I could simple rebuild my binaries for each job (very long and
  redundant)

Ideally I could tell ctest: here is the cmake-binary-dir, here you can
find the test-binaries, but please put the results into the job's
workspace this dir.

Is this possible? Is there something I oversaw (I strongly hope so!)?

Thanks,
--
Patrick.


More information about the CMake mailing list