1
- # Helper so we don't have to repeat ourselves so much
2
- # Usage: add_cpp_test(testname [COMPILE_ONLY] [SOURCES a.cpp b.cpp ...] [LABELS acceptance per_implementation ...])
3
- # SOURCES defaults to testname.cpp if not specified.
4
- function (add_cpp_test TEST_NAME)
5
- # Parse arguments
6
- cmake_parse_arguments (PARSE_ARGV 1 ARGS "COMPILE_ONLY;WILL_FAIL" "" "SOURCES;LABELS" )
7
- if (NOT ARGS_SOURCES)
8
- list (APPEND ARGS_SOURCES ${TEST_NAME} .cpp)
9
- endif ()
10
- if (COMPILE_ONLY)
11
- list (APPEND ${ARGS_LABELS} compile)
12
- endif ()
13
-
14
- # Add executable
15
- add_executable (${TEST_NAME} ${ARGS_SOURCES} )
16
-
17
- # Add test
18
- if (ARGS_COMPILE_ONLY)
19
- add_test (
20
- NAME ${TEST_NAME}
21
- COMMAND ${CMAKE_COMMAND} --build . --target ${TEST_NAME} --config $<CONFIGURATION >
22
- WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
23
- )
24
- set_target_properties (${TEST_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_DEFAULT_BUILD TRUE )
25
- else ()
26
- add_test (${TEST_NAME} ${TEST_NAME} )
27
- endif ()
28
-
29
- if (ARGS_LABELS)
30
- set_property (TEST ${TEST_NAME} APPEND PROPERTY LABELS ${ARGS_LABELS} )
31
- endif ()
32
-
33
- if (ARGS_WILL_FAIL)
34
- set_property (TEST ${TEST_NAME} PROPERTY WILL_FAIL TRUE )
35
- endif ()
36
- endfunction ()
37
-
38
1
# Most tests need test data, and many need windows headers.
39
2
link_libraries (simdjson-internal -flags test -data simdjson-windows-headers)
40
-
41
3
include (${PROJECT_SOURCE_DIR} /cmake/add_cpp_test.cmake)
42
4
5
+ # add_cpp_tests will add dependencies to this
6
+ add_custom_target (all_tests)
7
+
43
8
add_subdirectory (ondemand)
44
9
45
10
#
@@ -54,20 +19,21 @@ target_compile_definitions(stringparsingcheck PRIVATE NOMINMAX)
54
19
55
20
# All remaining tests link with simdjson proper
56
21
link_libraries (simdjson)
57
- add_cpp_test(random_string_number_tests LABELS acceptance per_implementation)
58
- add_cpp_test(basictests LABELS acceptance per_implementation)
59
- add_cpp_test(minify_tests LABELS acceptance per_implementation)
60
- add_cpp_test(document_stream_tests LABELS acceptance per_implementation)
61
- add_cpp_test(document_tests LABELS acceptance per_implementation)
62
- add_cpp_test(errortests LABELS acceptance per_implementation)
63
- add_cpp_test(integer_tests LABELS acceptance per_implementation)
64
- add_cpp_test(jsoncheck LABELS acceptance per_implementation)
65
- add_cpp_test(minefieldcheck LABELS acceptance per_implementation)
66
- add_cpp_test(parse_many_test LABELS acceptance per_implementation)
67
- add_cpp_test(pointercheck LABELS acceptance per_implementation) # https://tools.ietf.org/html/rfc6901
68
- add_cpp_test(extracting_values_example LABELS acceptance per_implementation)
69
- add_cpp_test(unicode_tests LABELS acceptance per_implementation)
70
- add_cpp_test(padded_string_tests)
22
+ add_cpp_test(random_string_number_tests LABELS dom acceptance per_implementation no_mingw)
23
+ add_cpp_test(basictests LABELS dom acceptance per_implementation)
24
+ add_cpp_test(document_stream_tests LABELS dom acceptance per_implementation no_mingw)
25
+ add_cpp_test(document_tests LABELS dom acceptance per_implementation no_mingw)
26
+ add_cpp_test(errortests LABELS dom acceptance per_implementation)
27
+ add_cpp_test(extracting_values_example LABELS dom acceptance per_implementation no_mingw)
28
+ add_cpp_test(integer_tests LABELS dom acceptance per_implementation)
29
+ add_cpp_test(jsoncheck LABELS dom acceptance per_implementation)
30
+ add_cpp_test(minefieldcheck LABELS dom acceptance per_implementation no_mingw)
31
+ add_cpp_test(parse_many_test LABELS dom acceptance per_implementation)
32
+ add_cpp_test(pointercheck LABELS dom acceptance per_implementation) # https://tools.ietf.org/html/rfc6901
33
+ add_cpp_test(unicode_tests LABELS dom acceptance per_implementation no_mingw)
34
+
35
+ add_cpp_test(minify_tests LABELS other acceptance per_implementation no_mingw)
36
+ add_cpp_test(padded_string_tests LABELS other acceptance no_mingw)
71
37
72
38
find_program (BASH bash)
73
39
@@ -94,11 +60,13 @@ if (BASH AND (NOT WIN32) AND SIMDJSON_BASH AND (TARGET json2json)) # The scripts
94
60
if ((SIMDJSON_COMPETITION) AND (!SIMDJSON_SANITIZE))
95
61
# It looks like RapidJSON does not pass the sanitizer under some conditions (Clang 10)
96
62
add_executable (allparserscheckfile allparserscheckfile.cpp)
63
+ add_dependencies (competition_tests allparserscheckfile)
64
+ add_dependencies (per_implementation_tests allparserscheckfile)
97
65
target_link_libraries (allparserscheckfile PRIVATE competition-all )
98
66
99
67
add_test (issue150 ${BASH} ${CMAKE_CURRENT_SOURCE_DIR} /issue150.sh)
100
68
set_property (TEST issue150 APPEND PROPERTY DEPENDS allparserscheckfile)
101
- set_property (TEST issue150 APPEND PROPERTY LABELS per_implementation)
69
+ set_property (TEST issue150 APPEND PROPERTY LABELS per_implementation competition )
102
70
endif ()
103
71
104
72
#
@@ -107,10 +75,10 @@ if (BASH AND (NOT WIN32) AND SIMDJSON_BASH AND (TARGET json2json)) # The scripts
107
75
108
76
# This tests validates that the implementation is what we think it is if we get passed
109
77
# SIMDJSON_FORCE_IMPLEMENTATION, so we know we're testing what we think we're testing
110
- add_cpp_test(checkimplementation LABELS per_implementation)
78
+ add_cpp_test(checkimplementation LABELS other per_implementation)
111
79
112
80
add_test (NAME json2json COMMAND $<TARGET_FILE:json2json> ${EXAMPLE_JSON} )
113
- set_property (TEST json2json APPEND PROPERTY LABELS acceptance per_implementation)
81
+ set_property (TEST json2json APPEND PROPERTY LABELS acceptance per_implementation no_mingw )
114
82
115
83
#
116
84
# SIMDJSON_FORCE_IMPLEMENTATION tests: run json2json with SIMDJSON
@@ -141,18 +109,18 @@ endif()
141
109
# Don't add the tests if we're on VS2017 or older; they don't succeed.
142
110
if (NOT (MSVC AND MSVC_VERSION LESS 1920))
143
111
if (SIMDJSON_EXCEPTIONS)
144
- add_cpp_test(readme_examples COMPILE_ONLY LABELS acceptance)
145
- add_cpp_test(readme_examples11 COMPILE_ONLY LABELS acceptance SOURCES readme_examples.cpp)
112
+ add_cpp_test(readme_examples COMPILE_ONLY LABELS acceptance no_mingw )
113
+ add_cpp_test(readme_examples11 COMPILE_ONLY LABELS acceptance no_mingw SOURCES readme_examples.cpp)
146
114
set_target_properties (readme_examples11 PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF )
147
115
endif ()
148
116
149
- add_cpp_test(readme_examples_noexceptions COMPILE_ONLY LABELS acceptance)
117
+ add_cpp_test(readme_examples_noexceptions COMPILE_ONLY LABELS acceptance no_mingw )
150
118
151
- add_cpp_test(readme_examples_noexceptions11 COMPILE_ONLY LABELS acceptance SOURCES readme_examples_noexceptions.cpp)
119
+ add_cpp_test(readme_examples_noexceptions11 COMPILE_ONLY LABELS acceptance no_mingw SOURCES readme_examples_noexceptions.cpp)
152
120
set_target_properties (readme_examples_noexceptions11 PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF )
153
121
154
122
# Compile tests that *should fail*
155
- add_cpp_test(readme_examples_will_fail_with_exceptions_off WILL_FAIL COMPILE_ONLY LABELS acceptance SOURCES readme_examples.cpp)
123
+ add_cpp_test(readme_examples_will_fail_with_exceptions_off WILL_FAIL COMPILE_ONLY LABELS acceptance no_mingw SOURCES readme_examples.cpp)
156
124
target_compile_definitions (readme_examples_will_fail_with_exceptions_off PRIVATE SIMDJSON_EXCEPTIONS=0)
157
125
endif ()
158
126
0 commit comments