Changeset View
Changeset View
Standalone View
Standalone View
test/CMakeLists.txt
1 | # Tests for KPMcore | 1 | # Tests for KPMcore | ||
---|---|---|---|---|---|
2 | # | 2 | # | ||
3 | # These are not so much "tests" as "small example programs". They illustrate | 3 | # These are not so much "tests" as "small example programs". They illustrate | ||
4 | # how to use the library, how to perform common tasks. | 4 | # how to use the library, how to perform common tasks. | ||
5 | 5 | | |||
6 | set(CMAKE_SKIP_BUILD_RPATH FALSE) | 6 | set(CMAKE_SKIP_BUILD_RPATH FALSE) | ||
7 | SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) | 7 | set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) | ||
8 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | 8 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | ||
9 | 9 | | |||
10 | include_directories(${CMAKE_SOURCE_DIR}/src) # To get at KPMcore headers | 10 | include_directories(${CMAKE_SOURCE_DIR}/src) # To get at KPMcore headers | ||
11 | add_compile_options(-fPIC) | 11 | add_compile_options(-fPIC) | ||
12 | 12 | | |||
13 | ### | 13 | ### | ||
14 | # | 14 | # | ||
15 | # Helper macro to link to the helper (for initialization of kpmcore) | 15 | # Helper macro to link to the helper (for initialization of kpmcore) | ||
16 | # and to add a test with the given name. | 16 | # and to add a test with the given name. | ||
17 | # | 17 | # | ||
18 | add_library(testhelpers STATIC helpers.cpp) | 18 | add_library(testhelpers STATIC helpers.cpp) | ||
19 | target_link_libraries(testhelpers) | 19 | target_link_libraries(testhelpers) | ||
20 | 20 | | |||
21 | macro (kpm_test name) | 21 | macro (kpm_test name) | ||
22 | add_executable(${name} ${ARGN}) | 22 | add_executable(${name} ${ARGN}) | ||
23 | target_link_libraries(${name} testhelpers kpmcore Qt5::Core) | 23 | target_link_libraries(${name} testhelpers kpmcore Qt5::Core Qt5::DBus Qt5::Test ${POLKITQT-1_LIBRARIES}) | ||
24 | endmacro() | 24 | endmacro() | ||
25 | 25 | | |||
26 | if(NOT Qt5Test_FOUND) | ||||
27 | message(STATUS "Qt5Test not found, testpolkitauthbackend will not be built.") | ||||
28 | return() | ||||
29 | endif() | ||||
30 | | ||||
26 | ### | 31 | ### | ||
27 | # | 32 | # | ||
28 | # Tests of initialization: try explicitly loading some backends | 33 | # Tests of initialization: try explicitly loading some backends | ||
29 | kpm_test(testinit testinit.cpp) # Default backend | 34 | kpm_test(testinit testinit.cpp) # Default backend | ||
30 | if(TARGET pmdummybackendplugin) | 35 | if(TARGET pmdummybackendplugin) | ||
31 | add_test(NAME testinit-dummy COMMAND testinit $<TARGET_FILE:pmdummybackendplugin>) | 36 | add_test(NAME testinit-dummy COMMAND testinit $<TARGET_FILE:pmdummybackendplugin>) | ||
32 | endif() | 37 | endif() | ||
33 | if(TARGET pmsfdiskbackendplugin) | 38 | if(TARGET pmsfdiskbackendplugin) | ||
Show All 27 Lines | |||||
61 | 66 | | |||
62 | # Test SMART support | 67 | # Test SMART support | ||
63 | kpm_test(testsmart testsmart.cpp ${SMARTPARSER}) | 68 | kpm_test(testsmart testsmart.cpp ${SMARTPARSER}) | ||
64 | add_test(NAME testsmart COMMAND testsmart ${BACKEND}) | 69 | add_test(NAME testsmart COMMAND testsmart ${BACKEND}) | ||
65 | 70 | | |||
66 | # Test Device | 71 | # Test Device | ||
67 | kpm_test(testdevice testdevice.cpp) | 72 | kpm_test(testdevice testdevice.cpp) | ||
68 | add_test(NAME testdevice COMMAND testdevice ${BACKEND}) | 73 | add_test(NAME testdevice COMMAND testdevice ${BACKEND}) | ||
74 | | ||||
75 | | ||||
76 | # Include Polkit-Qt1 backend files reference | ||||
77 | set(POLKITBACKEND ${CMAKE_SOURCE_DIR}/src/util/externalcommand_polkitbackend.cpp) | ||||
78 | | ||||
79 | # Test PolkitQt-1 Authorization Backend | ||||
80 | kpm_test(testpolkitauthbackend testpolkitauthbackend.cpp ${POLKITBACKEND}) | ||||
81 | add_test(NAME testpolkitauthbackend COMMAND testpolkitauthbackend ${BACKEND}) |