Questions tagged [ctest]

Is the CMake test driver program.

Is the CMake test driver program. Many CMake command related to testing are related to CTest, too.

Most of the documentation is part of CMake's documentation, like the documentation concerning the CTest executable.

298 questions
7
votes
2 answers

ctest does not find valgrind

Calling ctest -j4 -DCTEST_MEMORYCHECK_COMMAND="/usr/bin/valgrind" -DMemoryCheckCommand="/usr/bin/valgrind" --output-on-failure -T MemCheck says Memory checker (MemoryCheckCommand) not set, or cannot find the specified program. Why doesn't it find…
Baradé
  • 1,290
  • 1
  • 15
  • 35
7
votes
2 answers

CMake: how to add Boost.Test cases with relative directories?

I have a working project with CMake and Boost.Test with a directory structure like this (pardon the ASCII art): +-proj |---CMakeLists.txt |---build |---test |\----dir1 | \----foo.cpp // contains one BOOST_AUTO_TEST_SUITE and several…
TemplateRex
  • 69,038
  • 19
  • 164
  • 304
6
votes
4 answers

Running Tests in CLion using CMake's CTest

I have a C++ project using CMake. The project is built on CentOS machine. I have configured CLion to build remotely from MacOS. I have unit tests for the project and I am trying to run them from CLion. I can run the tests from CentOS machine using…
adsun
  • 773
  • 9
  • 30
6
votes
2 answers

Test executable failing only when run in ctest

When I use the ctest interface to cmake (add_test(...)), and run the make target make test, several of my tests fail. When I run each test directly at the command line from the binary build folder, they all work. What can I use to debug this?
Mark Lakata
  • 19,989
  • 5
  • 106
  • 123
6
votes
1 answer

CMake - How to create executable, but not add to "all" target?

Using CMake, I have a series of executables that are built, then added as tests, like this: set(TestID 1) add_executable (Test${TestID} Test${TestID}.cpp) # Create test configure_file(${TestID}.endf ${TestID}.endf COPYONLY) add_test( NAME ${TestID}…
jlconlin
  • 14,206
  • 22
  • 72
  • 105
5
votes
1 answer

Get number of tests ran by GoogleTest / fail on 0 tests run?

I'm using cmake's test runner to run several googletest test binaries. What I want to have happen is if a googletest test binary runs 0 tests via RUN_ALL_TESTS(), it fails. Currently, RUN_ALL_TESTS() returns success when it runs 0 tests.…
JuniorIncanter
  • 1,569
  • 2
  • 16
  • 27
5
votes
1 answer

syntax of the regex language used by ctest -R

As specified on https://cmake.org/cmake/help/v3.7/manual/ctest.1.html, ctest supports filtering tests to run by regex. Unfortunately I can't seem to find out what syntax the regex language used by ctest has. I'd like to do something like ctest -R…
danba
  • 842
  • 11
  • 32
5
votes
1 answer

Non-failing timeout using ctest

I am specifying a test in my CMakeLists.txt which runs an executable and is supposed to look for a specific output (the PASS_REGULAR_EXPRESSION) to determine success. Since the binary doesn't terminate itself, I would also like to terminate the…
Felix
  • 2,064
  • 3
  • 21
  • 31
5
votes
1 answer

Running only changed or failed tests with CMake/CTest?

I work on a large code base that has close to 400 test executables, with run times varying between 0.001 second and 1800 seconds. When some bit of code changes CMake will rebuild intelligently only the targets that have changed, many times taking…
dascandy
  • 7,184
  • 1
  • 29
  • 50
5
votes
2 answers

CMake: How to Unit-Test your own CMake Script Macros/Functions?

I've written some convenience wrappers around standard CMake commands and want to unit-test this CMake script code to ensure its functionality. I've made some progress, but there are two things I hope to get help with: Is there some "official" way…
Florian
  • 39,996
  • 9
  • 133
  • 149
5
votes
0 answers

ctest tests are always enabled, I want to disable them

In ctest documentation, I see the following statement: enable_testing: Enable testing for current directory and below. If the ENABLE_TESTING command has been run, this command adds a test target to the current directory. If ENABLE_TESTING has not…
user1061392
  • 304
  • 3
  • 14
5
votes
1 answer

How to pass quoted parameters to add_test in cmake?

I'm trying to pass parameters to a gtest test suite from cmake: add_test(NAME craft_test COMMAND craft --gtest_output='xml:report.xml') The issue is that these parameters are being passed surrounded by quotes, why? It looks like a bug, is…
oblitum
  • 11,380
  • 6
  • 54
  • 120
5
votes
2 answers

CMake testing sources from different folder

I started playing around with CMake to create a project with Qt and test it with Google Test. At the moment, I succesfully found a way to compile and link all the required libraries. However, I couldn't find a way to link sources to test files with…
ashagi
  • 394
  • 6
  • 15
5
votes
1 answer

CMake/CTest & gcovr: filename extensions?

After compiling with CMake with flags --coverage, and running my boost unit test programs, files with extension .cpp.gcda and .cpp.gcno are created. If I then run gcovr it claims it cannot find the .gcno files (error message ".gcno:cannot open graph…
ikku100
  • 809
  • 1
  • 7
  • 16
4
votes
1 answer

Running Nested Tests with CTest

I have a small, but non-trivial project, which for architectural reasons is built as three separete projects, they are inter-dependent, so unless I'm particularly focused, or improving test-coverage having spotted a hole, it makes sense for me to…
Lee Hambley
  • 6,270
  • 5
  • 49
  • 81