diff --git a/.travis.yml b/.travis.yml index 6fd93048..c36a9d78 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,5 +54,5 @@ install: script: - mkdir -p build && cd build - - cmake .. && make -j4 - - CTEST_OUTPUT_ON_FAILURE=1 make test + - cmake .. -DBUILD_TESTING=ON && make -j4 + - CTEST_OUTPUT_ON_FAILURE=1 ctest -j4 -R uvw diff --git a/CMakeLists.txt b/CMakeLists.txt index 4153b108..2e8f100c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,12 +49,6 @@ set(PROJECT_SRC_DIR ${uvw_SOURCE_DIR}/src) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin) -# -# Enable test support using ctest-like interface -# - -option(BUILD_TESTING "Enable testing with ctest." ON) - # # Referenced packages # @@ -81,9 +75,6 @@ if(BUILD_TESTING) execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY ${PROJECT_DEPS_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} --build . WORKING_DIRECTORY ${PROJECT_DEPS_DIR}) - # Disable testing for dependencies - set(BUILD_TESTING OFF) - # gtest, gtest_main, gmock and gmock_main targets are available from now on set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) add_subdirectory(${GOOGLETEST_DEPS_DIR}) @@ -92,9 +83,6 @@ if(BUILD_TESTING) add_subdirectory(${LIBUV_DEPS_DIR}) include_directories(${LIBUV_DEPS_DIR}/include) - # Enable testing for uvw - set(BUILD_TESTING ON) - add_subdirectory(test) endif() diff --git a/README.md b/README.md index 0003ccd7..62013299 100644 --- a/README.md +++ b/README.md @@ -147,9 +147,11 @@ To compile and run the tests, `uvw` requires *libuv* and *googletest*.
To build the tests: * `$ cd build` -* `$ cmake ..` +* `$ cmake .. -DBUILD_TESTING=ON` * `$ make` -* `$ make test` +* `$ ctest -j4 -R uvw` + +Omit `-R uvw` if you also want to test `libuv` and other dependencies. # Crash Course diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 83ea23ae..baeca7a7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -26,7 +26,7 @@ macro(ADD_UVW_TEST TEST_NAME TEST_SOURCE) add_executable(${TEST_NAME} $ ${TEST_SOURCE}) target_include_directories(${TEST_NAME} PRIVATE ${UVW_SRC_DIR}) target_link_libraries(${TEST_NAME} PRIVATE ${COMMON_LINK_LIBS}) - add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) + add_test(NAME uvw_${TEST_NAME} COMMAND $) endmacro() macro(ADD_UVW_DIR_TEST TEST_NAME TEST_SOURCE)