diff --git a/.travis.yml b/.travis.yml index 49ea5476..2a0a35b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -104,6 +104,7 @@ script: -DCMAKE_CXX_STANDARD=$CPP \ -DSPDLOG_BUILD_EXAMPLES=ON \ -DSPDLOG_BUILD_BENCH=OFF \ + -DSPDLOG_BUILD_TESTS=ON \ -DSPDLOG_SANITIZE_ADDRESS=$ASAN \ -DSPDLOG_SANITIZE_THREAD=$TSAN - make VERBOSE=1 -j2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 1dc01f87..3a0531dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,6 @@ cmake_minimum_required(VERSION 3.1) project(spdlog VERSION 1.3.0 LANGUAGES CXX) -include(CTest) include(CMakeDependentOption) include(GNUInstallDirs) @@ -53,11 +52,8 @@ endif() option(SPDLOG_BUILD_EXAMPLES "Build examples" ${SPDLOG_MASTER_PROJECT}) option(SPDLOG_BUILD_BENCH "Build benchmarks" ${SPDLOG_MASTER_PROJECT}) +option(SPDLOG_BUILD_TESTS "Build tests" ${SPDLOG_MASTER_PROJECT}) -cmake_dependent_option(SPDLOG_BUILD_TESTING - "Build spdlog tests" ${SPDLOG_MASTER_PROJECT} - "BUILD_TESTING" OFF -) target_include_directories( spdlog @@ -72,7 +68,8 @@ if(SPDLOG_BUILD_EXAMPLES) add_subdirectory(example) endif() -if(SPDLOG_BUILD_TESTING) +if(SPDLOG_BUILD_TESTS) + include(CTest) add_subdirectory(tests) endif() diff --git a/appveyor.yml b/appveyor.yml index d7843cde..98ce69ba 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,4 +29,6 @@ build_script: cmake .. -G %GENERATOR% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DSPDLOG_BUILD_BENCH=OFF cmake --build . --config %BUILD_TYPE% -test: off + +test_script: +- ctest -VV -C "%BUILD_TYPE%" diff --git a/tests/test_misc.cpp b/tests/test_misc.cpp index 9e097a45..1b880835 100644 --- a/tests/test_misc.cpp +++ b/tests/test_misc.cpp @@ -86,7 +86,7 @@ TEST_CASE("periodic flush", "[periodic_flush]") auto test_sink = std::static_pointer_cast(logger->sinks()[0]); spdlog::flush_every(std::chrono::seconds(1)); - std::this_thread::sleep_for(std::chrono::milliseconds(1100)); + std::this_thread::sleep_for(std::chrono::milliseconds(1250)); REQUIRE(test_sink->flush_counter() == 1); spdlog::flush_every(std::chrono::seconds(0)); spdlog::drop_all(); diff --git a/tests/test_registry.cpp b/tests/test_registry.cpp index d306dba2..bd326ef0 100644 --- a/tests/test_registry.cpp +++ b/tests/test_registry.cpp @@ -110,4 +110,5 @@ TEST_CASE("disable automatic registration", "[registry]") REQUIRE(logger1->level() == log_level); REQUIRE(logger2->level() == log_level); spdlog::set_level(spdlog::level::info); + spdlog::set_automatic_registration(true); }