Merge branch '2.3' into 2.4

This commit is contained in:
Esa Korhonen 2020-04-01 21:31:30 +03:00
commit 711d6a4083
5 changed files with 23 additions and 2 deletions

View File

@ -225,8 +225,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_2 mysqlmon_failover_manual2_2 LABELS mysqlmon REPL_BACKEND)
# MySQL Monitor switchover
add_test_executable(mysqlmon_switchover.cpp mysqlmon_switchover mysqlmon_switchover LABELS mysqlmon REPL_BACKEND)
add_subdirectory(mariadbmonitor)
# 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)

View File

@ -0,0 +1 @@
add_test_executable_ex(mysqlmon_switchover.cpp mysqlmon_switchover mysqlmon_switchover.cnf LABELS REPL_BACKEND)

View File

@ -20,6 +20,16 @@ function(add_template_manual name template)
add_template(${name} ${template} "CONFIG")
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.
function(add_test_properties name labels)
list(APPEND labels ${ARGN})
@ -75,6 +85,17 @@ function(add_test_script name script template labels)
add_test_properties(${name} ${labels})
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
macro(heavy_weight_tests)
foreach(name IN ITEMS ${ARGN})