CMake: Allow extra libraries in calamares_add_test
- Extra libraries specified via LIBRARIES part of CMake function - Convert all the other module tests
This commit is contained in:
parent
637a57d534
commit
4495a4c739
@ -34,7 +34,7 @@ function( calamares_add_test )
|
||||
# parse arguments (name needs to be saved before passing ARGN into the macro)
|
||||
set( NAME ${ARGV0} )
|
||||
set( options GUI )
|
||||
set( multiValueArgs SOURCES )
|
||||
set( multiValueArgs SOURCES LIBRARIES )
|
||||
cmake_parse_arguments( TEST "${options}" "" "${multiValueArgs}" ${ARGN} )
|
||||
set( TEST_NAME ${NAME} )
|
||||
|
||||
@ -45,13 +45,14 @@ function( calamares_add_test )
|
||||
${TEST_NAME}
|
||||
LINK_LIBRARIES
|
||||
calamares
|
||||
${TEST_LIBRARIES}
|
||||
Qt5::Core
|
||||
Qt5::Test
|
||||
)
|
||||
calamares_automoc( ${TEST_NAME} )
|
||||
target_compile_definitions( ${TEST_NAME} PRIVATE -DBUILD_AS_TEST )
|
||||
if( TEST_GUI )
|
||||
target_link_libraries( ${TEST_NAME} PRIVATE calamaresui Qt5::Gui )
|
||||
target_link_libraries( ${TEST_NAME} calamaresui Qt5::Gui )
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
@ -8,18 +8,12 @@ calamares_add_plugin( contextualprocess
|
||||
SHARED_LIB
|
||||
)
|
||||
|
||||
if( ECM_FOUND AND BUILD_TESTING )
|
||||
ecm_add_test(
|
||||
Tests.cpp
|
||||
ContextualProcessJob.cpp # Builds it a second time
|
||||
TEST_NAME
|
||||
contextualprocesstest
|
||||
LINK_LIBRARIES
|
||||
${CALAMARES_LIBRARIES}
|
||||
calamaresui
|
||||
${YAMLCPP_LIBRARY}
|
||||
Qt5::Core
|
||||
Qt5::Test
|
||||
)
|
||||
calamares_automoc( contextualprocesstest )
|
||||
endif()
|
||||
calamares_add_test(
|
||||
contextualprocesstest
|
||||
GUI # It's not
|
||||
SOURCES
|
||||
Tests.cpp
|
||||
ContextualProcessJob.cpp # Builds it a second time
|
||||
LIBRARIES
|
||||
${YAMLCPP_LIBRARY}
|
||||
)
|
||||
|
@ -30,21 +30,15 @@ if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND
|
||||
SHARED_LIB
|
||||
)
|
||||
|
||||
if( ECM_FOUND AND BUILD_TESTING )
|
||||
ecm_add_test(
|
||||
Tests.cpp
|
||||
TEST_NAME
|
||||
fsresizertest
|
||||
LINK_LIBRARIES
|
||||
${CALAMARES_LIBRARIES}
|
||||
calamares
|
||||
calamares_job_fsresizer # From above
|
||||
${YAMLCPP_LIBRARY}
|
||||
Qt5::Core
|
||||
Qt5::Test
|
||||
)
|
||||
set_target_properties( fsresizertest PROPERTIES AUTOMOC TRUE )
|
||||
target_include_directories( fsresizertest PRIVATE /usr/local/include )
|
||||
calamares_add_test(
|
||||
fsresizertest
|
||||
SOURCES
|
||||
Tests.cpp
|
||||
LIBRARIES
|
||||
calamares_job_fsresizer # From above
|
||||
${YAMLCPP_LIBRARY}
|
||||
)
|
||||
if( TARGET fsresizertest )
|
||||
target_compile_definitions( fsresizertest PRIVATE ${_partition_defs} )
|
||||
endif()
|
||||
else()
|
||||
|
@ -32,18 +32,12 @@ if ( KF5CoreAddons_FOUND AND KF5CoreAddons_VERSION VERSION_GREATER_EQUAL 5.58 )
|
||||
target_compile_definitions( calamares_job_hostinfo PRIVATE WITH_KOSRelease )
|
||||
endif()
|
||||
|
||||
if( ECM_FOUND AND BUILD_TESTING )
|
||||
ecm_add_test(
|
||||
Tests.cpp
|
||||
HostInfoJob.cpp # Builds it a second time
|
||||
TEST_NAME
|
||||
hostinfotest
|
||||
LINK_LIBRARIES
|
||||
${CALAMARES_LIBRARIES}
|
||||
calamaresui
|
||||
${YAMLCPP_LIBRARY}
|
||||
Qt5::Core
|
||||
Qt5::Test
|
||||
)
|
||||
calamares_automoc( hostinfotest )
|
||||
endif()
|
||||
calamares_add_test(
|
||||
hostinfotest
|
||||
GUI # It's not
|
||||
SOURCES
|
||||
Tests.cpp
|
||||
HostInfoJob.cpp
|
||||
LIBRARIES
|
||||
${YAMLCPP_LIBRARY}
|
||||
)
|
||||
|
@ -8,18 +8,12 @@ calamares_add_plugin( initcpio
|
||||
SHARED_LIB
|
||||
)
|
||||
|
||||
if( ECM_FOUND AND BUILD_TESTING )
|
||||
ecm_add_test(
|
||||
Tests.cpp
|
||||
TEST_NAME
|
||||
initcpiotest
|
||||
LINK_LIBRARIES
|
||||
${CALAMARES_LIBRARIES}
|
||||
calamares
|
||||
calamares_job_initcpio # From above
|
||||
${YAMLCPP_LIBRARY}
|
||||
Qt5::Core
|
||||
Qt5::Test
|
||||
)
|
||||
calamares_automoc( initcpiotest )
|
||||
endif()
|
||||
calamares_add_test(
|
||||
initcpiotest
|
||||
GUI # It's not
|
||||
SOURCES
|
||||
Tests.cpp
|
||||
LIBRARIES
|
||||
calamares_job_initcpio # From above
|
||||
${YAMLCPP_LIBRARY}
|
||||
)
|
||||
|
@ -8,18 +8,12 @@ calamares_add_plugin( initramfs
|
||||
SHARED_LIB
|
||||
)
|
||||
|
||||
if( ECM_FOUND AND BUILD_TESTING )
|
||||
ecm_add_test(
|
||||
Tests.cpp
|
||||
TEST_NAME
|
||||
initramfstest
|
||||
LINK_LIBRARIES
|
||||
${CALAMARES_LIBRARIES}
|
||||
calamares
|
||||
calamares_job_initramfs # From above
|
||||
${YAMLCPP_LIBRARY}
|
||||
Qt5::Core
|
||||
Qt5::Test
|
||||
)
|
||||
calamares_automoc( initramfstest )
|
||||
endif()
|
||||
calamares_add_test(
|
||||
initramfstest
|
||||
GUI # It's not
|
||||
SOURCES
|
||||
Tests.cpp
|
||||
LIBRARIES
|
||||
calamares_job_initramfs # From above
|
||||
${YAMLCPP_LIBRARY}
|
||||
)
|
||||
|
@ -31,15 +31,9 @@ calamares_add_plugin( locale
|
||||
SHARED_LIB
|
||||
)
|
||||
|
||||
if( ECM_FOUND AND BUILD_TESTING )
|
||||
ecm_add_test(
|
||||
Tests.cpp
|
||||
LocaleConfiguration.cpp
|
||||
TEST_NAME
|
||||
localetest
|
||||
LINK_LIBRARIES
|
||||
calamares
|
||||
Qt5::Test
|
||||
)
|
||||
calamares_automoc( localetest )
|
||||
endif()
|
||||
calamares_add_test(
|
||||
localetest
|
||||
SOURCES
|
||||
Tests.cpp
|
||||
LocaleConfiguration.cpp
|
||||
)
|
||||
|
@ -53,18 +53,12 @@ calamares_add_plugin( packagechooser
|
||||
SHARED_LIB
|
||||
)
|
||||
|
||||
if( ECM_FOUND AND BUILD_TESTING )
|
||||
ecm_add_test(
|
||||
Tests.cpp
|
||||
TEST_NAME
|
||||
packagechoosertest
|
||||
LINK_LIBRARIES
|
||||
${CALAMARES_LIBRARIES}
|
||||
calamares_viewmodule_packagechooser
|
||||
Qt5::Core
|
||||
Qt5::Test
|
||||
Qt5::Gui
|
||||
${_extra_libraries}
|
||||
)
|
||||
calamares_automoc( packagechoosertest)
|
||||
endif()
|
||||
calamares_add_test(
|
||||
packagechoosertest
|
||||
GUI
|
||||
SOURCES
|
||||
Tests.cpp
|
||||
LIBRARIES
|
||||
calamares_viewmodule_packagechooser
|
||||
${_extra_libraries}
|
||||
)
|
||||
|
@ -21,16 +21,12 @@ include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
if( ECM_FOUND AND BUILD_TESTING )
|
||||
ecm_add_test( ${partitionjobtests_SRCS}
|
||||
TEST_NAME partitionjobtests
|
||||
LINK_LIBRARIES
|
||||
${CALAMARES_LIBRARIES}
|
||||
kpmcore
|
||||
Qt5::Core
|
||||
Qt5::Test
|
||||
)
|
||||
|
||||
set_target_properties( partitionjobtests PROPERTIES AUTOMOC TRUE )
|
||||
calamares_add_test(
|
||||
partitionjobtests
|
||||
SOURCES ${partitionjobtests_SRCS}
|
||||
LIBRARIES
|
||||
kpmcore
|
||||
)
|
||||
if( TARGET partitionjobtests )
|
||||
target_compile_definitions( partitionjobtests PRIVATE ${_partition_defs} )
|
||||
endif()
|
||||
|
@ -8,17 +8,11 @@ calamares_add_plugin( shellprocess
|
||||
SHARED_LIB
|
||||
)
|
||||
|
||||
if( ECM_FOUND AND BUILD_TESTING )
|
||||
ecm_add_test(
|
||||
Tests.cpp
|
||||
TEST_NAME
|
||||
shellprocesstest
|
||||
LINK_LIBRARIES
|
||||
${CALAMARES_LIBRARIES}
|
||||
calamaresui
|
||||
${YAMLCPP_LIBRARY}
|
||||
Qt5::Core
|
||||
Qt5::Test
|
||||
)
|
||||
calamares_automoc( shellprocesstest )
|
||||
endif()
|
||||
calamares_add_test(
|
||||
shellprocesstest
|
||||
GUI # It's not
|
||||
SOURCES
|
||||
Tests.cpp
|
||||
LIBRARIES
|
||||
${YAMLCPP_LIBRARY}
|
||||
)
|
||||
|
@ -39,17 +39,11 @@ calamares_add_plugin( users
|
||||
SHARED_LIB
|
||||
)
|
||||
|
||||
if( ECM_FOUND AND BUILD_TESTING )
|
||||
ecm_add_test(
|
||||
PasswordTests.cpp
|
||||
SetPasswordJob.cpp
|
||||
TEST_NAME
|
||||
passwordtest
|
||||
LINK_LIBRARIES
|
||||
${CALAMARES_LIBRARIES}
|
||||
Qt5::Core
|
||||
Qt5::Test
|
||||
${CRYPT_LIBRARIES}
|
||||
)
|
||||
calamares_automoc( passwordtest )
|
||||
endif()
|
||||
calamares_add_test(
|
||||
passwordtest
|
||||
SOURCES
|
||||
PasswordTests.cpp
|
||||
SetPasswordJob.cpp
|
||||
LIBRARIES
|
||||
${CRYPT_LIBRARIES}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user