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
4
votes
2 answers

CMake CTest output to JUnit XML

Is there a way to report the results in a junit xml format with CTest? I have found the the --output-junit comandline switch but running ctest --output-junit testRes.xml doas not create output file...
Hallootto1100
  • 61
  • 2
  • 7
4
votes
1 answer

How do I specify regular expressions for CTest

I want to run only a certain selection of tests. From the CMake Documentation I found -R and -E , so I can run selections like ctest -E UNWANTED_TESTS -R WANTED_TESTS but I would like to be more expressive, specifically I want to…
Dominik Kern
  • 146
  • 8
4
votes
4 answers

ctest - run tests having 2 labels

lest assume I have some project that consists of N domains (D1, D2, ... , DN) . Each domain has tests of two kinds: lest say UT and MT. They are defined like so: add_test( NAME Di_UT COMMAND ) add_test( NAME Di_MT COMMAND…
murison
  • 3,640
  • 2
  • 23
  • 36
4
votes
1 answer

test for non-zero exit status using ctest/cmake

The application of interest is a compiler which returns a non-zero exit code when it encounters an error in the source. The unit tests for the compiler are composed of small snippets which intentionally triggers errors. The function used to add a…
Yashas
  • 1,154
  • 1
  • 12
  • 34
4
votes
2 answers

Cmake - How to copy files with input data to build output folder

I'm using CLion and CMake for project building. I've created Google Test build configuration and my project tree looks like: The tests for tokenizer are simple: tokenizer should open source files and output tokens. This is my CMakeLists.txt file…
4
votes
2 answers

Let CMake setup CTtest to print header and footer around the output from single tests

Is there a way, ideally from CMakeLists.txt, to setup ctest as to print a header before running the individual tests, print a footer after running the individual tests, make the footer dependent on whether the tests were all successful or not…
Joachim W
  • 7,290
  • 5
  • 31
  • 59
4
votes
2 answers

CMake and CTest: automatically run test's dependencies

In my CMakeLists.txt I have something like this: set_property(TEST testX APPEND PROPERTY DEPENDS testY) set_property(TEST testX APPEND PROPERTY DEPENDS testZ) And I want some way to run testX and all its dependencies automatically. Something…
fghj
  • 8,898
  • 4
  • 28
  • 56
4
votes
0 answers

ctest --output-on-failure and setting CTEST_OUTPUT_ON_FAILURE don't work

According to the documentation, the --output-on-failure argument will instruct ctest to show the tests output when they fail. A second approach is to set the env var CTEST_OUTPUT_ON_FAILURE. Neither option work for me. As you can see on appveyor,…
vinipsmaker
  • 2,215
  • 2
  • 19
  • 33
4
votes
1 answer

How to use CTest to check difference between two files?

I'm trying to create some integrated tests for some legacy software. The current way to do testing is to run the code with known inputs and manually compare the output to the known output. I'd like to automate this process, since I'm already using…
jlconlin
  • 14,206
  • 22
  • 72
  • 105
4
votes
1 answer

ctest/cmake search for a string in output file

I'm converting some old tests to cmake/ctest and would like a test to fail if the output file contains a specific warning message. In the past I would search the output file for a specific string. I'm already using execute_process to use the…
ALou
  • 41
  • 1
  • 2
4
votes
1 answer

CMake/CTest Code coverage check

I can run a coverage check using cmake following this wiki page. This is very simple and a setting a dashboard I can have a nice view of code coverage on my browser (latter part). But I don't want to ctest everytime just to check the progress of a…
rkm
  • 892
  • 2
  • 16
  • 32
4
votes
2 answers

How to supply arguments using CMake and CTest?

In the test that I want to run using CTest I should be adding the test that I want to run, with the following command: add_test(TestName ExeName) The problem is what if I want to supply an argument to the TestName, where do I put it? How do I run…
Alexander
4
votes
2 answers

Access CMake cache variable from CTest script

My project links to a third-party library that comes with a valgrind suppression file, as well as a CMake script. The script stores the location of the suppression file in a CMake cache variable. I have written a CTest script that runs continuous…
Arek' Fu
  • 826
  • 8
  • 24
4
votes
1 answer

Creating groups of tests with Ctest

I am trying to group individual ctest tests together but have so far been unsuccessful. For example if I have the following tests: add_test(test1) add_test(test2) add_test(test3) I would like to group them into a test suite that will upload to a…
aludwig1
  • 100
  • 7
3
votes
2 answers

How to pass ${CTEST_CONFIGURATION_TYPE} using add_test in cmake

I can't seem to figure out how to pass ${CTEST_CONFIGURATION_TYPE} using add_test in cmake without having CMake add additional escape characters. I am currently using cmake to generate VS project files and setting the RUNTIME_OUTPUT_DIRECTORY and…
JMcCarty
  • 759
  • 5
  • 17