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 ecm_add_tests( 0146 clipboardupdatertest.cpp 0147 dropjobtest.cpp 0148 kdynamicjobtrackernowidgetstest.cpp 0149 krununittest.cpp 0150 desktopexecparsertest.cpp 0151 kdirlistertest.cpp 0152 kdirmodeltest.cpp 0153 kfileitemactionstest.cpp 0154 fileundomanagertest.cpp 0155 kurlcompletiontest.cpp 0156 ${jobguitest_SRC} 0157 pastetest.cpp 0158 accessmanagertest.cpp 0159 kurifiltersearchprovideractionstest.cpp 0160 NAME_PREFIX "kiowidgets-" 0161 LINK_LIBRARIES KF5::KIOCore KF5::KIOWidgets Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::DBus 0162 ) 0163 set_target_properties(krununittest PROPERTIES COMPILE_FLAGS "-DKDE_INSTALL_FULL_LIBEXECDIR_KF=\"\\\"${KDKE_INSTALL_FULL_LIBEXECDIR_KF}\\\"\"") 0164 0165 set(_libexec_dir_kf "${KDKE_INSTALL_FULL_LIBEXECDIR_KF}") 0166 target_compile_definitions(desktopexecparsertest PRIVATE "KDE_INSTALL_FULL_LIBEXECDIR_KF=${_libexec_dir_kf}") 0167 0168 set(kurifiltertest_libs KF5::KIOCore KF5::KIOWidgets Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::DBus) 0169 0170 set(URIFILTER_COLON_TEST kiowidgets-kurifiltertest-colon-separator) 0171 ecm_add_test(kurifiltertest.cpp 0172 LINK_LIBRARIES ${kurifiltertest_libs} 0173 TEST_NAME ${URIFILTER_COLON_TEST} 0174 ) 0175 target_compile_definitions(${URIFILTER_COLON_TEST} PUBLIC "-DWEBSHORTCUT_SEPARATOR=':'") 0176 0177 set(URIFILTER_SPACE_TEST kiowidgets-kurifiltertest-space-separator) 0178 ecm_add_test(kurifiltertest.cpp 0179 LINK_LIBRARIES ${kurifiltertest_libs} 0180 TEST_NAME ${URIFILTER_SPACE_TEST} 0181 ) 0182 target_compile_definitions(${URIFILTER_SPACE_TEST} PUBLIC "-DWEBSHORTCUT_SEPARATOR=' '") 0183 0184 # Same as accessmanagertest, but using QNetworkAccessManager, to make sure we 0185 # behave the same 0186 ecm_add_test( 0187 accessmanagertest.cpp 0188 TEST_NAME accessmanagertest-qnam 0189 NAME_PREFIX "kiowidgets-" 0190 LINK_LIBRARIES KF5::KIOCore KF5::KIOWidgets Qt${QT_MAJOR_VERSION}::Test 0191 ) 0192 set_target_properties(accessmanagertest-qnam PROPERTIES COMPILE_FLAGS "-DUSE_QNAM") 0193 0194 # Same as kurlcompletiontest, but with immediate return, and results posted by thread later 0195 ecm_add_test( 0196 kurlcompletiontest.cpp 0197 TEST_NAME kurlcompletiontest-nowait 0198 NAME_PREFIX "kiowidgets-" 0199 LINK_LIBRARIES KF5::KIOCore KF5::KIOWidgets Qt${QT_MAJOR_VERSION}::Test 0200 ) 0201 set_target_properties(kurlcompletiontest-nowait PROPERTIES COMPILE_FLAGS "-DNO_WAIT") 0202 0203 0204 endif() 0205 0206 if (TARGET KF5::KIOFileWidgets) 0207 find_package(KF5XmlGui ${KF_DEP_VERSION} REQUIRED) 0208 include_directories(${CMAKE_SOURCE_DIR}/src/filewidgets ${CMAKE_BINARY_DIR}/src/filewidgets) 0209 ecm_add_tests( 0210 kurlnavigatortest.cpp 0211 kurlcomboboxtest.cpp 0212 kdiroperatortest.cpp 0213 kfilewidgettest.cpp 0214 kfilecustomdialogtest.cpp 0215 knewfilemenutest.cpp 0216 kfilecopytomenutest.cpp 0217 kfileplacesmodeltest.cpp 0218 kfileplacesviewtest.cpp 0219 kurlrequestertest.cpp 0220 kfilefiltercombotest.cpp 0221 NAME_PREFIX "kiofilewidgets-" 0222 LINK_LIBRARIES KF5::KIOFileWidgets KF5::KIOWidgets KF5::XmlGui KF5::Bookmarks Qt${QT_MAJOR_VERSION}::Test KF5::I18n 0223 ) 0224 0225 # TODO: fix symbol exports for windows -> 'KSambaShare::KSambaShare': inconsistent dll linkage 0226 if (NOT WIN32) 0227 ecm_add_test( 0228 ksambashareprivatetest.cpp 0229 ../src/core/ksambashare.cpp 0230 ../src/core/kiocoredebug.cpp 0231 TEST_NAME ksambashareprivatetest 0232 NAME_PREFIX "kiocore-" 0233 LINK_LIBRARIES KF5::KIOCore Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Network 0234 ) 0235 endif() 0236 0237 set_tests_properties(kiofilewidgets-kfileplacesmodeltest PROPERTIES RUN_SERIAL TRUE) 0238 set_tests_properties(kiofilewidgets-kfileplacesviewtest PROPERTIES RUN_SERIAL TRUE) 0239 set_tests_properties(kiowidgets-kurifiltertest-space-separator PROPERTIES RUN_SERIAL TRUE) 0240 endif() 0241 endif() 0242 0243 # this should be done by cmake, see bug 371721 0244 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) 0245 set_property(TARGET jobtest APPEND PROPERTY AUTOMOC_MOC_OPTIONS --include ${CMAKE_BINARY_DIR}/src/core/moc_predefs.h) 0246 endif() 0247 0248 # Benchmark, compiled, but not run automatically with ctest 0249 add_executable(kcoredirlister_benchmark kcoredirlister_benchmark.cpp) 0250 target_link_libraries(kcoredirlister_benchmark KF5::KIOCore KF5::KIOWidgets Qt${QT_MAJOR_VERSION}::Test) 0251 0252 add_executable(udsentry_api_comparison_benchmark udsentry_api_comparison_benchmark.cpp) 0253 target_link_libraries(udsentry_api_comparison_benchmark KF5::KIOCore KF5::KIOWidgets Qt${QT_MAJOR_VERSION}::Test) 0254 0255 add_executable(udsentry_benchmark udsentry_benchmark.cpp) 0256 target_link_libraries(udsentry_benchmark KF5::KIOCore KF5::KIOWidgets Qt${QT_MAJOR_VERSION}::Test)