MXS-2900 Add possibility of having system test in any directory
The cmake-function add_test_executable_ex() adds a test using a source file in the current directory. The config file is given as a relative path.
This commit is contained in:
@ -229,8 +229,7 @@ add_test_executable(mysqlmon_failover_manual2.cpp mysqlmon_failover_manual2_4 my
|
|||||||
add_test_executable(mysqlmon_failover_manual2.cpp mysqlmon_failover_manual2_3 mysqlmon_failover_manual2_3 LABELS mysqlmon REPL_BACKEND)
|
add_test_executable(mysqlmon_failover_manual2.cpp mysqlmon_failover_manual2_3 mysqlmon_failover_manual2_3 LABELS mysqlmon REPL_BACKEND)
|
||||||
add_test_executable(mysqlmon_failover_manual2.cpp mysqlmon_failover_manual2_2 mysqlmon_failover_manual2_2 LABELS mysqlmon REPL_BACKEND)
|
add_test_executable(mysqlmon_failover_manual2.cpp mysqlmon_failover_manual2_2 mysqlmon_failover_manual2_2 LABELS mysqlmon REPL_BACKEND)
|
||||||
|
|
||||||
# MySQL Monitor switchover
|
add_subdirectory(mariadbmonitor)
|
||||||
add_test_executable(mysqlmon_switchover.cpp mysqlmon_switchover mysqlmon_switchover LABELS mysqlmon REPL_BACKEND)
|
|
||||||
|
|
||||||
# MySQL Monitor switchover with bad master
|
# MySQL Monitor switchover with bad master
|
||||||
add_test_executable(mysqlmon_switchover_bad_master.cpp mysqlmon_switchover_bad_master mysqlmon_switchover_bad_master LABELS mysqlmon REPL_BACKEND)
|
add_test_executable(mysqlmon_switchover_bad_master.cpp mysqlmon_switchover_bad_master mysqlmon_switchover_bad_master LABELS mysqlmon REPL_BACKEND)
|
||||||
|
|||||||
1
maxscale-system-test/mariadbmonitor/CMakeLists.txt
Normal file
1
maxscale-system-test/mariadbmonitor/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
add_test_executable_ex(mysqlmon_switchover.cpp mysqlmon_switchover mysqlmon_switchover.cnf LABELS REPL_BACKEND)
|
||||||
@ -20,6 +20,16 @@ function(add_template_manual name template)
|
|||||||
add_template(${name} ${template} "CONFIG")
|
add_template(${name} ${template} "CONFIG")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# Helper function to add a configuration template
|
||||||
|
function(add_test_info name cnf_file_path labels)
|
||||||
|
if (NOT EXISTS ${cnf_file_path})
|
||||||
|
message(FATAL_ERROR "Config file ${cnf_file_path} not found.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(new_def "{\"${name}\", \"${cnf_file_path}\", \"${labels}\"}")
|
||||||
|
set(TEST_DEFINITIONS "${TEST_DEFINITIONS}${new_def}," CACHE INTERNAL "")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
# Helper function for adding properties to a test. Adds the default timeout and labels.
|
# Helper function for adding properties to a test. Adds the default timeout and labels.
|
||||||
function(add_test_properties name labels)
|
function(add_test_properties name labels)
|
||||||
list(APPEND labels ${ARGN})
|
list(APPEND labels ${ARGN})
|
||||||
@ -75,6 +85,17 @@ function(add_test_script name script template labels)
|
|||||||
add_test_properties(${name} ${labels})
|
add_test_properties(${name} ${labels})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# Same as "add_test_executable" but with a local config template file.
|
||||||
|
function(add_test_executable_ex source name config_file labels)
|
||||||
|
list(APPEND labels ${ARGN})
|
||||||
|
set(config_file_path "${CMAKE_CURRENT_SOURCE_DIR}/${config_file}")
|
||||||
|
add_test_info(${name} ${config_file_path} "${labels}")
|
||||||
|
add_executable(${name} ${source})
|
||||||
|
target_link_libraries(${name} maxtest)
|
||||||
|
add_test(NAME ${name} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${name} ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
add_test_properties(${name} ${labels})
|
||||||
|
endfunction()
|
||||||
|
|
||||||
# Label a list of tests as heavy, long running tests
|
# Label a list of tests as heavy, long running tests
|
||||||
macro(heavy_weight_tests)
|
macro(heavy_weight_tests)
|
||||||
foreach(name IN ITEMS ${ARGN})
|
foreach(name IN ITEMS ${ARGN})
|
||||||
|
|||||||
Reference in New Issue
Block a user