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