ctest

How to adapt my unit tests to cmake and ctest?

泪湿孤枕 提交于 2019-12-03 02:23:54
问题 Until now, I've used an improvised unit testing procedure - basically a whole load of unit test programs run automatically by a batch file. Although a lot of these explicitly check their results, a lot more cheat - they dump out results to text files which are versioned. Any change in the test results gets flagged by subversion and I can easily identify what the change was. Many of the tests output dot files or some other form that allows me to get a visual representation of the output. The

Build Qt Tests with CMake

南笙酒味 提交于 2019-12-02 20:21:55
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 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_LIBRARIES( SqLiteStorageTests ${TEST_LIBRARIES} ) ADD_TEST( NAME SqLiteStorageTests COMMAND SqLiteStorageTests

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

醉酒当歌 提交于 2019-12-02 17:36:24
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 Integrating Catch with CMake is rather simple, as it's a header-only library. Here's a quick rundown of what you have to do: You can either

How to adapt my unit tests to cmake and ctest?

放肆的年华 提交于 2019-12-02 15:55:45
Until now, I've used an improvised unit testing procedure - basically a whole load of unit test programs run automatically by a batch file. Although a lot of these explicitly check their results, a lot more cheat - they dump out results to text files which are versioned. Any change in the test results gets flagged by subversion and I can easily identify what the change was. Many of the tests output dot files or some other form that allows me to get a visual representation of the output. The trouble is that I'm switching to using cmake. Going with the cmake flow means using out-of-source builds

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

不羁岁月 提交于 2019-12-02 01:13:12
问题 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 ? The footer should appear below the default output The following tests FAILED: 76 - MyHardTest Errors while running CTest This concretizes and generalizes a somewhat unclear question that is open since more than 2 years (CMakeLists.txt: How to print a

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

别来无恙 提交于 2019-12-01 22:49:46
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 ? The footer should appear below the default output The following tests FAILED: 76 - MyHardTest Errors while running CTest This concretizes and generalizes a somewhat unclear question that is open since more than 2 years ( CMakeLists.txt: How to print a message if ctest fails? ). Therefore I fear there is no easy solution. Thence an alternative question:

Trouble setting environment variables for CTest tests

◇◆丶佛笑我妖孽 提交于 2019-12-01 21:16:58
问题 I'm tasked with building python bindings for a c++-based project (using swig). The project uses cmake to build and ctest to test and the build and test of the bindings are supposed to be integrated into this. I've gotten the build to work and the tests work when run manually, but I have to set a couple of environment variables in order for them to work and I'm having trouble setting those for the automated process. I need to set LD_LIBRARY_PATH and PYTHONPATH. PYTHONPATH I can get around by

CMake: How to specify directory where ctest should look for executables?

谁说胖子不能爱 提交于 2019-12-01 18:13:09
问题 I wanted to integrate ctest to a c++/c project. I use google tests to write unit tests. Relevant part of my CMakeLists.txt looks like this: ... ####### CREATING EXE ####### add_executable(test_exe main.cpp test.cpp) target_link_libraries(test_exe GTest::GTest GTest::Main) set_target_properties (test_exe PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${UNIT_TEST_BIN_OUTPUT_DIR}) add_test(test_exe test_exe) As you can see i specified the output directory of my executable (UNIT_TEST_BIN_OUTPUT_DIR). The

No tests found when using gtest with cmake/ctest

别来无恙 提交于 2019-11-30 08:25:07
问题 I have a project with the following structure: linalg ├── build ├── CMakeLists.txt ├── docs │ └── Doxyfile ├── include │ └── linalg │ └── vector3.hpp ├── src │ ├── CMakeLists.txt │ └── linalg │ └── vector3.cpp └── test ├── CMakeLists.txt └── linalg └── test_vector3.cpp The file test_vector3.cpp is a gtest unit test file which provides two simple tests. The top level CMakeLists.txt simply sets up the includes and adds the src and test subdirectories: cmake_minimum_required(VERSION 2.8) project

CTest with multiple commands

自古美人都是妖i 提交于 2019-11-30 03:49:56
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. 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 platform way, write the script in CMake itself. CMake has the -P option for running arbitrary chunks of CMake