From: Kefu Chai Date: Fri, 15 Jun 2018 05:54:31 +0000 (+0800) Subject: cmake: add WITH_GTEST_PARALLEL option X-Git-Tag: v14.0.1~1099^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4c0a2b9373d0d6e22a762832f95fab52394f5c5c;p=ceph.git cmake: add WITH_GTEST_PARALLEL option and remove src/test/gtest-parallel submodule, because gtest-parallel is only useful for running tests. and not all end-users are interested in running test not to mention running them in parallel. so, to avoid including gtest-parallel scripts in the dist tarball. it'd be better to make it optional, and an external project. Signed-off-by: Kefu Chai --- diff --git a/cmake/modules/AddCephTest.cmake b/cmake/modules/AddCephTest.cmake index 7442ea922ece..d3dc81fc1933 100644 --- a/cmake/modules/AddCephTest.cmake +++ b/cmake/modules/AddCephTest.cmake @@ -23,12 +23,26 @@ function(add_ceph_test test_name test_path) PROPERTY TIMEOUT 3600) endfunction() +option(WITH_GTEST_PARALLEL "Enable running gtest based tests in parallel" OFF) +if(WITH_GTEST_PARALLEL) + include(ExternalProject) + ExternalProject_Add(gtest-parallel_ext + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/gtest-parallel + GIT_REPOSITORY "https://github.com/google/gtest-parallel.git" + GIT_TAG "master" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "") + add_dependencies(tests gtest-parallel_ext) +endif() + #sets uniform compiler flags and link libraries function(add_ceph_unittest unittest_name) set(UNITTEST "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${unittest_name}") # If the second argument is "parallel", it means we want a parallel run - if("${ARGV1}" STREQUAL "parallel") - set(UNITTEST ${CMAKE_SOURCE_DIR}/src/test/gtest-parallel/gtest-parallel ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${unittest_name}) + if(WITH_GTEST_PARALLEL AND "${ARGV1}" STREQUAL "parallel") + ExternalProject_Get_Property(gtest-parallel_ext source_dir) + set(UNITTEST ${source_dir}/gtest-parallel ${UNITTEST}) endif() add_ceph_test(${unittest_name} "${UNITTEST}") target_link_libraries(${unittest_name} ${UNITTEST_LIBS})