Files
MaxScale/maxscale-system-test/utilities.cmake
Timofey Turenko e1fc0b8734 Squashed commit of the following:
commit 48a0b902b67da46f1eed4afa687bdcb56b59d02f
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Mon Dec 16 15:35:07 2019 +0200

    Increase timouts in the mxs173_trottle_filter test

commit 81d8083a89421a8004b8024d480ae0f35d715b86
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Mon Dec 16 14:19:39 2019 +0200

    Increase timeouts in max1071_maxrow test

commit e1039c6132f0e9274b8801165f3f905ede7c9421
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Mon Dec 16 00:06:53 2019 +0200

    Remove hardcoded 'home/vagrant/' from all maxscale.cnf in system tests

commit 28c8029e060afdcf5159bf802b13dcd5e484d9f1
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sun Dec 15 21:31:34 2019 +0200

    Use private IP for Galera congiguration in maxscale-system-tests

commit 66dc36cbf43a5fb92465df31e1295e82865be1fc
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sun Dec 15 09:06:28 2019 +0200

    Fix typos in fwf_*.cpp

commit 44c7a4384ddf39596c0254c955aeb6c008a00a35
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sun Dec 15 09:05:26 2019 +0200

    Fix typos in fwf_*.cpp

commit 2649017611908a8b0d27090f49722947ac31c4f4
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sun Dec 15 09:03:41 2019 +0200

    Fix typos in fwf_*.cpp

commit 5cc87658523e8496eaab17700be8a821af5b0cde
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sat Dec 14 23:54:53 2019 +0200

    Fix typo in fwf_copy_rules.cpp

commit fb1accc36cb9d79691469f63cb4535f3bc38dedd
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sat Dec 14 23:52:51 2019 +0200

    More hardcoded 'vagrant' removals

commit 77e49d474b4abe767629ff87b01f08137773d761
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sat Dec 14 23:35:09 2019 +0200

    Fix hardcoded 'vagrant' user in fwf* tests

    Several firewall filter tests has hardcoded 'vagrant' as a user name for
    access user on the VM. Changed to node->access_user.

commit ed5ab1487f37822db6a7478f76c0f3652776c389
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sat Dec 14 22:50:35 2019 +0200

    Fix IP vs IP_private

    Many tests use IP instead of IP_private which makes them failed in the
    AWS or GCloud environment.
    The same applies to get_conn_num() etc functions.

commit 0558aac23d303a675dc12d05b1766e698753b444
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Thu Aug 15 12:02:01 2019 +0300

    fix IP -> IP_private for some mysqlmon* testst

commit 5d9c70970d970eb995c8774d0088bd1c54ab76fe
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sat Dec 14 20:20:51 2019 +0200

    Replace IP to IP_private in the maxscale-system-tests

commit b06cf3329af59ff100748691991213fe639f29e6
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Tue Nov 19 11:52:33 2019 +0200

    Remove spaces from value which were read from *_network_config

    MDBCI can put spaces around values in the *_network_config file which
    can cause ssh connection failures in the tests. To fix it removing all
    spaces from all values which were read from *_network_config

commit b3904f019847ef1db9d4ec9714ad9ef869fa0b01
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Thu Dec 12 23:36:31 2019 +0200

    Increate default timeout for all system tests
2019-12-16 15:41:52 +02:00

125 lines
4.6 KiB
CMake

# Helper function to add a configuration template
function(add_template name template labels)
set(CNF_TEMPLATES "${CNF_TEMPLATES}{\"${name}\",\"${template}\", \"${labels}\"}," CACHE INTERNAL "")
endfunction()
# Helper function to add a configuration template
function(add_template_manual name template)
add_template(${name} ${template} "${name}.cpp;${name};${template};LABELS;CONFIG")
endfunction()
# Default test timeout
set(TIMEOUT 3600)
# This functions adds a source file as an executable, links that file against
# the common test core and creates a test from it. The first parameter is the
# source file, the second is the name of the executable and the test and the
# last parameter is the template suffix of the test. The template should follow
# the following naming policy: `maxscale.cnf.template.<template name>` and the
# file should be located in the /cnf/ directory.
#
# Example: to add simple_test.cpp with maxscale.cnf.template.simple_config to the
# test set, the function should be called as follows:
# add_test_executable(simple_test.cpp simple_test simple_config LABELS some_label)
function(add_test_executable source name template)
add_template(${name} ${template} "${ARGV}")
add_executable(${name} ${source})
target_link_libraries(${name} testcore)
add_test(NAME ${name} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${name} ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
list(REMOVE_AT ARGV 0 1 2 3)
foreach (label IN LISTS ARGV)
get_property(prev_labels TEST ${name} PROPERTY LABELS)
set_property(TEST ${name} PROPERTY LABELS ${label} ${prev_labels})
endforeach()
set_property(TEST ${name} PROPERTY TIMEOUT ${TIMEOUT})
endfunction()
# Same as add_test_executable, but do not add executable into tests list
function(add_test_executable_notest source name template)
add_template(${name} ${template} "${ARGV}")
add_executable(${name} ${source})
target_link_libraries(${name} testcore)
endfunction()
# Add a test which uses another test as the executable
function(add_test_derived name executable template)
add_template(${name} ${template} "${ARGV}")
add_test(NAME ${name} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${executable} ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_property(TEST ${name} PROPERTY TIMEOUT ${TIMEOUT})
list(REMOVE_AT ARGV 0 1 2)
foreach (label IN LISTS ARGV)
get_property(prev_labels TEST ${name} PROPERTY LABELS)
set_property(TEST ${name} PROPERTY LABELS ${label} ${prev_labels})
endforeach()
endfunction()
# This function adds a script as a test with the specified name and template.
# The naming of the templates follow the same principles as add_test_executable.
# also suitable for symlinks
function(add_test_script name script template labels)
add_template(${name} ${template} "${ARGV}")
add_test(NAME ${name} COMMAND non_native_setup ${name} ${script} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
list(REMOVE_AT ARGV 0 1 2)
foreach (label IN LISTS ARGV)
get_property(prev_labels TEST ${name} PROPERTY LABELS)
set_property(TEST ${name} PROPERTY LABELS ${label} ${prev_labels})
endforeach()
set_property(TEST ${name} PROPERTY TIMEOUT ${TIMEOUT})
endfunction()
# Label a list of tests as heavy, long running tests
macro(heavy_weight_tests)
foreach(name IN ITEMS ${ARGN})
set_property(TEST ${name} PROPERTY LABELS "HEAVY")
endforeach()
endmacro()
# Label tests as medium weight tests. These tests take more than 180 seconds to complete.
macro(medium_weight_tests)
foreach(name IN ITEMS ${ARGN})
set_property(TEST ${name} PROPERTY LABELS "MEDIUM")
endforeach()
endmacro()
# Label tests as light weight tests. These tests take less than 90 seconds to complete.
macro(light_weight_tests)
foreach(name IN ITEMS ${ARGN})
set_property(TEST ${name} PROPERTY LABELS "LIGHT")
endforeach()
endmacro()
# Unstable tests. Ideally, there should be no tests with this label.
macro(unstable_tests)
foreach(name IN ITEMS ${ARGN})
set_property(TEST ${name} PROPERTY LABELS "UNSTABLE")
set_property(TEST ${name} PROPERTY LABELS "HEAVY")
endforeach()
endmacro()
# Test utilities
add_test_executable_notest(non_native_setup.cpp non_native_setup replication)
add_test_executable_notest(sysbench_example.cpp sysbench_example replication)
#
# Check that all required components are present. To build even without them,
# add e.g. -DHAVE_PHP=Y to the CMake invocation
#
find_program(HAVE_MYSQLTEST mysqltest)
if (NOT HAVE_MYSQLTEST)
message(FATAL_ERROR "Could not find mysqltest. Add -DHAVE_MYSQLTEST=Y to CMake invocation ignore this.")
endif()
find_program(HAVE_PHP php)
if (NOT HAVE_PHP)
message(FATAL_ERROR "Could not find php. Add -DHAVE_PHP=Y to CMake invocation ignore this.")
endif()