ctest

Expected build-failure tests in CMake

依然范特西╮ 提交于 2019-11-29 22:57:31
Sometimes it's good to check that certain things fail to build, e.g.: // Next line should fail to compile: can't convert const iterator to iterator. my_new_container_type::iterator it = my_new_container_type::const_iterator(); Is it possible to incorporate these types of things into CMake/CTest? I'm looking for something like this in CMakeLists.txt : add_build_failure_executable( test_iterator_conversion_build_failure iterator_conversion_build_failure.cpp) add_build_failure_test( test_iterator_conversion_build_failure test_iterator_conversion_build_failure) (Of course, these specific CMake

How to get CTest results in Hudson / Jenkins

早过忘川 提交于 2019-11-29 22:22:42
I'm using CTest (part of CMake) for my automated tests. How do I get CTest results in the Jenkins dashboard ? Or, phrased differently, how do I get CTest to output in JUnit-like XML ? In Jenkins, after the CMake part (probably made through the CMake plugin), add the following batch script, or adapt for builds on Linux : del build_32\JUnitTestResults.xml pushd build_32\Tests "C:\Program Files\CMake 2.8\bin\ctest.exe" -T Test -C RelWithDebInfo --output-on-failure popd verify >nul C:\Python27\python.exe external/tool/CTest2JUnit.py build_32/Tests external/tool/CTest2JUnit.xsl > build_32

CTest with multiple commands

馋奶兔 提交于 2019-11-28 23:00:05
问题 I'm building some tests using CTest. Usually, I can set up the test by simply the line: ADD_TEST(Test_Name executable args) However, I've run into a problem, I have some tests that require two commands to be run in order for it to work, is there any way I can run two programs within a single ctest, or am I required to create a new test for each? Thank you. 回答1: The add_test command only accepts one executable, but you can run any executable that is really a script. To do this in a cross

Expected build-failure tests in CMake

断了今生、忘了曾经 提交于 2019-11-28 19:52:24
问题 Sometimes it's good to check that certain things fail to build, e.g.: // Next line should fail to compile: can't convert const iterator to iterator. my_new_container_type::iterator it = my_new_container_type::const_iterator(); Is it possible to incorporate these types of things into CMake/CTest? I'm looking for something like this in CMakeLists.txt : add_build_failure_executable( test_iterator_conversion_build_failure iterator_conversion_build_failure.cpp) add_build_failure_test( test

CMake: setting an environmental variable for ctest (or otherwise getting failed test output from ctest/make test automatically)

江枫思渺然 提交于 2019-11-28 07:11:31
I want ctest to show me the failed tests output by default. That is, I want to run: $ make all test and see any output of failed tests without having to cat Testing/Temporary/LastTest.log . It appears that there are two ways of doing this: (1) Setting the CTEST_OUTPUT_ON_FAILURE environmental variable: $ CTEST_OUTPUT_ON_FAILURE=1 make all test $ # or CTEST_OUTPUT_ON_FAILURE=1 ctest (2) Specifying the --output-on-failure flag to the ctest invocation: $ ctest --output-on-failure Is there a way to write a CMakeLists.txt file such that ctests dumps failed tests output by default on a normal "make

Using CMake, how do I get verbose output from CTest?

倾然丶 夕夏残阳落幕 提交于 2019-11-28 03:25:54
I'm using CMake to build my project. I have added a unit test binary which is using the Boost unit testing framework. This one binary contains all of the unit tests. I've added that binary to be run by CTest: ADD_EXECUTABLE( tftest test-main.cpp ) ENABLE_TESTING() ADD_TEST( UnitTests tftest) But the build output in Visual Studio only shows the result of running CTest: Start 1: UnitTests 1/1 Test #1: UnitTests ................***Failed 0.05 sec 0% tests passed, 1 tests failed out of 1 This is not very helpful, because I can't see which test failed. If I run ctest manually from the command line

How to run ctest after building my project with cmake

删除回忆录丶 提交于 2019-11-27 13:58:24
I want my tests to be launched each time my project is successfully built. And if some tests are broken I want my build to be broken too. By default I need to run tests manually by running ctest command. CTest can actually build project but I use IDE that invokes make to build sources. And make doesn't run tests. I add this command to my root CMakeLists.txt file but it doesn't work. add_custom_command(OUTPUT tests.txt POST_BUILD COMMAND ctest --output-on-failure) CMake doesn't return any errors and everything builds fine but my custom command doesn't invokes. How can I run something after each

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

风流意气都作罢 提交于 2019-11-27 03:31:44
问题 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 BOOST_AUTO_TEST_CASE | |---bar.cpp // contains one BOOST_AUTO_TEST_SUITE and several BOOST_AUTO_TEST_CASE \----dir2 \----foo.cpp // contains one BOOST_AUTO_TEST_SUITE and several BOOST_AUTO_TEST_CASE |---bar.cpp // contains one BOOST_AUTO_TEST_SUITE and several

CMake: setting an environmental variable for ctest (or otherwise getting failed test output from ctest/make test automatically)

拟墨画扇 提交于 2019-11-27 01:45:38
问题 I want ctest to show me the failed tests output by default. That is, I want to run: $ make all test and see any output of failed tests without having to cat Testing/Temporary/LastTest.log . It appears that there are two ways of doing this: (1) Setting the CTEST_OUTPUT_ON_FAILURE environmental variable: $ CTEST_OUTPUT_ON_FAILURE=1 make all test $ # or CTEST_OUTPUT_ON_FAILURE=1 ctest (2) Specifying the --output-on-failure flag to the ctest invocation: $ ctest --output-on-failure Is there a way

Using CMake, how do I get verbose output from CTest?

ε祈祈猫儿з 提交于 2019-11-26 18:57:42
问题 I'm using CMake to build my project. I have added a unit test binary which is using the Boost unit testing framework. This one binary contains all of the unit tests. I've added that binary to be run by CTest: ADD_EXECUTABLE( tftest test-main.cpp ) ENABLE_TESTING() ADD_TEST( UnitTests tftest) But the build output in Visual Studio only shows the result of running CTest: Start 1: UnitTests 1/1 Test #1: UnitTests ................***Failed 0.05 sec 0% tests passed, 1 tests failed out of 1 This is