[CMake] separating unit tests and performance tests

Sjaak Zwart sjaak10101 at gmail.com
Tue May 5 07:34:35 EDT 2015


Dear all,

Could somebody give me some advice on how unit tests and performance tests
can/should be organized? I'm quite new to cmake (and c++).

Currently, for performance tests I do:
    add_executable (mybenchmarks ${MYBENCHMARKS_CPP}
(as I don't want these to run by default)

While for unit tests I do:
    add_test (mytests mytests)
    add_executable (mytests ${MYTESTS_CPP})

I can then manually start the performance test by running the executable,
and use 'make test' or 'ctest' to start the normal tests.

I wonder if I can do better, maybe there's standard support for this
already?

Ideally, I think I would like to replace add_test by something like
add_performance_test and then launch ctest with some special flag?

Another idea perhaps, maybe I could use a regular expression to run only
the performance tests, i.e., something like *PerfTest. But could I then
also run the unit tests still, i.e., everything that doesn't match
*PerfTest?

Thanks,
Sjaak.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150505/7845173f/attachment.html>


More information about the CMake mailing list