ctest

CMake: can't find header files

走远了吗. 提交于 2019-12-10 18:39:24
问题 I have a directory main, which has the following subdirectories: A, B, C, D, Test. In Test, I have a CMakeLists file with the following content: cmake_minimum_required(VERSION 2.8) enable_testing() set(TEST_EXE_NAME test) add_executable(${TEST_EXE_NAME} test.cpp) add_test(NAME "testDatabase" COMMAND ${TEST_EXE_NAME}) target_include_directories(Test PUBLIC ./) target_include_directories(Test A B C D) target_link_libraries(Test A B C D) In Test, I have an executable which #includes several

CMake exclude tests in subdirectories

陌路散爱 提交于 2019-12-08 17:11:56
问题 I have a c++ project which includes libevent library. Project structure: . |_ CMakeLists.txt |_ Makefile |_ src | |_ my_lib.cpp |_ test | |_ my_lib_test.cpp |_ lib |_ libevent |_ CMakeLists.txt |_ ... When I build and run my tests, libevent tests are also executed. How can I exclude them and run only my own tests? 回答1: Looking at the available options in libevent's CMakeLists.txt file, it appears that you can disable these pretty easily by setting EVENT__DISABLE_TESTS to ON . You can either

Hide automatically generated CTest targets

隐身守侯 提交于 2019-12-07 14:16:20
问题 I'm using CMake and CTest in CLion. Annoyingly, CTest generates a load of targets that I don't care about: Continuous ContinuousBuild ContinuousConfigure ContinuousCoverage ContinuousMemCheck ContinuousStart ContinuousSubmit ContinuousTest ContinuousUpdate Experimental ExperimentalBuild ExperimentalConfigure ExperimentalCoverage ExperimentalMemCheck ExperimentalStart ExperimentalSubmit ExperimentalTest ExperimentalUpdate Nightly NightlyBuild NightlyConfigure NightlyCoverage NightlyMemCheck

CMake and CTest's default “test” command skips a specially named test

孤人 提交于 2019-12-05 23:34:33
I'm using CTest with CMake to run some tests. I use the enable_testing() command which provides me with a default command for make test . All of the tests in my subdirectory are accounted for (by doing an add_test command) and make test works great, except one problem. There is a certain test, which I've named skip_test , that I do NOT want being run when I do make test . I would like to add a custom target so I can run make skip_test and it will run that test. I can do this by doing add_custom_target(skip_test ...) and providing CTest with the -R flag and telling it to look for files

Hide automatically generated CTest targets

混江龙づ霸主 提交于 2019-12-05 21:57:14
I'm using CMake and CTest in CLion. Annoyingly, CTest generates a load of targets that I don't care about: Continuous ContinuousBuild ContinuousConfigure ContinuousCoverage ContinuousMemCheck ContinuousStart ContinuousSubmit ContinuousTest ContinuousUpdate Experimental ExperimentalBuild ExperimentalConfigure ExperimentalCoverage ExperimentalMemCheck ExperimentalStart ExperimentalSubmit ExperimentalTest ExperimentalUpdate Nightly NightlyBuild NightlyConfigure NightlyCoverage NightlyMemCheck NightlyStart NightlySubmit NightlyTest NightlyUpdate These all show up in CLion. Quite annoying as I'm

Run ctest from different directory than build directory used by cmake?

和自甴很熟 提交于 2019-12-05 17:16:40
问题 I would like to be able in a similar manner as I can run cmake like cmake -H<src-directory> -B<bld-directory> cmake --build <bld_directory> to run ctest like ctest --build <bld_directory> Obviously running ctest from the will work, but it would be nice if I can just tell ctest where to look for its configuration file and where the test executables are located. From the documentation it is not very clear (or I might not have looked in the right place) if this is possible at all or not. It

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

感情迁移 提交于 2019-12-04 04:20:10
问题 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 CMakeLists.txt contains enable_testing() file(GLOB test_sources "t*") foreach(test_src ${test_sources}) string(REGEX REPLACE ".*/" "" test_name "${test_src}") string(REGEX REPLACE ".exe$" "" test_name "${test_name}") add_test(${test_name} "${test

Build Qt Tests with CMake

爱⌒轻易说出口 提交于 2019-12-03 06:30:47
问题 Can anyone give me an example of some QT test code and a CMakeLists.txt that build with Cmake and ran with CTest. I can't seem to find any! -Kurtis 回答1: An example taken from Charm (Tests/CMakeLists.txt): SET( TestApplication_SRCS TestApplication.cpp ) SET( TEST_LIBRARIES CharmCore ${QT_QTTEST_LIBRARY} ${QT_LIBRARIES} ) SET( SqLiteStorageTests_SRCS SqLiteStorageTests.cpp ) QT4_AUTOMOC( ${SqLiteStorageTests_SRCS} ) ADD_EXECUTABLE( SqLiteStorageTests ${SqLiteStorageTests_SRCS} ) TARGET_LINK

Catch lib (unit testing) and CTest (CMake) integration

ぃ、小莉子 提交于 2019-12-03 04:19:18
问题 I'm looking for successful example of Catch CatchLib integration with CMake test (Ctest) . as I understand this is additional cmake script which has to parse application ouput? Did someone already written this? probably shared this? ================================================== update (solution has been found) : I've committed cmake script to CatchLib , for the integration Catch with CTest. this is a simplified version of Fraser99's cmake script here 回答1: Integrating Catch with CMake is

How to find where the error is while running ctest

南笙酒味 提交于 2019-12-03 02:31:31
I got the following output after running make test, but how do i get to know what the error is? Running tests... Test project /home/puneet/puneet/office/alkimia/payment/build Start 1: alkimia-alkuser 1/4 Test #1: alkimia-alkuser .................. Passed 0.20 sec Start 2: alkimia-alkinvoice 2/4 Test #2: alkimia-alkinvoice ...............***Failed 0.25 sec Start 3: alkimia-alkpayment 3/4 Test #3: alkimia-alkpayment ............... Passed 0.22 sec Start 4: alkimia-alkpayee 4/4 Test #4: alkimia-alkpayee ................. Passed 0.22 sec 75% tests passed, 1 tests failed out of 4 Total Test time