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
11
votes
1 answer

How to pass arguments to memcheck with ctest?

I want to use ctest from the command line to run my tests with memcheck and pass in arguments for the memcheck command. I can run ctest -R my_test to run my test, and I can even run ctest -R my_test -T memcheck to run it through memcheck. But I…
dcmm88
  • 1,445
  • 1
  • 12
  • 30
11
votes
1 answer

CTest --build-and-test with --test-command option

I use Ctest to run a bunch of google tests that I have registered using add_test(). Currently, these tests do not take any arguments. However, I want to give them all arguments (common to all, specifically --gtest_output=xml) while running ctest. I…
nirvanaswap
  • 859
  • 2
  • 11
  • 21
11
votes
1 answer

CTest - Using Labels for different tests CTestTestfile.cmake

I cannot find how to specify labels. It should be something like ADD_TEST( FirstTest RunSomeProgram "withArguments" ) SET_TESTS_PROPERTIES( FirstTest PROPERTIES LABEL "TESTLABEL" ) Can someone tell me how I can set one of these labels, that I can…
user3791162
  • 111
  • 1
  • 3
10
votes
1 answer

CMake verbose output from tests

How do I get "make test" to display verbose output? I want "make test" to do the same thing as ctest -V through the command line. I have tried adding the following to my CMakeLists.txt, nothing worked :( set(ENV{CTEST_OUTPUT_ON_FAILURE}…
crusarovid
  • 501
  • 1
  • 5
  • 17
10
votes
1 answer

How to test using CMake that a C++ application has no memory errors?

I have a C++ project in CMake and I have implemented unit tests (using GoogleTest) as well as integration tests i.e. executing applications and checking the results using regexp e.g. add_test(NAME MyAppIntegration.testRefitRunMse COMMAND…
SkyWalker
  • 13,729
  • 18
  • 91
  • 187
9
votes
2 answers

How to let CMake / CTest memcheck exit with status code 1 on failure?

I want to use ctest to run my tests with valgrind. Thus I have written the following in my cmake file: include(CTest) find_program(MEMORYCHECK_COMMAND valgrind) set(MEMORYCHECK_COMMAND_OPTIONS "--leak-check=full…
Arwed Mett
  • 2,614
  • 1
  • 22
  • 35
9
votes
3 answers

How do you use CTEST_CUSTOM_PRE_TEST?

I've searched all the docs but can't seem to find a single example of using CTEST_CUSTOM_PRE_TEST. Basically I need to start and run some commands on the server before the test runs. So I need to add a few pre-test steps. What's the syntax of…
ytk
  • 311
  • 1
  • 5
  • 15
9
votes
1 answer

Set BUILD_TESTING to OFF by default using CTest

When you do include(CTest) in CMake it includes this line: option(BUILD_TESTING "Build the testing tree." ON) I want tests to be not built by default (but overridable on the command line). How can I do that?
Timmmm
  • 88,195
  • 71
  • 364
  • 509
8
votes
2 answers

Ctest/CDash workflow : deploying nightly builds

I use/maintain a few CMake projects, so I started examining CTest/CDash, but there's something that I can't figure out: Is it only made to display build/test results? (aka beautified logs) Or : May deployment of night build binaries on a server be…
Mikarnage
  • 893
  • 1
  • 9
  • 24
8
votes
4 answers

Hide automatically generated CTest targets

I'm using CMake and CTest in CLion. Annoyingly, CTest generates a load of targets that I don't care…
Timmmm
  • 88,195
  • 71
  • 364
  • 509
7
votes
1 answer

CTest Error on MacOS: Test Executable not found

I am working on a CMake project. For CI, I have decided to use Azure Pipelines. However I am facing a small problem on MacOS in the testing phase. The problem is that MacOS fails to find the test executable, even when it is there. Earlier my…
user13088241
7
votes
2 answers

ctest: Disable a set of labeled tests by default - but run them when explicitly targeted

I'd like to disable a set of tests by default, but be able to run them when explicitly targeted. E.g. suppose I have a project with lots of fast-running unit tests that have been added via a add_test(NAME SomeNameHere COMMAND SomeCommandHere)…
Matt
  • 355
  • 3
  • 12
7
votes
2 answers

CTest, CMake & MinGW: Executables build, but fail to run, because fresh DLL is not found

The top-level CMakeLists.txt contains: include(CTest) add_subdirectory(lib) add_subdirectory(demo) add_subdirectory(test) lib/CMakeLists.txt is essentially: add_library(MyLib ) demo/CMakeLists.txt is essentially: add_executable(Demo…
Joachim W
  • 7,290
  • 5
  • 31
  • 59
7
votes
1 answer

CTest generate and submit gcov.tar to CDash after make

I have set up CDash on my local machine and I'm using CTest to upload testing results to CDash - generating .gcov-files containing Branch Coverage info and packing them into gcov.tar beforehand (this is a modified version of the example from…
7
votes
2 answers

How to tell a test under cmake/ctest where to find its input data ... without changing hard-coded file names

Directory prj/test contains some test scripts t01.exe, t02.exe etc. Some of them need input data d01.dat etc, also provided in prj/test. The names of these data files are hard-coded in the tests, and I cannot easily change this. The control file…
Joachim W
  • 7,290
  • 5
  • 31
  • 59
1 2
3
19 20