From 752c62b4bd3eef3355c05936f898c487036ca0f5 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sat, 2 May 2020 16:07:09 +0200 Subject: [PATCH] :hammer: remove double tests --- Makefile | 6 +++--- test/CMakeLists.txt | 31 +++++++++++++++---------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 2641e6107..da3cc2f2e 100644 --- a/Makefile +++ b/Makefile @@ -79,7 +79,7 @@ coverage: mkdir build_coverage cd build_coverage ; CXX=g++-8 cmake .. -GNinja -DJSON_Coverage=ON -DJSON_MultipleHeaders=ON cd build_coverage ; ninja - cd build_coverage ; ctest -E '.*_default' -j10 + cd build_coverage ; ctest -j10 cd build_coverage ; ninja lcov_html open build_coverage/test/html/index.html @@ -88,7 +88,7 @@ coverage-fast: mkdir build_coverage cd build_coverage ; CXX=g++-9 cmake .. -GNinja -DJSON_Coverage=ON -DJSON_MultipleHeaders=ON cd build_coverage ; ninja - cd build_coverage ; ctest -E '.*_default' -j10 + cd build_coverage ; ctest -j10 cd build_coverage ; ninja fastcov_html open build_coverage/test/html/index.html @@ -485,7 +485,7 @@ clang_sanitize: mkdir clang_sanitize_build cd clang_sanitize_build ; CXX=$(COMPILER_DIR)/clang++ cmake .. -DJSON_Sanitizer=On -DJSON_MultipleHeaders=ON -GNinja cd clang_sanitize_build ; ninja - cd clang_sanitize_build ; ctest -E '.*_default' -j10 + cd clang_sanitize_build ; ctest -j10 ########################################################################## diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 22cbea0b5..28ad7f715 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -155,32 +155,20 @@ foreach(file ${files}) string(REGEX REPLACE "unit-([^$]+)" "test-\\1" testcase ${file_basename}) add_executable(${testcase} $ ${file}) - target_compile_definitions(${testcase} PRIVATE - DOCTEST_CONFIG_SUPER_FAST_ASSERTS - ) + target_compile_definitions(${testcase} PRIVATE DOCTEST_CONFIG_SUPER_FAST_ASSERTS) target_compile_options(${testcase} PRIVATE $<$:/EHsc;$<$:/Od>> $<$>:-Wno-deprecated;-Wno-float-equal> $<$:-Wno-deprecated-declarations> ) - target_include_directories(${testcase} PRIVATE - ${CMAKE_BINARY_DIR}/include - thirdparty/doctest - thirdparty/fifo_map - ) + target_include_directories(${testcase} PRIVATE ${CMAKE_BINARY_DIR}/include thirdparty/doctest thirdparty/fifo_map) target_link_libraries(${testcase} ${NLOHMANN_JSON_TARGET_NAME}) - add_test(NAME "${testcase}_default" - COMMAND ${testcase} ${DOCTEST_TEST_FILTER} - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - ) - set_tests_properties("${testcase}_default" PROPERTIES LABELS "default" FIXTURES_REQUIRED TEST_DATA) - - add_test(NAME "${testcase}_all" + add_test(NAME "${testcase}" COMMAND ${testcase} ${DOCTEST_TEST_FILTER} --no-skip WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) - set_tests_properties("${testcase}_all" PROPERTIES LABELS "all" FIXTURES_REQUIRED TEST_DATA) + set_tests_properties("${testcase}" PROPERTIES LABELS "all" FIXTURES_REQUIRED TEST_DATA) if(JSON_Valgrind) add_test(NAME "${testcase}_valgrind" @@ -191,6 +179,17 @@ foreach(file ${files}) endif() endforeach() +add_executable(json_unit EXCLUDE_FROM_ALL $ ${files}) +target_compile_definitions(json_unit PRIVATE DOCTEST_CONFIG_SUPER_FAST_ASSERTS) +target_compile_options(json_unit PRIVATE + $<$:/EHsc;$<$:/Od>> + $<$>:-Wno-deprecated;-Wno-float-equal> + $<$:-Wno-deprecated-declarations> +) +target_include_directories(json_unit PRIVATE ${CMAKE_BINARY_DIR}/include thirdparty/doctest thirdparty/fifo_map) +target_link_libraries(json_unit ${NLOHMANN_JSON_TARGET_NAME}) +add_dependencies(json_unit download_test_data) + ############################################################################# # Test the generated build configs #############################################################################