From cf434f3da55a7b5d2e7526b5d3bef87adf43ccde Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Fri, 19 Oct 2018 10:49:04 +0200 Subject: [PATCH] Fix make test Fixed `make test` so that it runs unit tests. codership/wsrep-lib#7 --- CMakeLists.txt | 5 ++--- README.md | 2 +- test/CMakeLists.txt | 8 ++++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 852aae2..3cdc281 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,6 @@ cmake_minimum_required (VERSION 2.8) project (wsrep-lib) include(CheckIncludeFile) -include(CTest) # Options @@ -13,7 +12,7 @@ include(CTest) option(WSREP_LIB_WITH_UNIT_TESTS "Compile unit tests" ON) if (WSREP_LIB_WITH_UNIT_TESTS) # Run tests automatically by default if compiled - option(WSREP_LIB_WITH_AUTO_TEST "Run unit tests automatically after build" ON) + option(WSREP_LIB_WITH_AUTO_TEST "Run unit tests automatically after build" OFF) endif() # Build a sample program @@ -81,9 +80,9 @@ endif() add_subdirectory(src) add_subdirectory(wsrep-API) if (WSREP_LIB_WITH_UNIT_TESTS) + enable_testing() add_subdirectory(test) endif() if (WSREP_LIB_WITH_DBSIM) add_subdirectory(dbsim) endif() - diff --git a/README.md b/README.md index e2d6234..8b97aee 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ In order to build the library, run * WSREP_LIB_WITH_UNIT_TESTS - Compile unit tests (default ON) * WSREP_LIB_WITH_AUTO_TEST - Run unit tests automatically as a part - of compilation (default ON) + of compilation (default OFF) * WSREP_LIB_WITH_DBSIM - Compile sample program (default ON) * WSREP_LIB_WITH_ASAN - Enable address sanitizer instrumentation (default OFF) * WSREP_LIB_WITH_TSAN - Enable thread sanitizer instrumentation (default OFF) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 700fdb6..5bc50c2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -13,11 +13,11 @@ add_executable(wsrep-lib_test transaction_test_2pc.cpp wsrep-lib_test.cpp ) + target_link_libraries(wsrep-lib_test wsrep-lib) -add_test(NAME wsrep-lib_test - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/wsrep-lib_test - ) + +add_test(NAME wsrep-lib_test + COMMAND wsrep-lib_test) if (WSREP_LIB_WITH_AUTO_TEST) set(UNIT_TEST wsrep-lib_test)