Skip to content

Commit

Permalink
Refactor the mess in API test CMakelists.
Browse files Browse the repository at this point in the history
- Fix the regression caused by WK2 tests calling WTF code directly.
- Remove the library used on Nix tests and move the code to a single
library used on all WebKit2 tests.
- Unify WebKit2 and Nix tests, they are both WK2 :-).
- Add a bit of flexibility to the CMakeLists otherwise would be impossible to
  do this patch.
- Apply the changes to EFL as well, so EFL port wont break when we upstream Nix.

Reviewed by: Rafael Brandão
  • Loading branch information
Hugo Parente Lima committed May 23, 2013
1 parent 82ee87f commit f6b80e1
Show file tree
Hide file tree
Showing 3 changed files with 172 additions and 230 deletions.
76 changes: 34 additions & 42 deletions Tools/TestWebKitAPI/CMakeLists.txt
Expand Up @@ -21,10 +21,20 @@ include_directories(${CMAKE_BINARY_DIR}
${WTF_DIR}
)

WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
set(webkit2Test_LIBRARIES
WTF
JavaScriptCore
WebKit2
gtest
)

add_library(TestWebKitAPIInjectedBundle SHARED
${bundle_harness_SOURCES}
set(TestWebKitAPIBase_SOURCES
${TESTWEBKITAPI_DIR}/JavaScriptTest.cpp
${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
${TESTWEBKITAPI_DIR}/TestsController.cpp
)

set(TestWebKitAPIInjectedBundle_SOURCES
${TESTWEBKITAPI_DIR}/InjectedBundleController.cpp
${TESTWEBKITAPI_DIR}/InjectedBundleMain.cpp
${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
Expand All @@ -51,6 +61,9 @@ add_library(TestWebKitAPIInjectedBundle SHARED
${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillSendSubmitEvent_Bundle.cpp
)

WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()

add_library(TestWebKitAPIInjectedBundle SHARED ${TestWebKitAPIInjectedBundle_SOURCES})
target_link_libraries(TestWebKitAPIInjectedBundle WTF)
add_dependencies(TestWebKitAPIInjectedBundle WebKit2 ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})

Expand All @@ -61,11 +74,7 @@ add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1
-DTEST_INJECTED_BUNDLE_PATH=\"${TestWebKitAPIInjectedBundle_PATH}\"
)

set(test_wtf_LIBRARIES
WTF
gtest
)

# WTF tests
add_executable(test_wtf
${test_main_SOURCES}
${TESTWEBKITAPI_DIR}/TestsController.cpp
Expand All @@ -90,56 +99,39 @@ add_executable(test_wtf
${TESTWEBKITAPI_DIR}/Tests/WTF/VectorReverse.cpp
${TESTWEBKITAPI_DIR}/Tests/WTF/WTFString.cpp
)

target_link_libraries(test_wtf ${test_wtf_LIBRARIES})
target_link_libraries(test_wtf WTF gtest)
add_dependencies(test_wtf ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
add_test(test_wtf ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_wtf)
set_tests_properties(test_wtf PROPERTIES TIMEOUT 60)

set(test_webcore_LIBRARIES
gtest
WTF
WebCore
)

foreach (testName ${test_webcore_BINARIES})
# WebCore tests
foreach (testName ${webcoreTestList})
add_executable(test_webcore_${testName} ${test_main_SOURCES} ${TESTWEBKITAPI_DIR}/TestsController.cpp ${TESTWEBKITAPI_DIR}/Tests/WebCore/${testName}.cpp)
add_test(test_webcore_${testName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_webcore_${testName})
set_tests_properties(test_webcore_${testName} PROPERTIES TIMEOUT 60)
target_link_libraries(test_webcore_${testName} ${test_webcore_LIBRARIES})
target_link_libraries(test_webcore_${testName} gtest WTF WebCore)
endforeach ()

add_library(TestWebKitAPIBase
${test_main_SOURCES}
${webkit2_api_harness_SOURCES}
${TESTWEBKITAPI_DIR}/JavaScriptTest.cpp
${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
${TESTWEBKITAPI_DIR}/TestsController.cpp
)

# Code used by almost all WebKit2 tests must be on this library to avoid recompilation.
add_library(TestWebKitAPIBase ${TestWebKitAPIBase_SOURCES})
add_dependencies(TestWebKitAPIBase WebKit2 ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})

set(test_webkit2_api_LIBRARIES
TestWebKitAPIBase
WTF
JavaScriptCore
WebKit2
gtest
)

foreach (testName ${test_webkit2_api_BINARIES})
get_filename_component(testBaseName ${testName} NAME)
add_executable(test_webkit2_api_${testBaseName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
add_test(test_webkit2_api_${testBaseName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_webkit2_api_${testBaseName})
set_tests_properties(test_webkit2_api_${testBaseName} PROPERTIES TIMEOUT 60)
target_link_libraries(test_webkit2_api_${testBaseName} ${test_webkit2_api_LIBRARIES})
# WebKit2 tests
foreach (testRawName ${webkit2TestList})
string(REPLACE "/" "_" testName ${testRawName})
add_executable(test_${testName} ${TESTWEBKITAPI_DIR}/Tests/${testRawName}.cpp)
add_test(test_${testName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_${testName})
set_tests_properties(test_${testName} PROPERTIES TIMEOUT 60)
target_link_libraries(test_${testName} TestWebKitAPIBase ${webkit2Test_LIBRARIES})
endforeach ()

# We don't run tests that are expected to fail. We could use the WILL_FAIL
# property, but it reports failure when the test crashes or timeouts and would
# make the bot red.

foreach (testName ${test_webkit2_api_fail_BINARIES})
add_executable(test_webkit2_api_fail_${testName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
target_link_libraries(test_webkit2_api_fail_${testName} ${test_webkit2_api_LIBRARIES})
foreach (testRawName ${webkit2FailTestList})
string(REPLACE "/" "_" testName ${testRawName})
add_executable(test_fail_${testName} ${TESTWEBKITAPI_DIR}/Tests/${testRawName}.cpp)
target_link_libraries(test_fail_${testName} TestWebKitAPIBase ${webkit2Test_LIBRARIES})
endforeach ()
112 changes: 55 additions & 57 deletions Tools/TestWebKitAPI/PlatformEfl.cmake
Expand Up @@ -29,12 +29,15 @@ set(test_main_SOURCES
${TESTWEBKITAPI_DIR}/efl/main.cpp
)

set(bundle_harness_SOURCES
list(APPEND TestWebKitAPIInjectedBundle_SOURCES
${TESTWEBKITAPI_DIR}/efl/InjectedBundleController.cpp
${TESTWEBKITAPI_DIR}/efl/PlatformUtilities.cpp

# In here we list the bundles that are used by our specific WK2 API Tests
${TESTWEBKITAPI_DIR}/Tests/WebKit2/efl/WKViewClientWebProcessCallbacks_Bundle.cpp
)

set(webkit2_api_harness_SOURCES
list(APPEND TestWebKitAPIBase_SOURCES
${TESTWEBKITAPI_DIR}/efl/PlatformUtilities.cpp
${TESTWEBKITAPI_DIR}/efl/PlatformWebView.cpp
)
Expand All @@ -52,71 +55,66 @@ set(test_webcore_BINARIES
KURL
)

# In here we list the bundles that are used by our specific WK2 API Tests
list(APPEND bundle_harness_SOURCES
${TESTWEBKITAPI_DIR}/Tests/WebKit2/efl/WKViewClientWebProcessCallbacks_Bundle.cpp
)

set(test_webkit2_api_BINARIES
AboutBlankLoad
CookieManager
DOMWindowExtensionNoCache
DocumentStartUserScriptAlertCrash
EvaluateJavaScript
FailedLoad
Find
ForceRepaint
FrameMIMETypeHTML
FrameMIMETypePNG
GetInjectedBundleInitializationUserDataCallback
HitTestResultNodeHandle
InjectedBundleBasic
InjectedBundleFrameHitTest
InjectedBundleInitializationUserDataCallbackWins
LoadAlternateHTMLStringWithNonDirectoryURL
LoadCanceledNoServerRedirectCallback
LoadPageOnCrash
MouseMoveAfterCrash
ReloadPageAfterCrash
ResizeWindowAfterCrash
NewFirstVisuallyNonEmptyLayout
NewFirstVisuallyNonEmptyLayoutFails
NewFirstVisuallyNonEmptyLayoutForImages
PageLoadBasic
PageLoadDidChangeLocationWithinPageForFrame
ParentFrame
PreventEmptyUserAgent
PrivateBrowsingPushStateNoHistoryCallback
UserMessage
WKConnection
WKPreferences
WKString
WKStringJSString
WKURL
WillSendSubmitEvent
efl/WKViewClientWebProcessCallbacks
set(webkit2TestList
WebKit2/AboutBlankLoad
WebKit2/CookieManager
WebKit2/DOMWindowExtensionNoCache
WebKit2/DocumentStartUserScriptAlertCrash
WebKit2/EvaluateJavaScript
WebKit2/FailedLoad
WebKit2/Find
WebKit2/ForceRepaint
WebKit2/FrameMIMETypeHTML
WebKit2/FrameMIMETypePNG
WebKit2/GetInjectedBundleInitializationUserDataCallback
WebKit2/HitTestResultNodeHandle
WebKit2/InjectedBundleBasic
WebKit2/InjectedBundleFrameHitTest
WebKit2/InjectedBundleInitializationUserDataCallbackWins
WebKit2/LoadAlternateHTMLStringWithNonDirectoryURL
WebKit2/LoadCanceledNoServerRedirectCallback
WebKit2/LoadPageOnCrash
WebKit2/MouseMoveAfterCrash
WebKit2/ReloadPageAfterCrash
WebKit2/ResizeWindowAfterCrash
WebKit2/NewFirstVisuallyNonEmptyLayout
WebKit2/NewFirstVisuallyNonEmptyLayoutFails
WebKit2/NewFirstVisuallyNonEmptyLayoutForImages
WebKit2/PageLoadBasic
WebKit2/PageLoadDidChangeLocationWithinPageForFrame
WebKit2/ParentFrame
WebKit2/PreventEmptyUserAgent
WebKit2/PrivateBrowsingPushStateNoHistoryCallback
WebKit2/UserMessage
WebKit2/WKConnection
WebKit2/WKPreferences
WebKit2/WKString
WebKit2/WKStringJSString
WebKit2/WKURL
WebKit2/WillSendSubmitEvent
WebKit2/efl/WKViewClientWebProcessCallbacks
)

# Seccomp filters is an internal API and its symbols
# are not (and should not) be exposed by default. We
# can only test it when building shared core.
if (ENABLE_SECCOMP_FILTERS AND SHARED_CORE)
list(APPEND test_webkit2_api_BINARIES
SeccompFilters
list(APPEND webkit2TestList
WebKit2/SeccompFilters
)
endif ()

set(test_webkit2_api_fail_BINARIES
CanHandleRequest
DOMWindowExtensionBasic
DownloadDecideDestinationCrash
NewFirstVisuallyNonEmptyLayoutFrames
RestoreSessionStateContainingFormData
ShouldGoToBackForwardListItem
WKPageGetScaleFactorNotZero
set(webkit2FailTestList
WebKit2/CanHandleRequest
WebKit2/DOMWindowExtensionBasic
WebKit2/DownloadDecideDestinationCrash
WebKit2/NewFirstVisuallyNonEmptyLayoutFrames
WebKit2/RestoreSessionStateContainingFormData
WebKit2/ShouldGoToBackForwardListItem
WebKit2/WKPageGetScaleFactorNotZero
)

# Tests disabled because of missing features on the test harness:
#
# ResponsivenessTimerDoesntFireEarly
# SpacebarScrolling
# WebKit2/ResponsivenessTimerDoesntFireEarly
# WebKit2/SpacebarScrolling

0 comments on commit f6b80e1

Please sign in to comment.