Warning, /frameworks/kio/autotests/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 remove_definitions(-DQT_NO_CAST_FROM_ASCII)
0002 remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
0003 
0004 include(ECMAddTests)
0005 
0006 if(NOT ANDROID)
0007     add_subdirectory(http)
0008 endif()
0009 add_subdirectory(kcookiejar)
0010 
0011 find_package(Qt${QT_MAJOR_VERSION}Widgets REQUIRED)
0012 
0013 ########### unittests ###############
0014 
0015 find_package(Qt${QT_MAJOR_VERSION}Concurrent ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
0016 
0017 if(NOT EXCLUDE_DEPRECATED_BEFORE_AND_AT STREQUAL "CURRENT" AND
0018    EXCLUDE_DEPRECATED_BEFORE_AND_AT VERSION_LESS 5.65.0)
0019     set(ktcpsockettest_SRC ktcpsockettest.cpp)
0020 endif()
0021 
0022 if (ACL_FOUND)
0023     set (kacltest_SRC kacltest.cpp)
0024 endif()
0025 
0026 ecm_add_tests(
0027  ${kacltest_SRC}
0028  listdirtest.cpp
0029  kmountpointtest.cpp
0030  upurltest.cpp
0031  dataprotocoltest.cpp
0032  jobtest.cpp
0033  jobremotetest.cpp
0034  kfileitemtest.cpp
0035  kprotocolinfotest.cpp
0036  ${ktcpsockettest_SRC}
0037  globaltest.cpp
0038  mimetypefinderjobtest.cpp
0039  mkpathjobtest.cpp
0040  threadtest.cpp
0041  udsentrytest.cpp
0042  deletejobtest.cpp
0043  deleteortrashjobtest.cpp
0044  urlutiltest.cpp
0045  batchrenamejobtest.cpp
0046  ksambasharetest.cpp
0047  krecentdocumenttest.cpp
0048  filefiltertest.cpp
0049  NAME_PREFIX "kiocore-"
0050  LINK_LIBRARIES KF5::KIOCore KF5::I18n KF5::ConfigCore Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Network Qt${QT_MAJOR_VERSION}::Xml
0051 )
0052 
0053 target_link_libraries(threadtest Qt${QT_MAJOR_VERSION}::Concurrent)
0054 
0055 target_link_libraries(deleteortrashjobtest KF5::KIOWidgets)
0056 
0057 if(TARGET Qt6::Core5Compat)
0058     target_link_libraries(dataprotocoltest Qt6::Core5Compat)
0059 endif()
0060 
0061 ecm_add_test(
0062     http_jobtest.cpp
0063     httpserver_p.cpp
0064     TEST_NAME http_jobtest
0065     NAME_PREFIX "kiocore-"
0066     LINK_LIBRARIES KF5::KIOCore KF5::I18n Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Network
0067 )
0068 
0069 # as per sysadmin request these are limited to linux only! https://invent.kde.org/frameworks/kio/-/merge_requests/1008
0070 if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND USE_FTPD_WSGIDAV_UNITTEST)
0071     include(FindGem)
0072     find_gem(ftpd)
0073     set_package_properties(Gem_ftpd PROPERTIES TYPE REQUIRED
0074         DESCRIPTION "Ruby ftpd gem. Either install it from your distribution's repos or by running `gem install --user-install ftpd`, which will install it under your user's home dir."
0075         PURPOSE "Ruby gem 'ftpd' required for testing the ftp worker."
0076         URL "https://rubygems.org/gems/ftpd")
0077     add_definitions(-DRubyExe_EXECUTABLE="${RubyExe_EXECUTABLE}")
0078     ecm_add_tests(
0079         ftptest.cpp
0080         NAME_PREFIX "kiocore-"
0081         LINK_LIBRARIES KF5::KIOCore KF5::I18n Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Network
0082     )
0083 
0084     find_package(WsgidavExe)
0085     set_package_properties(WsgidavExe PROPERTIES TYPE REQUIRED
0086         DESCRIPTION "Python webdav server. Can be easily installed by running `pip3 install wsgidav`, which will install it under your user's home dir."
0087         PURPOSE "wsgidav required for running the webdavtest."
0088         URL "https://pypi.org/project/WsgiDAV/")
0089     ecm_add_tests(
0090         webdavtest.cpp
0091         NAME_PREFIX "kiocore-"
0092         LINK_LIBRARIES KF5::KIOCore Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Network
0093     )
0094 endif()
0095 
0096 if(UNIX)
0097   ecm_add_tests(
0098     privilegejobtest.cpp
0099     NAME_PREFIX "kiocore-"
0100     LINK_LIBRARIES KF5::KIOCore KF5::I18n Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Network
0101   )
0102 endif()
0103 
0104 if (TARGET KF5::KIOGui)
0105   ecm_add_tests(
0106     favicontest.cpp
0107     openurljobtest.cpp
0108     kemailclientlauncherjobtest.cpp
0109     NAME_PREFIX "kiogui-"
0110     LINK_LIBRARIES KF5::KIOCore KF5::KIOGui KF5::WindowSystem Qt${QT_MAJOR_VERSION}::Test
0111   )
0112 
0113   foreach(_kprocessrunnerTest applicationlauncherjob commandlauncherjob kterminallauncherjob)
0114     foreach(_systemd "" "SCOPE" "SERVICE")
0115       set(_scope 0)
0116       set(_service 0)
0117       if(_systemd STREQUAL "SERVICE")
0118         set(KPR_TEST_TARGET ${_kprocessrunnerTest}_servicetest)
0119         set(_service 1)
0120       elseif(_systemd STREQUAL "SCOPE")
0121         set(KPR_TEST_TARGET ${_kprocessrunnerTest}_scopetest)
0122         set(_scope 1)
0123       else()
0124         set(KPR_TEST_TARGET ${_kprocessrunnerTest}_forkingtest)
0125       endif()
0126       add_executable(${KPR_TEST_TARGET} ${_kprocessrunnerTest}test.cpp)
0127       target_link_libraries(${KPR_TEST_TARGET} KF5::WindowSystem KF5::KIOCore KF5::KIOGui Qt${QT_MAJOR_VERSION}::Test)
0128       ecm_mark_as_test(${KPR_TEST_TARGET})
0129       add_test(NAME ${KPR_TEST_TARGET} COMMAND ${KPR_TEST_TARGET})
0130       set_tests_properties(${KPR_TEST_TARGET} PROPERTIES ENVIRONMENT
0131         "KDE_APPLICATIONS_AS_SERVICE=${_service};KDE_APPLICATIONS_AS_SCOPE=${_scope}")
0132     endforeach()
0133   endforeach()
0134 
0135   target_link_libraries(favicontest Qt${QT_MAJOR_VERSION}::Concurrent)
0136 endif()
0137 
0138 if (NOT ANDROID)
0139 if (TARGET KF5::KIOWidgets)
0140 if(NOT EXCLUDE_DEPRECATED_BEFORE_AND_AT STREQUAL "CURRENT" AND
0141    EXCLUDE_DEPRECATED_BEFORE_AND_AT VERSION_LESS 5.4.0)
0142     set(jobguitest_SRC jobguitest.cpp)
0143 endif()
0144 
0145 if(NOT EXCLUDE_DEPRECATED_BEFORE_AND_AT STREQUAL "CURRENT" AND
0146    EXCLUDE_DEPRECATED_BEFORE_AND_AT VERSION_LESS 5.107.0)
0147     set(accessmanagertest_SRC accessmanagertest.cpp)
0148 endif()
0149 
0150 ecm_add_tests(
0151  clipboardupdatertest.cpp
0152  dropjobtest.cpp
0153  kdynamicjobtrackernowidgetstest.cpp
0154  krununittest.cpp
0155  desktopexecparsertest.cpp
0156  kdirlistertest.cpp
0157  kdirmodeltest.cpp
0158  kfileitemactionstest.cpp
0159  fileundomanagertest.cpp
0160  kurlcompletiontest.cpp
0161  ${jobguitest_SRC}
0162  pastetest.cpp
0163  ${accessmanagertest_SRC}
0164  kurifiltersearchprovideractionstest.cpp
0165  NAME_PREFIX "kiowidgets-"
0166  LINK_LIBRARIES KF5::KIOCore KF5::KIOWidgets Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::DBus
0167 )
0168 set_target_properties(krununittest PROPERTIES COMPILE_FLAGS "-DKDE_INSTALL_FULL_LIBEXECDIR_KF=\"\\\"${KDKE_INSTALL_FULL_LIBEXECDIR_KF}\\\"\"")
0169 
0170 set(_libexec_dir_kf "${KDKE_INSTALL_FULL_LIBEXECDIR_KF}")
0171 target_compile_definitions(desktopexecparsertest PRIVATE "KDE_INSTALL_FULL_LIBEXECDIR_KF=${_libexec_dir_kf}")
0172 
0173 set(kurifiltertest_libs KF5::KIOCore KF5::KIOWidgets Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::DBus)
0174 
0175 set(URIFILTER_COLON_TEST kiowidgets-kurifiltertest-colon-separator)
0176 ecm_add_test(kurifiltertest.cpp
0177     LINK_LIBRARIES ${kurifiltertest_libs}
0178     TEST_NAME ${URIFILTER_COLON_TEST}
0179 )
0180 target_compile_definitions(${URIFILTER_COLON_TEST} PUBLIC "-DWEBSHORTCUT_SEPARATOR=':'")
0181 
0182 set(URIFILTER_SPACE_TEST kiowidgets-kurifiltertest-space-separator)
0183 ecm_add_test(kurifiltertest.cpp
0184     LINK_LIBRARIES ${kurifiltertest_libs}
0185     TEST_NAME ${URIFILTER_SPACE_TEST}
0186 )
0187 target_compile_definitions(${URIFILTER_SPACE_TEST} PUBLIC "-DWEBSHORTCUT_SEPARATOR=' '")
0188 
0189 if(NOT EXCLUDE_DEPRECATED_BEFORE_AND_AT STREQUAL "CURRENT" AND
0190    EXCLUDE_DEPRECATED_BEFORE_AND_AT VERSION_LESS 5.107.0)
0191 # Same as accessmanagertest, but using QNetworkAccessManager, to make sure we
0192 # behave the same
0193 ecm_add_test(
0194  accessmanagertest.cpp
0195  TEST_NAME accessmanagertest-qnam
0196  NAME_PREFIX "kiowidgets-"
0197  LINK_LIBRARIES KF5::KIOCore KF5::KIOWidgets Qt${QT_MAJOR_VERSION}::Test
0198 )
0199 set_target_properties(accessmanagertest-qnam PROPERTIES COMPILE_FLAGS "-DUSE_QNAM")
0200 endif()
0201 
0202 # Same as kurlcompletiontest, but with immediate return, and results posted by thread later
0203 ecm_add_test(
0204  kurlcompletiontest.cpp
0205  TEST_NAME kurlcompletiontest-nowait
0206  NAME_PREFIX "kiowidgets-"
0207  LINK_LIBRARIES KF5::KIOCore KF5::KIOWidgets Qt${QT_MAJOR_VERSION}::Test
0208  )
0209 set_target_properties(kurlcompletiontest-nowait PROPERTIES COMPILE_FLAGS "-DNO_WAIT")
0210 
0211 
0212 endif()
0213 
0214 if (TARGET KF5::KIOFileWidgets)
0215 find_package(KF5XmlGui ${KF_DEP_VERSION} REQUIRED)
0216 include_directories(${CMAKE_SOURCE_DIR}/src/filewidgets ${CMAKE_BINARY_DIR}/src/filewidgets)
0217 ecm_add_tests(
0218  kurlnavigatortest.cpp
0219  kurlcomboboxtest.cpp
0220  kdiroperatortest.cpp
0221  kfilewidgettest.cpp
0222  kfilecustomdialogtest.cpp
0223  knewfilemenutest.cpp
0224  kfilecopytomenutest.cpp
0225  kfileplacesmodeltest.cpp
0226  kfileplacesviewtest.cpp
0227  kurlrequestertest.cpp
0228  kfilefiltercombotest.cpp
0229  NAME_PREFIX "kiofilewidgets-"
0230  LINK_LIBRARIES KF5::KIOFileWidgets KF5::KIOWidgets KF5::XmlGui KF5::Bookmarks Qt${QT_MAJOR_VERSION}::Test KF5::I18n
0231 )
0232 
0233 # TODO: fix symbol exports for windows -> 'KSambaShare::KSambaShare': inconsistent dll linkage
0234 if (NOT WIN32)
0235 ecm_add_test(
0236     ksambashareprivatetest.cpp
0237     ../src/core/ksambashare.cpp
0238     ../src/core/kiocoredebug.cpp
0239     TEST_NAME ksambashareprivatetest
0240     NAME_PREFIX "kiocore-"
0241     LINK_LIBRARIES KF5::KIOCore Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Network
0242 )
0243 endif()
0244 
0245 set_tests_properties(kiofilewidgets-kfileplacesmodeltest PROPERTIES RUN_SERIAL TRUE)
0246 set_tests_properties(kiofilewidgets-kfileplacesviewtest PROPERTIES RUN_SERIAL TRUE)
0247 set_tests_properties(kiowidgets-kurifiltertest-space-separator PROPERTIES RUN_SERIAL TRUE)
0248 endif()
0249 endif()
0250 
0251 # this should be done by cmake, see bug 371721
0252 if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND Qt${QT_MAJOR_VERSION}Core_VERSION VERSION_GREATER 5.8.0)
0253     set_property(TARGET jobtest APPEND PROPERTY AUTOMOC_MOC_OPTIONS --include ${CMAKE_BINARY_DIR}/src/core/moc_predefs.h)
0254 endif()
0255 
0256 # Benchmark, compiled, but not run automatically with ctest
0257 add_executable(kcoredirlister_benchmark kcoredirlister_benchmark.cpp)
0258 target_link_libraries(kcoredirlister_benchmark KF5::KIOCore KF5::KIOWidgets Qt${QT_MAJOR_VERSION}::Test)
0259 
0260 add_executable(udsentry_api_comparison_benchmark udsentry_api_comparison_benchmark.cpp)
0261 target_link_libraries(udsentry_api_comparison_benchmark KF5::KIOCore KF5::KIOWidgets Qt${QT_MAJOR_VERSION}::Test)
0262 
0263 add_executable(udsentry_benchmark udsentry_benchmark.cpp)
0264 target_link_libraries(udsentry_benchmark KF5::KIOCore KF5::KIOWidgets Qt${QT_MAJOR_VERSION}::Test)