Merge pull request #1509 from simdjson/jkeiser/all-tests

Make ctest succeed after running make all_tests
This commit is contained in:
John Keiser 2021-03-20 18:16:33 -07:00 committed by GitHub
commit 5607253be5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 5 deletions

View File

@ -19,7 +19,8 @@ include(GNUInstallDirs)
include(cmake/simdjson-flags.cmake) include(cmake/simdjson-flags.cmake)
include(cmake/simdjson-user-cmakecache.cmake) include(cmake/simdjson-user-cmakecache.cmake)
# So we can build just tests with "make all_tests"
add_custom_target(all_tests)
if(SIMDJSON_JUST_LIBRARY) if(SIMDJSON_JUST_LIBRARY)
message( STATUS "Building just the library, omitting all tests, tools and benchmarks." ) message( STATUS "Building just the library, omitting all tests, tools and benchmarks." )
@ -35,6 +36,7 @@ endif(SIMDJSON_JUST_LIBRARY)
# Create the top level simdjson library (must be done at this level to use both src/ and include/ # Create the top level simdjson library (must be done at this level to use both src/ and include/
# directories) and tools # directories) and tools
# #
add_subdirectory(include) add_subdirectory(include)
add_subdirectory(src) add_subdirectory(src)
add_subdirectory(windows) add_subdirectory(windows)

View File

@ -92,6 +92,8 @@ if (Git_FOUND AND (GIT_VERSION_STRING VERSION_GREATER "2.1.4") AND (NOT CMAKE_G
set_property(TEST checkperf APPEND PROPERTY LABELS per_implementation explicitonly) set_property(TEST checkperf APPEND PROPERTY LABELS per_implementation explicitonly)
set_property(TEST checkperf APPEND PROPERTY DEPENDS parse perfdiff ${SIMDJSON_USER_CMAKECACHE}) set_property(TEST checkperf APPEND PROPERTY DEPENDS parse perfdiff ${SIMDJSON_USER_CMAKECACHE})
set_property(TEST checkperf PROPERTY RUN_SERIAL TRUE) set_property(TEST checkperf PROPERTY RUN_SERIAL TRUE)
add_dependencies(per_implementation_tests checkperf)
add_dependencies(explicitonly_tests checkperf)
else() else()
if (CMAKE_GENERATOR MATCHES Ninja) if (CMAKE_GENERATOR MATCHES Ninja)
message(STATUS "We disable the checkperf targets under Ninja.") message(STATUS "We disable the checkperf targets under Ninja.")

View File

@ -87,6 +87,9 @@ else()
endif() endif()
add_custom_target(singleheader_tests)
add_dependencies(all_tests singleheader_tests)
# #
# Do not depend on singleheader files directly: depend on this target instead. # Do not depend on singleheader files directly: depend on this target instead.
# Otherwise the custom command may get triggered multiple times and race with itself! # Otherwise the custom command may get triggered multiple times and race with itself!
@ -126,6 +129,8 @@ if(NOT SIMDJSON_LEGACY_VISUAL_STUDIO AND NOT SIMDJSON_WINDOWS_DLL)
add_executable(amalgamate_demo $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/amalgamate_demo.cpp>) add_executable(amalgamate_demo $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/amalgamate_demo.cpp>)
target_link_libraries(amalgamate_demo simdjson-singleheader-include-source simdjson-internal-flags) target_link_libraries(amalgamate_demo simdjson-singleheader-include-source simdjson-internal-flags)
add_test(amalgamate_demo amalgamate_demo ${EXAMPLE_JSON} ${EXAMPLE_NDJSON}) add_test(amalgamate_demo amalgamate_demo ${EXAMPLE_JSON} ${EXAMPLE_NDJSON})
set_property(TEST amalgamate_demo APPEND PROPERTY LABELS per_implementation singleheader)
add_dependencies(singleheader_tests amalgamate_demo)
MESSAGE( STATUS "Including amalgamate_demo test. ${SIMDJSON_WINDOWS_DLL}" ) MESSAGE( STATUS "Including amalgamate_demo test. ${SIMDJSON_WINDOWS_DLL}" )
else() else()
MESSAGE( STATUS "You either have an old Visual Studio or you are building a DLL, amalgamate_demo test disabled." ) MESSAGE( STATUS "You either have an old Visual Studio or you are building a DLL, amalgamate_demo test disabled." )
@ -137,6 +142,8 @@ if(NOT SIMDJSON_LEGACY_VISUAL_STUDIO AND NOT SIMDJSON_WINDOWS_DLL)
add_library(simdjson-singleheader STATIC "") add_library(simdjson-singleheader STATIC "")
target_link_libraries(simdjson-singleheader simdjson-singleheader-source simdjson-internal-flags) target_link_libraries(simdjson-singleheader simdjson-singleheader-source simdjson-internal-flags)
add_compile_only_test(simdjson-singleheader) add_compile_only_test(simdjson-singleheader)
set_property(TEST simdjson-singleheader APPEND PROPERTY LABELS per_implementation singleheader)
add_dependencies(singleheader_tests simdjson-singleheader)
MESSAGE( STATUS "Including simdjson-singleheader test." ) MESSAGE( STATUS "Including simdjson-singleheader test." )
else() else()
MESSAGE( STATUS "You either have an old Visual Studio or you are building a DLL, simdjson-singleheader test disabled." ) MESSAGE( STATUS "You either have an old Visual Studio or you are building a DLL, simdjson-singleheader test disabled." )
@ -164,6 +171,8 @@ if (NOT (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}))
add_executable(amalgamate_demo_direct_from_repository ${CMAKE_CURRENT_SOURCE_DIR}/amalgamate_demo.cpp) add_executable(amalgamate_demo_direct_from_repository ${CMAKE_CURRENT_SOURCE_DIR}/amalgamate_demo.cpp)
target_link_libraries(amalgamate_demo_direct_from_repository simdjson-singleheader-include-source-direct-from-repository simdjson-internal-flags) target_link_libraries(amalgamate_demo_direct_from_repository simdjson-singleheader-include-source-direct-from-repository simdjson-internal-flags)
add_test(amalgamate_demo_direct_from_repository amalgamate_demo_direct_from_repository ${EXAMPLE_JSON} ${EXAMPLE_NDJSON}) add_test(amalgamate_demo_direct_from_repository amalgamate_demo_direct_from_repository ${EXAMPLE_JSON} ${EXAMPLE_NDJSON})
set_property(TEST amalgamate_demo_direct_from_repository APPEND PROPERTY LABELS per_implementation singleheader)
add_dependencies(singleheader_tests amalgamate_demo_direct_from_repository)
MESSAGE( STATUS "Including amalgamate_demo_direct_from_repository test." ) MESSAGE( STATUS "Including amalgamate_demo_direct_from_repository test." )
else() else()
MESSAGE( STATUS "You either have an old Visual Studio or you are building a DLL, amalgamate_demo test disabled." ) MESSAGE( STATUS "You either have an old Visual Studio or you are building a DLL, amalgamate_demo test disabled." )

View File

@ -2,9 +2,6 @@
link_libraries(simdjson-internal-flags test-data simdjson-windows-headers) link_libraries(simdjson-internal-flags test-data simdjson-windows-headers)
include(${PROJECT_SOURCE_DIR}/cmake/add_cpp_test.cmake) include(${PROJECT_SOURCE_DIR}/cmake/add_cpp_test.cmake)
# add_cpp_tests will add dependencies to this
add_custom_target(all_tests)
add_subdirectory(ondemand) add_subdirectory(ondemand)
# #
@ -59,6 +56,7 @@ if (BASH AND (NOT WIN32) AND SIMDJSON_BASH AND (TARGET json2json)) # The scripts
) )
set_property(TEST testjson2json APPEND PROPERTY DEPENDS minify json2json) set_property(TEST testjson2json APPEND PROPERTY DEPENDS minify json2json)
set_property(TEST testjson2json APPEND PROPERTY LABELS per_implementation) set_property(TEST testjson2json APPEND PROPERTY LABELS per_implementation)
add_dependencies(per_implementation_tests minify)
# #
# Competition parse test # Competition parse test
@ -71,8 +69,8 @@ if (BASH AND (NOT WIN32) AND SIMDJSON_BASH AND (TARGET json2json)) # The scripts
target_link_libraries(allparserscheckfile PRIVATE competition-all) target_link_libraries(allparserscheckfile PRIVATE competition-all)
add_test(issue150 ${BASH} ${CMAKE_CURRENT_SOURCE_DIR}/issue150.sh) add_test(issue150 ${BASH} ${CMAKE_CURRENT_SOURCE_DIR}/issue150.sh)
set_property(TEST issue150 APPEND PROPERTY DEPENDS allparserscheckfile)
set_property(TEST issue150 APPEND PROPERTY LABELS per_implementation competition) set_property(TEST issue150 APPEND PROPERTY LABELS per_implementation competition)
add_dependencies(all_tests allparserscheckfile)
endif() endif()
# #
@ -85,6 +83,8 @@ if (BASH AND (NOT WIN32) AND SIMDJSON_BASH AND (TARGET json2json)) # The scripts
add_test(NAME json2json COMMAND $<TARGET_FILE:json2json> ${EXAMPLE_JSON}) add_test(NAME json2json COMMAND $<TARGET_FILE:json2json> ${EXAMPLE_JSON})
set_property(TEST json2json APPEND PROPERTY LABELS acceptance per_implementation) set_property(TEST json2json APPEND PROPERTY LABELS acceptance per_implementation)
add_dependencies(acceptance_tests json2json)
add_dependencies(per_implementation_tests json2json)
# #
# SIMDJSON_FORCE_IMPLEMENTATION tests: run json2json with SIMDJSON # SIMDJSON_FORCE_IMPLEMENTATION tests: run json2json with SIMDJSON