Create acceptance_tests, all_tests, etc. make targets
And use them for mingw build and test
This commit is contained in:
parent
a405173d59
commit
041d59cc17
|
@ -23,11 +23,11 @@ environment:
|
|||
- job_name: VS2019 (Win32)
|
||||
platform: Win32
|
||||
CMAKE_ARGS: -A %Platform% -DSIMDJSON_BUILD_STATIC=OFF -DSIMDJSON_ENABLE_THREADS=ON # This should be the default. Testing anyway.
|
||||
CTEST_ARGS: -E "checkperf|ondemand_basictests"
|
||||
CTEST_ARGS: -LE explicitonly
|
||||
- job_name: VS2019 (Win32, No Exceptions)
|
||||
platform: Win32
|
||||
CMAKE_ARGS: -A %Platform% -DSIMDJSON_BUILD_STATIC=OFF -DSIMDJSON_ENABLE_THREADS=ON -DSIMDJSON_EXCEPTIONS=OFF
|
||||
CTEST_ARGS: -E "checkperf|ondemand_basictests"
|
||||
CTEST_ARGS: -LE explicitonly
|
||||
- job_name: VS2015
|
||||
image: Visual Studio 2015
|
||||
CMAKE_ARGS: -A %Platform% -DSIMDJSON_BUILD_STATIC=ON -DSIMDJSON_ENABLE_THREADS=OFF
|
||||
|
|
|
@ -61,5 +61,5 @@ jobs:
|
|||
mkdir build32
|
||||
cd build32
|
||||
cmake -DSIMDJSON_BUILD_STATIC=ON -DSIMDJSON_COMPETITION=OFF -DSIMDJSON_GOOGLE_BENCHMARKS=OFF -DSIMDJSON_ENABLE_THREADS=OFF ..
|
||||
cmake --build . --target parse_many_test jsoncheck basictests ondemand_basictests numberparsingcheck stringparsingcheck errortests integer_tests pointercheck --verbose
|
||||
ctest -R "(parse_many_test|jsoncheck|basictests|stringparsingcheck|numberparsingcheck|errortests|integer_tests|pointercheck)" --output-on-failure
|
||||
cmake --build . --target acceptance_tests --verbose
|
||||
ctest -L acceptance -LE no_mingw --output-on-failure
|
||||
|
|
|
@ -61,11 +61,11 @@ jobs:
|
|||
mkdir build64
|
||||
cd build64
|
||||
cmake -DSIMDJSON_BUILD_STATIC=ON -DSIMDJSON_COMPETITION=OFF -DSIMDJSON_GOOGLE_BENCHMARKS=OFF -DSIMDJSON_ENABLE_THREADS=OFF ..
|
||||
cmake --build . --target parse_many_test jsoncheck basictests ondemand_basictests numberparsingcheck stringparsingcheck errortests integer_tests pointercheck --verbose
|
||||
ctest -R "(parse_many_test|jsoncheck|basictests|stringparsingcheck|numberparsingcheck|errortests|integer_tests|pointercheck)" --output-on-failure
|
||||
cmake --build . --target acceptance_tests --verbose
|
||||
ctest -L acceptance -LE no_mingw --output-on-failure
|
||||
cd ..
|
||||
mkdir build64debug
|
||||
cd build64debug
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug -DSIMDJSON_BUILD_STATIC=ON -DSIMDJSON_COMPETITION=OFF -DSIMDJSON_GOOGLE_BENCHMARKS=OFF -DSIMDJSON_ENABLE_THREADS=OFF ..
|
||||
cmake --build . --target parse_many_test jsoncheck basictests ondemand_basictests numberparsingcheck stringparsingcheck errortests integer_tests pointercheck --verbose
|
||||
ctest -R "(parse_many_test|jsoncheck|basictests|stringparsingcheck|numberparsingcheck|errortests|integer_tests|pointercheck)" --output-on-failure
|
||||
cmake --build . --target acceptance_tests --verbose
|
||||
ctest -L acceptance -LE no_mingw --output-on-failure
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
function(add_compile_only_test TEST_NAME)
|
||||
add_test(
|
||||
NAME ${TEST_NAME}
|
||||
COMMAND ${CMAKE_COMMAND} --build . --target ${TEST_NAME} --config $<CONFIGURATION>
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
)
|
||||
set_target_properties(${TEST_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_DEFAULT_BUILD TRUE)
|
||||
endfunction()
|
|
@ -3,12 +3,12 @@
|
|||
# SOURCES defaults to testname.cpp if not specified.
|
||||
function(add_cpp_test TEST_NAME)
|
||||
# Parse arguments
|
||||
cmake_parse_arguments(PARSE_ARGV 1 ARGS "COMPILE_ONLY;LIBRARY;WILL_FAIL" "" "SOURCES;LABELS")
|
||||
cmake_parse_arguments(PARSE_ARGV 1 ARGS "COMPILE_ONLY;LIBRARY;WILL_FAIL" "" "SOURCES;LABELS;DEPENDENCY_OF")
|
||||
if (NOT ARGS_SOURCES)
|
||||
list(APPEND ARGS_SOURCES ${TEST_NAME}.cpp)
|
||||
endif()
|
||||
if (ARGS_COMPILE_ONLY)
|
||||
list(APPEND ${ARGS_LABELS} compile)
|
||||
list(APPEND ${ARGS_LABELS} compile_only)
|
||||
endif()
|
||||
|
||||
# Add the compile target
|
||||
|
@ -28,22 +28,29 @@ function(add_cpp_test TEST_NAME)
|
|||
set_target_properties(${TEST_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_DEFAULT_BUILD TRUE)
|
||||
else()
|
||||
add_test(${TEST_NAME} ${TEST_NAME})
|
||||
|
||||
# Add to <label>_tests make targets
|
||||
foreach(label ${ARGS_LABELS})
|
||||
list(APPEND ARGS_DEPENDENCY_OF ${label})
|
||||
endforeach(label ${ARGS_LABELS})
|
||||
endif()
|
||||
|
||||
# Add to test labels
|
||||
if (ARGS_LABELS)
|
||||
set_property(TEST ${TEST_NAME} APPEND PROPERTY LABELS ${ARGS_LABELS})
|
||||
endif()
|
||||
|
||||
# Add as a dependency of given targets
|
||||
foreach(dependency_of ${ARGS_DEPENDENCY_OF})
|
||||
if (NOT TARGET ${dependency_of}_tests)
|
||||
add_custom_target(${dependency_of}_tests)
|
||||
add_dependencies(all_tests ${dependency_of}_tests)
|
||||
endif(NOT TARGET ${dependency_of}_tests)
|
||||
add_dependencies(${dependency_of}_tests ${TEST_NAME})
|
||||
endforeach(dependency_of ${ARGS_DEPENDENCY_OF})
|
||||
|
||||
# If it will fail, mark the test as such
|
||||
if (ARGS_WILL_FAIL)
|
||||
set_property(TEST ${TEST_NAME} PROPERTY WILL_FAIL TRUE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(add_compile_only_test TEST_NAME)
|
||||
add_test(
|
||||
NAME ${TEST_NAME}
|
||||
COMMAND ${CMAKE_COMMAND} --build . --target ${TEST_NAME} --config $<CONFIGURATION>
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
)
|
||||
set_target_properties(${TEST_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_DEFAULT_BUILD TRUE)
|
||||
endfunction()
|
|
@ -51,15 +51,15 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|||
add_quickstart_test(quickstart quickstart.cpp)
|
||||
add_quickstart_test(quickstart11 quickstart.cpp c++11)
|
||||
add_quickstart_test(quickstart14 quickstart.cpp c++14)
|
||||
set_property( TEST quickstart quickstart11 APPEND PROPERTY LABELS acceptance compiletests )
|
||||
set_property( TEST quickstart quickstart11 APPEND PROPERTY LABELS acceptance compiletests no_mingw)
|
||||
endif()
|
||||
|
||||
add_quickstart_test(quickstart_noexceptions quickstart_noexceptions.cpp "" true)
|
||||
add_quickstart_test(quickstart_noexceptions11 quickstart_noexceptions.cpp c++11 true)
|
||||
set_property( TEST quickstart_noexceptions APPEND PROPERTY LABELS acceptance compile )
|
||||
set_property( TEST quickstart_noexceptions APPEND PROPERTY LABELS acceptance compile no_mingw)
|
||||
|
||||
add_quickstart_test(quickstart2_noexceptions quickstart2_noexceptions.cpp "" true)
|
||||
add_quickstart_test(quickstart2_noexceptions11 quickstart2_noexceptions.cpp c++11 true)
|
||||
set_property( TEST quickstart2_noexceptions APPEND PROPERTY LABELS acceptance compile )
|
||||
set_property( TEST quickstart2_noexceptions APPEND PROPERTY LABELS acceptance compile no_mingw)
|
||||
|
||||
endif()
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
include(${PROJECT_SOURCE_DIR}/cmake/add_cpp_test.cmake)
|
||||
|
||||
#
|
||||
# Amalgamation
|
||||
#
|
||||
|
@ -117,6 +115,8 @@ target_link_libraries(simdjson-singleheader-source INTERFACE simdjson-singlehead
|
|||
#
|
||||
#
|
||||
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/add_compile_only_test.cmake)
|
||||
|
||||
#
|
||||
# Test the generated simdjson.cpp/simdjson.h using the generated amalgamate_demo.cpp
|
||||
#
|
||||
|
|
|
@ -1,45 +1,10 @@
|
|||
# Helper so we don't have to repeat ourselves so much
|
||||
# Usage: add_cpp_test(testname [COMPILE_ONLY] [SOURCES a.cpp b.cpp ...] [LABELS acceptance per_implementation ...])
|
||||
# SOURCES defaults to testname.cpp if not specified.
|
||||
function(add_cpp_test TEST_NAME)
|
||||
# Parse arguments
|
||||
cmake_parse_arguments(PARSE_ARGV 1 ARGS "COMPILE_ONLY;WILL_FAIL" "" "SOURCES;LABELS")
|
||||
if (NOT ARGS_SOURCES)
|
||||
list(APPEND ARGS_SOURCES ${TEST_NAME}.cpp)
|
||||
endif()
|
||||
if (COMPILE_ONLY)
|
||||
list(APPEND ${ARGS_LABELS} compile)
|
||||
endif()
|
||||
|
||||
# Add executable
|
||||
add_executable(${TEST_NAME} ${ARGS_SOURCES})
|
||||
|
||||
# Add test
|
||||
if (ARGS_COMPILE_ONLY)
|
||||
add_test(
|
||||
NAME ${TEST_NAME}
|
||||
COMMAND ${CMAKE_COMMAND} --build . --target ${TEST_NAME} --config $<CONFIGURATION>
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
)
|
||||
set_target_properties(${TEST_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_DEFAULT_BUILD TRUE)
|
||||
else()
|
||||
add_test(${TEST_NAME} ${TEST_NAME})
|
||||
endif()
|
||||
|
||||
if (ARGS_LABELS)
|
||||
set_property(TEST ${TEST_NAME} APPEND PROPERTY LABELS ${ARGS_LABELS})
|
||||
endif()
|
||||
|
||||
if (ARGS_WILL_FAIL)
|
||||
set_property(TEST ${TEST_NAME} PROPERTY WILL_FAIL TRUE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Most tests need test data, and many need windows headers.
|
||||
link_libraries(simdjson-internal-flags test-data simdjson-windows-headers)
|
||||
|
||||
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)
|
||||
|
||||
#
|
||||
|
@ -54,20 +19,21 @@ target_compile_definitions(stringparsingcheck PRIVATE NOMINMAX)
|
|||
|
||||
# All remaining tests link with simdjson proper
|
||||
link_libraries(simdjson)
|
||||
add_cpp_test(random_string_number_tests LABELS acceptance per_implementation)
|
||||
add_cpp_test(basictests LABELS acceptance per_implementation)
|
||||
add_cpp_test(minify_tests LABELS acceptance per_implementation)
|
||||
add_cpp_test(document_stream_tests LABELS acceptance per_implementation)
|
||||
add_cpp_test(document_tests LABELS acceptance per_implementation)
|
||||
add_cpp_test(errortests LABELS acceptance per_implementation)
|
||||
add_cpp_test(integer_tests LABELS acceptance per_implementation)
|
||||
add_cpp_test(jsoncheck LABELS acceptance per_implementation)
|
||||
add_cpp_test(minefieldcheck LABELS acceptance per_implementation)
|
||||
add_cpp_test(parse_many_test LABELS acceptance per_implementation)
|
||||
add_cpp_test(pointercheck LABELS acceptance per_implementation) # https://tools.ietf.org/html/rfc6901
|
||||
add_cpp_test(extracting_values_example LABELS acceptance per_implementation)
|
||||
add_cpp_test(unicode_tests LABELS acceptance per_implementation)
|
||||
add_cpp_test(padded_string_tests)
|
||||
add_cpp_test(random_string_number_tests LABELS dom acceptance per_implementation no_mingw)
|
||||
add_cpp_test(basictests LABELS dom acceptance per_implementation)
|
||||
add_cpp_test(document_stream_tests LABELS dom acceptance per_implementation no_mingw)
|
||||
add_cpp_test(document_tests LABELS dom acceptance per_implementation no_mingw)
|
||||
add_cpp_test(errortests LABELS dom acceptance per_implementation)
|
||||
add_cpp_test(extracting_values_example LABELS dom acceptance per_implementation no_mingw)
|
||||
add_cpp_test(integer_tests LABELS dom acceptance per_implementation)
|
||||
add_cpp_test(jsoncheck LABELS dom acceptance per_implementation)
|
||||
add_cpp_test(minefieldcheck LABELS dom acceptance per_implementation no_mingw)
|
||||
add_cpp_test(parse_many_test LABELS dom acceptance per_implementation)
|
||||
add_cpp_test(pointercheck LABELS dom acceptance per_implementation) # https://tools.ietf.org/html/rfc6901
|
||||
add_cpp_test(unicode_tests LABELS dom acceptance per_implementation no_mingw)
|
||||
|
||||
add_cpp_test(minify_tests LABELS other acceptance per_implementation no_mingw)
|
||||
add_cpp_test(padded_string_tests LABELS other acceptance no_mingw)
|
||||
|
||||
find_program(BASH bash)
|
||||
|
||||
|
@ -94,11 +60,13 @@ if (BASH AND (NOT WIN32) AND SIMDJSON_BASH AND (TARGET json2json)) # The scripts
|
|||
if ((SIMDJSON_COMPETITION) AND (!SIMDJSON_SANITIZE))
|
||||
# It looks like RapidJSON does not pass the sanitizer under some conditions (Clang 10)
|
||||
add_executable(allparserscheckfile allparserscheckfile.cpp)
|
||||
add_dependencies(competition_tests allparserscheckfile)
|
||||
add_dependencies(per_implementation_tests allparserscheckfile)
|
||||
target_link_libraries(allparserscheckfile PRIVATE competition-all)
|
||||
|
||||
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)
|
||||
set_property(TEST issue150 APPEND PROPERTY LABELS per_implementation competition)
|
||||
endif()
|
||||
|
||||
#
|
||||
|
@ -107,10 +75,10 @@ if (BASH AND (NOT WIN32) AND SIMDJSON_BASH AND (TARGET json2json)) # The scripts
|
|||
|
||||
# This tests validates that the implementation is what we think it is if we get passed
|
||||
# SIMDJSON_FORCE_IMPLEMENTATION, so we know we're testing what we think we're testing
|
||||
add_cpp_test(checkimplementation LABELS per_implementation)
|
||||
add_cpp_test(checkimplementation LABELS other per_implementation)
|
||||
|
||||
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 no_mingw)
|
||||
|
||||
#
|
||||
# SIMDJSON_FORCE_IMPLEMENTATION tests: run json2json with SIMDJSON
|
||||
|
@ -141,18 +109,18 @@ endif()
|
|||
# Don't add the tests if we're on VS2017 or older; they don't succeed.
|
||||
if(NOT (MSVC AND MSVC_VERSION LESS 1920))
|
||||
if(SIMDJSON_EXCEPTIONS)
|
||||
add_cpp_test(readme_examples COMPILE_ONLY LABELS acceptance)
|
||||
add_cpp_test(readme_examples11 COMPILE_ONLY LABELS acceptance SOURCES readme_examples.cpp)
|
||||
add_cpp_test(readme_examples COMPILE_ONLY LABELS acceptance no_mingw)
|
||||
add_cpp_test(readme_examples11 COMPILE_ONLY LABELS acceptance no_mingw SOURCES readme_examples.cpp)
|
||||
set_target_properties(readme_examples11 PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF)
|
||||
endif()
|
||||
|
||||
add_cpp_test(readme_examples_noexceptions COMPILE_ONLY LABELS acceptance)
|
||||
add_cpp_test(readme_examples_noexceptions COMPILE_ONLY LABELS acceptance no_mingw)
|
||||
|
||||
add_cpp_test(readme_examples_noexceptions11 COMPILE_ONLY LABELS acceptance SOURCES readme_examples_noexceptions.cpp)
|
||||
add_cpp_test(readme_examples_noexceptions11 COMPILE_ONLY LABELS acceptance no_mingw SOURCES readme_examples_noexceptions.cpp)
|
||||
set_target_properties(readme_examples_noexceptions11 PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF)
|
||||
|
||||
# Compile tests that *should fail*
|
||||
add_cpp_test(readme_examples_will_fail_with_exceptions_off WILL_FAIL COMPILE_ONLY LABELS acceptance SOURCES readme_examples.cpp)
|
||||
add_cpp_test(readme_examples_will_fail_with_exceptions_off WILL_FAIL COMPILE_ONLY LABELS acceptance no_mingw SOURCES readme_examples.cpp)
|
||||
target_compile_definitions(readme_examples_will_fail_with_exceptions_off PRIVATE SIMDJSON_EXCEPTIONS=0)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
# adds a compilation test. Two targets are created, one expected to
|
||||
# succeed compilation and one that is expected to fail.
|
||||
function(add_dual_compile_test TEST_NAME)
|
||||
add_cpp_test(${TEST_NAME}_should_compile SOURCES ${TEST_NAME}.cpp COMPILE_ONLY)
|
||||
add_cpp_test(${TEST_NAME}_should_not_compile SOURCES ${TEST_NAME}.cpp COMPILE_ONLY WILL_FAIL LABELS acceptance)
|
||||
add_cpp_test(${TEST_NAME}_should_compile SOURCES ${TEST_NAME}.cpp COMPILE_ONLY LABELS no_mingw)
|
||||
add_cpp_test(${TEST_NAME}_should_not_compile SOURCES ${TEST_NAME}.cpp COMPILE_ONLY WILL_FAIL LABELS acceptance no_mingw)
|
||||
target_compile_definitions(${TEST_NAME}_should_not_compile PRIVATE COMPILATION_TEST_USE_FAILING_CODE=1)
|
||||
endfunction(add_dual_compile_test)
|
||||
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
link_libraries(simdjson)
|
||||
include_directories(..)
|
||||
|
||||
add_cpp_test(ondemand_active_tests LABELS acceptance per_implementation ondemand)
|
||||
add_cpp_test(ondemand_compilation_tests LABELS acceptance per_implementation ondemand)
|
||||
add_cpp_test(ondemand_dom_api_tests LABELS acceptance per_implementation ondemand)
|
||||
add_cpp_test(ondemand_error_tests LABELS acceptance per_implementation ondemand)
|
||||
add_cpp_test(ondemand_key_string_tests LABELS acceptance per_implementation ondemand)
|
||||
add_cpp_test(ondemand_number_tests LABELS acceptance per_implementation ondemand)
|
||||
add_cpp_test(ondemand_ordering_tests LABELS acceptance per_implementation ondemand)
|
||||
add_cpp_test(ondemand_parse_api_tests LABELS acceptance per_implementation ondemand)
|
||||
add_cpp_test(ondemand_twitter_tests LABELS acceptance per_implementation ondemand)
|
||||
add_cpp_test(ondemand_active_tests LABELS ondemand acceptance per_implementation)
|
||||
add_cpp_test(ondemand_compilation_tests LABELS ondemand acceptance per_implementation)
|
||||
add_cpp_test(ondemand_dom_api_tests LABELS ondemand acceptance per_implementation)
|
||||
add_cpp_test(ondemand_error_tests LABELS ondemand acceptance per_implementation)
|
||||
add_cpp_test(ondemand_key_string_tests LABELS ondemand acceptance per_implementation)
|
||||
add_cpp_test(ondemand_number_tests LABELS ondemand acceptance per_implementation)
|
||||
add_cpp_test(ondemand_ordering_tests LABELS ondemand acceptance per_implementation)
|
||||
add_cpp_test(ondemand_parse_api_tests LABELS ondemand acceptance per_implementation)
|
||||
add_cpp_test(ondemand_twitter_tests LABELS ondemand acceptance per_implementation)
|
||||
|
||||
if(HAVE_POSIX_FORK AND HAVE_POSIX_WAIT) # assert tests use fork and wait, which aren't on MSVC
|
||||
add_cpp_test(ondemand_assert_out_of_order_values LABELS per_implementation explicitonly assert ondemand)
|
||||
add_cpp_test(ondemand_assert_out_of_order_values LABELS assert per_implementation explicitonly ondemand)
|
||||
endif()
|
||||
|
||||
# Copy the simdjson dll into the tests directory
|
||||
|
|
Loading…
Reference in New Issue