Speed up Heap::isMarkedConcurrently
[WebKit-https.git] / Tools / TestWebKitAPI / CMakeLists.txt
1 set(TESTWEBKITAPI_DIR "${TOOLS_DIR}/TestWebKitAPI")
2 set(test_wtf_LIBRARIES
3     WTF${DEBUG_SUFFIX}
4     gtest
5 )
6
7 set(test_webcore_LIBRARIES
8     WTF${DEBUG_SUFFIX}
9     WebCore${DEBUG_SUFFIX}
10     gtest
11 )
12
13 set(TestWebKitAPI_LIBRARIES
14     WTF${DEBUG_SUFFIX}
15 )
16
17 if (ENABLE_WEBKIT2)
18     set(test_webkit2_api_LIBRARIES
19         JavaScriptCore
20         TestWebKitAPIBase
21         WTF
22         WebKit2
23         gtest
24     )
25     list(APPEND TestWebKitAPI_LIBRARIES
26         WebKit2
27     )
28 else ()
29     list(APPEND TestWebKitAPI_LIBRARIES
30         WebKit${DEBUG_SUFFIX}
31     )
32 endif ()
33
34
35 set(TestJavaScriptCore_LIBRARIES
36     JavaScriptCore
37     gtest
38 )
39
40 set(TestWTF_SOURCES
41     ${TESTWEBKITAPI_DIR}/Counters.cpp
42     ${TESTWEBKITAPI_DIR}/TestsController.cpp
43     ${TESTWEBKITAPI_DIR}/Tests/WTF/AtomicString.cpp
44     ${TESTWEBKITAPI_DIR}/Tests/WTF/BloomFilter.cpp
45     ${TESTWEBKITAPI_DIR}/Tests/WTF/Consume.cpp
46     ${TESTWEBKITAPI_DIR}/Tests/WTF/CrossThreadTask.cpp
47     ${TESTWEBKITAPI_DIR}/Tests/WTF/CString.cpp
48     ${TESTWEBKITAPI_DIR}/Tests/WTF/CheckedArithmeticOperations.cpp
49     ${TESTWEBKITAPI_DIR}/Tests/WTF/Condition.cpp
50     ${TESTWEBKITAPI_DIR}/Tests/WTF/DateMath.cpp
51     ${TESTWEBKITAPI_DIR}/Tests/WTF/Deque.cpp
52     ${TESTWEBKITAPI_DIR}/Tests/WTF/EnumTraits.cpp
53     ${TESTWEBKITAPI_DIR}/Tests/WTF/HashCountedSet.cpp
54     ${TESTWEBKITAPI_DIR}/Tests/WTF/HashMap.cpp
55     ${TESTWEBKITAPI_DIR}/Tests/WTF/HashSet.cpp
56     ${TESTWEBKITAPI_DIR}/Tests/WTF/IntegerToStringConversion.cpp
57     ${TESTWEBKITAPI_DIR}/Tests/WTF/ListHashSet.cpp
58     ${TESTWEBKITAPI_DIR}/Tests/WTF/Lock.cpp
59     ${TESTWEBKITAPI_DIR}/Tests/WTF/MD5.cpp
60     ${TESTWEBKITAPI_DIR}/Tests/WTF/MathExtras.cpp
61     ${TESTWEBKITAPI_DIR}/Tests/WTF/MediaTime.cpp
62     ${TESTWEBKITAPI_DIR}/Tests/WTF/MetaAllocator.cpp
63     ${TESTWEBKITAPI_DIR}/Tests/WTF/NakedPtr.cpp
64     ${TESTWEBKITAPI_DIR}/Tests/WTF/OptionSet.cpp
65     ${TESTWEBKITAPI_DIR}/Tests/WTF/ParkingLot.cpp
66     ${TESTWEBKITAPI_DIR}/Tests/WTF/RedBlackTree.cpp
67     ${TESTWEBKITAPI_DIR}/Tests/WTF/Ref.cpp
68     ${TESTWEBKITAPI_DIR}/Tests/WTF/RefCounter.cpp
69     ${TESTWEBKITAPI_DIR}/Tests/WTF/RefLogger.cpp
70     ${TESTWEBKITAPI_DIR}/Tests/WTF/RefPtr.cpp
71     ${TESTWEBKITAPI_DIR}/Tests/WTF/SHA1.cpp
72     ${TESTWEBKITAPI_DIR}/Tests/WTF/SaturatedArithmeticOperations.cpp
73     ${TESTWEBKITAPI_DIR}/Tests/WTF/Scope.cpp
74     ${TESTWEBKITAPI_DIR}/Tests/WTF/ScopedLambda.cpp
75     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringBuilder.cpp
76     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringHasher.cpp
77     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringImpl.cpp
78     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringOperators.cpp
79     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringView.cpp
80     ${TESTWEBKITAPI_DIR}/Tests/WTF/TemporaryChange.cpp
81     ${TESTWEBKITAPI_DIR}/Tests/WTF/UniqueRef.cpp
82     ${TESTWEBKITAPI_DIR}/Tests/WTF/Variant.cpp
83     ${TESTWEBKITAPI_DIR}/Tests/WTF/Vector.cpp
84     ${TESTWEBKITAPI_DIR}/Tests/WTF/WTFString.cpp
85     ${TESTWEBKITAPI_DIR}/Tests/WTF/WeakPtr.cpp
86     ${TESTWEBKITAPI_DIR}/Tests/WTF/WorkQueue.cpp
87 )
88
89 # FIXME: Tests/WTF/RunLoop.cpp is missing because it doesn't work for Windows.
90 # FIXME: Platform-specific sources in Tests/WTF are not included in TestWTF_SOURCES.
91
92 WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
93
94 include_directories(
95     ${TESTWEBKITAPI_DIR}
96     ${CMAKE_BINARY_DIR}
97     ${CMAKE_SOURCE_DIR}/Source
98     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}
99     ${DERIVED_SOURCES_WEBCORE_DIR}
100     ${JAVASCRIPTCORE_DIR}
101     ${JAVASCRIPTCORE_DIR}/API
102     ${JAVASCRIPTCORE_DIR}/ForwardingHeaders
103     ${THIRDPARTY_DIR}/gtest/include
104     ${WEBCORE_DIR}/css
105     ${WEBCORE_DIR}/css/parser
106     ${WEBCORE_DIR}/dom
107     ${WEBCORE_DIR}/editing
108     ${WEBCORE_DIR}/loader/cache
109     ${WEBCORE_DIR}/page
110     ${WEBCORE_DIR}/platform
111     ${WEBCORE_DIR}/platform/animation
112     ${WEBCORE_DIR}/platform/graphics
113     ${WEBCORE_DIR}/platform/text
114     ${WEBCORE_DIR}/platform/network
115     ${WEBCORE_DIR}/platform/network/soup
116     ${WEBCORE_DIR}/rendering/style
117     ${WEBKIT2_DIR}/Platform/IPC
118     ${WEBKIT2_DIR}/Shared
119     ${WEBKIT2_DIR}/Shared/API
120     ${WEBKIT2_DIR}/Shared/API/c
121     ${WEBKIT2_DIR}/Shared/Plugins
122     ${WEBKIT2_DIR}/UIProcess
123     ${WEBKIT2_DIR}/UIProcess/API
124     ${WEBKIT2_DIR}/WebProcess/InjectedBundle
125     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c
126     ${WTF_DIR}
127 )
128
129 if (ENABLE_WEBKIT2)
130     add_library(TestWebKitAPIInjectedBundle SHARED
131         ${bundle_harness_SOURCES}
132         ${TESTWEBKITAPI_DIR}/InjectedBundleController.cpp
133         ${TESTWEBKITAPI_DIR}/InjectedBundleMain.cpp
134         ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
135         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/CanHandleRequest_Bundle.cpp
136         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DidAssociateFormControls_Bundle.cpp
137         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DOMWindowExtensionBasic_Bundle.cpp
138         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DOMWindowExtensionNoCache_Bundle.cpp
139         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp
140         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback_Bundle.cpp
141         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/HitTestResultNodeHandle_Bundle.cpp
142         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleBasic_Bundle.cpp
143         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleFrameHitTest_Bundle.cpp
144         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp
145         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/LoadCanceledNoServerRedirectCallback_Bundle.cpp
146         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/MouseMoveAfterCrash_Bundle.cpp
147         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp
148         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp
149         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp
150         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp
151         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ParentFrame_Bundle.cpp
152         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ResponsivenessTimerDoesntFireEarly_Bundle.cpp
153         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ShouldGoToBackForwardListItem_Bundle.cpp
154         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/TextFieldDidBeginAndEndEditing_Bundle.cpp
155         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/UserMessage_Bundle.cpp
156         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillLoad_Bundle.cpp
157         ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillSendSubmitEvent_Bundle.cpp
158     )
159
160     target_link_libraries(TestWebKitAPIInjectedBundle ${TestWebKitAPI_LIBRARIES})
161     add_dependencies(TestWebKitAPIInjectedBundle WTF ${ForwardingHeadersForTestWebKitAPI_NAME})
162
163     get_property(TestWebKitAPIInjectedBundle_PATH TARGET TestWebKitAPIInjectedBundle PROPERTY LOCATION)
164 endif ()
165
166 if (WIN32)
167     add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=0)
168 else ()
169     add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1)
170 endif ()
171
172 add_definitions(-DGTEST_HAS_RTTI=0
173     -DTEST_WEBKIT2_RESOURCES_DIR=\"${TESTWEBKITAPI_DIR}/Tests/WebKit2\"
174     -DTEST_INJECTED_BUNDLE_PATH=\"${TestWebKitAPIInjectedBundle_PATH}\"
175 )
176
177 # FIXME: This works around compatibility problems in the old version of the third-pary
178 # googletest source code checkout. It should be removed once we upgrade to a newer version.
179 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
180     add_definitions(-DGTEST_HAS_TR1_TUPLE=0)
181 endif ()
182
183 add_executable(TestWTF
184     ${test_main_SOURCES}
185     ${TestWTF_SOURCES}
186 )
187
188 if (WIN32)
189     add_dependencies(TestWTF TestWTFLib)
190 endif ()
191
192 target_link_libraries(TestWTF ${test_wtf_LIBRARIES})
193 add_dependencies(TestWTF WTF ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
194 add_test(TestWTF ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY_WTF}/TestWTF)
195 set_tests_properties(TestWTF PROPERTIES TIMEOUT 60)
196 set_target_properties(TestWTF PROPERTIES
197     RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY_WTF}
198 )
199
200 # FIXME: EFL is the only port that separates the WebCore binaries. Each port ought to do closer to the same thing.
201 foreach (testName ${test_webcore_BINARIES})
202     add_executable(${testName} ${test_main_SOURCES} ${TESTWEBKITAPI_DIR}/TestsController.cpp ${TESTWEBKITAPI_DIR}/Tests/WebCore/${testName}.cpp)
203     add_test(${testName} ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore/${testName})
204     set_tests_properties(${testName} PROPERTIES TIMEOUT 60)
205     target_link_libraries(${testName} ${test_webcore_LIBRARIES})
206     set_target_properties(${testName} PROPERTIES
207         RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore
208     )
209 endforeach ()
210
211 if (ENABLE_WEBKIT2)
212     add_library(TestWebKitAPIBase
213         ${test_main_SOURCES}
214         ${webkit2_api_harness_SOURCES}
215         ${TESTWEBKITAPI_DIR}/JavaScriptTest.cpp
216         ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
217         ${TESTWEBKITAPI_DIR}/TestsController.cpp
218     )
219
220     add_dependencies(TestWebKitAPIBase WebKit2 ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
221
222     foreach (testName ${test_webkit2_api_BINARIES})
223         get_filename_component(testBaseName ${testName} NAME)
224         add_executable(${testBaseName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
225         add_test(${testBaseName} ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit2/${testBaseName})
226         set_tests_properties(${testBaseName} PROPERTIES TIMEOUT 60)
227         target_link_libraries(${testBaseName} ${test_webkit2_api_LIBRARIES})
228         set_target_properties(${testBaseName} PROPERTIES
229             RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit2
230         )
231     endforeach ()
232
233     # We don't run tests that are expected to fail. We could use the WILL_FAIL
234     # property, but it reports failure when the test crashes or timeouts and would
235     # make the bot red.
236     foreach (testName ${test_webkit2_api_fail_BINARIES})
237         add_executable(${testName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
238         target_link_libraries(${testName} ${test_webkit2_api_LIBRARIES})
239         set_target_properties(${testName} PROPERTIES
240             RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit2/failure
241         )
242     endforeach ()
243 endif ()