Warning, /system/kpmcore/test/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2017 Adriaan de Groot <groot@kde.org> 0002 # SPDX-FileCopyrightText: 2017-2019 Andrius Štikonas <andrius@stikonas.eu> 0003 # SPDX-FileCopyrightText: 2018 Caio Carvalho <caiojcarvalho@gmail.com> 0004 # SPDX-FileCopyrightText: 2019 Yuri Chornoivan <yurchor@ukr.net> 0005 0006 # SPDX-License-Identifier: GPL-3.0-or-later 0007 0008 # Tests for KPMcore 0009 # 0010 # These are not so much "tests" as "small example programs". They illustrate 0011 # how to use the library, how to perform common tasks. 0012 0013 set(CMAKE_SKIP_BUILD_RPATH FALSE) 0014 SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 0015 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) 0016 0017 add_compile_options(-fPIC) 0018 0019 ### 0020 # 0021 # Helper macro to link to the helper (for initialization of kpmcore) 0022 # and to add a test with the given name. 0023 # 0024 add_library(testhelpers STATIC helpers.cpp) 0025 target_link_libraries(testhelpers PRIVATE kpmcore) 0026 0027 macro (kpm_test name) 0028 add_executable(${name} ${ARGN}) 0029 target_link_libraries(${name} testhelpers kpmcore Qt6::Core) 0030 endmacro() 0031 0032 ### 0033 # 0034 # Tests of initialization: try explicitly loading some backends 0035 kpm_test(testinit testinit.cpp) # Default backend 0036 if(TARGET pmdummybackendplugin) 0037 add_test(NAME testinit-dummy COMMAND testinit $<TARGET_FILE_NAME:pmdummybackendplugin>) 0038 endif() 0039 if(TARGET pmsfdiskbackendplugin) 0040 add_test(NAME testinit-sfdisk COMMAND testinit $<TARGET_FILE_NAME:pmsfdiskbackendplugin>) 0041 else() 0042 return() # All the rest really needs a working backend 0043 endif() 0044 0045 set(BACKEND $<TARGET_FILE_NAME:pmsfdiskbackendplugin>) 0046 0047 ### 0048 # 0049 # Listing devices, partitions 0050 kpm_test(testlist testlist.cpp) 0051 add_test(NAME testlist COMMAND testlist ${BACKEND}) 0052 0053 kpm_test(testdevicescanner testdevicescanner.cpp) 0054 add_test(NAME testdevicescanner COMMAND testdevicescanner ${BACKEND}) 0055 0056 find_package (Threads) 0057 ### 0058 # 0059 # Execute external commands as root 0060 kpm_test(testexternalcommand testexternalcommand.cpp) 0061 add_test(NAME testexternalcommand COMMAND testexternalcommand ${BACKEND}) 0062 0063 0064 # Test Device 0065 kpm_test(testdevice testdevice.cpp) 0066 add_test(NAME testdevice COMMAND testdevice ${BACKEND}) 0067 0068 find_package(Qt6Test REQUIRED) 0069 0070 kpm_test(test_fstab test_fstab.cpp) 0071 add_test(NAME test_fstab COMMAND test_fstab) 0072 target_link_libraries(test_fstab Qt6::Test)