Initialize a separate variable (TestWTF_SOURCES) with the list of files
[WebKit-https.git] / Tools / TestWebKitAPI / CMakeLists.txt
1 set(TESTWEBKITAPI_DIR "${TOOLS_DIR}/TestWebKitAPI")
2 set(TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/TestWebKitAPI")
3
4 include_directories(${CMAKE_BINARY_DIR}
5     ${TESTWEBKITAPI_DIR}
6     ${CMAKE_SOURCE_DIR}/Source
7     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}
8     ${DERIVED_SOURCES_WEBCORE_DIR}
9     ${JAVASCRIPTCORE_DIR}
10     ${JAVASCRIPTCORE_DIR}/API
11     ${JAVASCRIPTCORE_DIR}/ForwardingHeaders
12     ${JAVASCRIPTCORE_DIR}/assembler
13     ${JAVASCRIPTCORE_DIR}/bytecode
14     ${JAVASCRIPTCORE_DIR}/disassembler
15     ${JAVASCRIPTCORE_DIR}/heap
16     ${JAVASCRIPTCORE_DIR}/jit
17     ${JAVASCRIPTCORE_DIR}/llint
18     ${JAVASCRIPTCORE_DIR}/parser
19     ${JAVASCRIPTCORE_DIR}/runtime
20     ${THIRDPARTY_DIR}/gtest/include
21     ${WEBCORE_DIR}/editing
22     ${WEBCORE_DIR}/platform
23     ${WEBCORE_DIR}/platform/graphics
24     ${WEBCORE_DIR}/platform/text
25     ${WEBCORE_DIR}/platform/network
26     ${WEBCORE_DIR}/platform/network/soup
27     ${WEBKIT2_DIR}/Platform/IPC
28     ${WEBKIT2_DIR}/Shared
29     ${WEBKIT2_DIR}/Shared/API/c
30     ${WEBKIT2_DIR}/Shared/Plugins
31     ${WEBKIT2_DIR}/UIProcess
32     ${WEBKIT2_DIR}/WebProcess/InjectedBundle
33     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c
34     ${WTF_DIR}
35 )
36
37 set(test_wtf_LIBRARIES
38     WTF
39     gtest
40 )
41
42 set(test_webcore_LIBRARIES
43     gtest
44     WTF
45     WebCore
46 )
47
48 set(test_webkit2_api_LIBRARIES
49     TestWebKitAPIBase
50     WTF
51     JavaScriptCore
52     WebKit2
53     gtest
54 )
55
56 set(TestWebKitAPI_LIBRARIES
57     WTF
58     WebKit2
59 )
60
61 set(TestJavaScriptCore_LIBRARIES
62     gtest
63     JavaScriptCore
64 )
65
66 set(TestWTF_SOURCES
67     ${TESTWEBKITAPI_DIR}/TestsController.cpp
68     ${TESTWEBKITAPI_DIR}/Tests/WTF/AtomicString.cpp
69     ${TESTWEBKITAPI_DIR}/Tests/WTF/CString.cpp
70     ${TESTWEBKITAPI_DIR}/Tests/WTF/CheckedArithmeticOperations.cpp
71     ${TESTWEBKITAPI_DIR}/Tests/WTF/Deque.cpp
72     ${TESTWEBKITAPI_DIR}/Tests/WTF/Functional.cpp
73     ${TESTWEBKITAPI_DIR}/Tests/WTF/HashMap.cpp
74     ${TESTWEBKITAPI_DIR}/Tests/WTF/HashSet.cpp
75     ${TESTWEBKITAPI_DIR}/Tests/WTF/IntegerToStringConversion.cpp
76     ${TESTWEBKITAPI_DIR}/Tests/WTF/ListHashSet.cpp
77     ${TESTWEBKITAPI_DIR}/Tests/WTF/MD5.cpp
78     ${TESTWEBKITAPI_DIR}/Tests/WTF/MathExtras.cpp
79     ${TESTWEBKITAPI_DIR}/Tests/WTF/MediaTime.cpp
80     ${TESTWEBKITAPI_DIR}/Tests/WTF/MetaAllocator.cpp
81     ${TESTWEBKITAPI_DIR}/Tests/WTF/RedBlackTree.cpp
82     ${TESTWEBKITAPI_DIR}/Tests/WTF/Ref.cpp
83     ${TESTWEBKITAPI_DIR}/Tests/WTF/RefPtr.cpp
84     ${TESTWEBKITAPI_DIR}/Tests/WTF/SHA1.cpp
85     ${TESTWEBKITAPI_DIR}/Tests/WTF/SaturatedArithmeticOperations.cpp
86     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringBuilder.cpp
87     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringHasher.cpp
88     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringImpl.cpp
89     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringOperators.cpp
90     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringView.cpp
91     ${TESTWEBKITAPI_DIR}/Tests/WTF/TemporaryChange.cpp
92     ${TESTWEBKITAPI_DIR}/Tests/WTF/Vector.cpp
93     ${TESTWEBKITAPI_DIR}/Tests/WTF/WTFString.cpp
94 )
95
96 WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
97
98 add_library(TestWebKitAPIInjectedBundle SHARED
99     ${bundle_harness_SOURCES}
100     ${TESTWEBKITAPI_DIR}/InjectedBundleController.cpp
101     ${TESTWEBKITAPI_DIR}/InjectedBundleMain.cpp
102     ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
103     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/CanHandleRequest_Bundle.cpp
104     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DidAssociateFormControls_Bundle.cpp
105     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DOMWindowExtensionBasic_Bundle.cpp
106     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DOMWindowExtensionNoCache_Bundle.cpp
107     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp
108     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback_Bundle.cpp
109     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/HitTestResultNodeHandle_Bundle.cpp
110     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleBasic_Bundle.cpp
111     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleFrameHitTest_Bundle.cpp
112     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp
113     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/LoadCanceledNoServerRedirectCallback_Bundle.cpp
114     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/MouseMoveAfterCrash_Bundle.cpp
115     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp
116     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp
117     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp
118     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp
119     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ParentFrame_Bundle.cpp
120     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ResponsivenessTimerDoesntFireEarly_Bundle.cpp
121     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ShouldGoToBackForwardListItem_Bundle.cpp
122     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/UserMessage_Bundle.cpp
123     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillLoad_Bundle.cpp
124     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillSendSubmitEvent_Bundle.cpp
125 )
126
127 target_link_libraries(TestWebKitAPIInjectedBundle ${TestWebKitAPI_LIBRARIES})
128 add_dependencies(TestWebKitAPIInjectedBundle ${ForwardingHeadersForTestWebKitAPI_NAME})
129
130 get_property(TestWebKitAPIInjectedBundle_PATH TARGET TestWebKitAPIInjectedBundle PROPERTY LOCATION)
131
132 add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1 -DGTEST_HAS_RTTI=0
133     -DTEST_WEBKIT2_RESOURCES_DIR=\"${TESTWEBKITAPI_DIR}/Tests/WebKit2\"
134     -DTEST_INJECTED_BUNDLE_PATH=\"${TestWebKitAPIInjectedBundle_PATH}\"
135 )
136
137 # FIXME: This works around compatibility problems in the old version of the third-pary
138 # googletest source code checkout. It should be removed once we upgrade to a newer version.
139 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
140     add_definitions(-DGTEST_HAS_TR1_TUPLE=0)
141 endif ()
142
143 add_executable(TestWTF
144     ${test_main_SOURCES}
145     ${TestWTF_SOURCES}
146 )
147
148 target_link_libraries(TestWTF ${test_wtf_LIBRARIES})
149 add_dependencies(TestWTF ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
150 add_test(TestWTF ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WTF/TestWTF)
151 set_tests_properties(TestWTF PROPERTIES TIMEOUT 60)
152     set_target_properties(TestWTF PROPERTIES
153         RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WTF
154     )
155
156
157 add_executable(TestJavaScriptCore
158     ${test_main_SOURCES}
159     ${TESTWEBKITAPI_DIR}/TestsController.cpp
160     ${TESTWEBKITAPI_DIR}/Tests/JavaScriptCore/VMInspector.cpp
161 )
162
163 target_link_libraries(TestJavaScriptCore ${TestJavaScriptCore_LIBRARIES})
164 add_test(TestJavaScriptCore ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/JavaScriptCore/TestJavaScriptCore)
165 set_tests_properties(TestJavaScriptCore PROPERTIES TIMEOUT 60)
166 set_target_properties(TestJavaScriptCore PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/JavaScriptCore)
167
168 foreach (testName ${test_webcore_BINARIES})
169     add_executable(${testName} ${test_main_SOURCES} ${TESTWEBKITAPI_DIR}/TestsController.cpp ${TESTWEBKITAPI_DIR}/Tests/WebCore/${testName}.cpp)
170     add_test(${testName} ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore/${testName})
171     set_tests_properties(${testName} PROPERTIES TIMEOUT 60)
172     target_link_libraries(${testName} ${test_webcore_LIBRARIES})
173     set_target_properties(${testName} PROPERTIES
174         RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore
175     )
176 endforeach ()
177
178 add_library(TestWebKitAPIBase
179     ${test_main_SOURCES}
180     ${webkit2_api_harness_SOURCES}
181     ${TESTWEBKITAPI_DIR}/JavaScriptTest.cpp
182     ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
183     ${TESTWEBKITAPI_DIR}/TestsController.cpp
184 )
185
186 add_dependencies(TestWebKitAPIBase WebKit2 ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
187
188 foreach (testName ${test_webkit2_api_BINARIES})
189     get_filename_component(testBaseName ${testName} NAME)
190     add_executable(${testBaseName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
191     add_test(${testBaseName} ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit2/${testBaseName})
192     set_tests_properties(${testBaseName} PROPERTIES TIMEOUT 60)
193     target_link_libraries(${testBaseName} ${test_webkit2_api_LIBRARIES})
194     set_target_properties(${testBaseName} PROPERTIES
195         RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit2
196     )
197 endforeach ()
198
199 # We don't run tests that are expected to fail. We could use the WILL_FAIL
200 # property, but it reports failure when the test crashes or timeouts and would
201 # make the bot red.
202
203 foreach (testName ${test_webkit2_api_fail_BINARIES})
204     add_executable(${testName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
205     target_link_libraries(${testName} ${test_webkit2_api_LIBRARIES})
206     set_target_properties(${testBaseName} PROPERTIES
207         RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit2
208     )
209 endforeach ()