Combine regression test suite and main CMake projects

Combining the projects makes it easier to use common components. This
fixes the build failure of maxutils due to missing jansson definitions.
This commit is contained in:
Markus Mäkelä 2018-08-17 13:44:55 +03:00
parent c7a6d75ab9
commit f09afa2967
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
11 changed files with 29 additions and 107 deletions

View File

@ -58,10 +58,6 @@ include_directories(BEFORE ${MARIADB_CONNECTOR_INCLUDE_DIR})
include(cmake/BuildJansson.cmake)
include(cmake/BuildMicroHttpd.cmake)
# Build the MaxUtils libraries
include(cmake/BuildMaxUtils.cmake)
include_directories(${MAXUTILS_INCLUDE_DIR})
include_directories(${JANSSON_INCLUDE_DIR})
if(NOT OPENSSL_FOUND)
@ -179,12 +175,14 @@ include_directories(server/inih)
include_directories(server/modules/include)
include_directories(${CMAKE_BINARY_DIR}/include)
include_directories(${CURL_INCLUDE_DIRS})
include_directories(maxutils/maxbase/include)
if (BUILD_CDC)
include_directories(avro)
add_subdirectory(avro)
endif()
add_subdirectory(maxutils)
add_subdirectory(plugins)
add_subdirectory(query_classifier)
add_subdirectory(server)
@ -198,6 +196,10 @@ if(BUILD_TESTS)
add_subdirectory(examples)
endif()
if(BUILD_SYSTEM_TESTS)
add_subdirectory(maxscale-system-test)
endif()
# Generate text versions of some documents
execute_process(COMMAND perl ${CMAKE_SOURCE_DIR}/Documentation/format.pl
${CMAKE_SOURCE_DIR}/Documentation/Changelog.md

View File

@ -1,5 +1,5 @@
add_executable(maxadmin maxadmin.c)
add_dependencies(maxadmin maxutils)
add_dependencies(maxadmin maxbase)
find_library(HIST edit)
if(HIST)

View File

@ -1,9 +0,0 @@
# Build the maxutils library
ExternalProject_Add(maxutils
SOURCE_DIR ${CMAKE_SOURCE_DIR}/maxutils
BINARY_DIR ${CMAKE_BINARY_DIR}/maxutils
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/maxutils/install)
set(MAXUTILS_INCLUDE_DIR ${CMAKE_BINARY_DIR}/maxutils/install/include CACHE INTERNAL "")
set(MAXUTILS_LIBRARIES ${CMAKE_BINARY_DIR}/maxutils/install/lib/libmaxbase.a CACHE INTERNAL "")

View File

@ -11,27 +11,19 @@
# EXTERN_BACKEND
# BREAKS_REPL
# BREAKS_GALERA
project(maxscale_system_test)
cmake_minimum_required(VERSION 2.8)
set(CTEST_BUILD_NAME "${BUILDNAME}")
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of
build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug
Release RelWithDebInfo MinSizeRel.")
set(CMAKE_CXX_FLAGS "-std=c++11 -ggdb -Wall -Wextra -Werror -Wno-format-overflow -Wno-unused-function -Wno-unused-parameter -Werror=format-security")
set(CMAKE_CXX_FLAGS_DEBUG "-std=c++11 -ggdb -Wall -Werror -Wno-format-overflow -Wno-unused-function")
set(CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -ggdb -Wall -Werror -Wno-format-overflow -Wno-unused-function")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-std=c++11 -ggdb -Wall -Werror -Wno-format-overflow -Wno-unused-function")
enable_testing()
# utilities.cmake contains all helper functions and extra tools
include(utilities.cmake)
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${MAXUTILS_INCLUDE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_SOURCE_DIR}/connectors/cdc-connector)
# The core library
include_directories(${CMAKE_BINARY_DIR})
@ -41,10 +33,10 @@ add_library(testcore SHARED testconnections.cpp nodes.cpp mariadb_nodes.cpp maxs
different_size.cpp fw_copy_rules maxinfo_func.cpp config_operations.cpp rds_vpc.cpp execute_cmd.cpp
blob_test.cpp keepalived_func.cpp tcp_connection.cpp base/stopwatch.cpp
# Include the CDC connector in the core library
${CMAKE_SOURCE_DIR}/../connectors/cdc-connector/cdc_connector.cpp)
target_link_libraries(testcore ${MYSQL_CLIENT} ${JANSSON_LIBRARIES} ${MAXUTILS_LIBRARIES} z m pthread ssl dl rt crypto crypt)
${CMAKE_SOURCE_DIR}/connectors/cdc-connector/cdc_connector.cpp)
target_link_libraries(testcore ${MARIADB_CONNECTOR_LIBRARIES} ${JANSSON_LIBRARIES} z m pthread ssl dl rt crypto crypt maxbase)
install(TARGETS testcore DESTINATION system-test)
add_dependencies(testcore connector-c jansson maxutils)
add_dependencies(testcore connector-c jansson maxbase)
# Include the CDC connector headers
include_directories(${CMAKE_SOURCE_DIR}/../connectors/cdc-connector/)
@ -217,7 +209,7 @@ add_test_executable(bug730.cpp bug730 bug730 LABELS regexfilter REPL_BACKEND)
add_test_executable(bulk_insert.cpp bulk_insert bulk_insert LABELS MySQLProtocol REPL_BACKEND 10.2)
# Tests for the CCRFilter module
add_test_executable(ccrfilter.cpp ccrfilter ccrfilter LABELS ccrfilter LIGHT REPL_BACKEND)
add_test_executable(ccrfilter.cpp ccrfilter_test ccrfilter LABELS ccrfilter LIGHT REPL_BACKEND)
# Tries to reconfigure replication setup to use another node as a Master
add_test_executable(change_master_during_session.cpp change_master_during_session replication LABELS readwritesplit mysqlmon REPL_BACKEND)
@ -743,7 +735,7 @@ add_test_executable(mxs1896_load_data_infile.cpp mxs1896_load_data_infile replic
add_test_executable(mxs1899_generated_cnf.cpp mxs1899_generated_cnf replication LABELS REPL_BACKEND)
# 'namedserverfilter' test
add_test_executable(namedserverfilter.cpp namedserverfilter namedserverfilter LABELS namedserverfilter LIGHT REPL_BACKEND)
add_test_executable(namedserverfilter.cpp namedserverfilter_test namedserverfilter LABELS namedserverfilter LIGHT REPL_BACKEND)
# Authentication error testing
add_test_executable(no_password.cpp no_password replication LABELS MySQLAuth LIGHT REPL_BACKEND)
@ -1059,6 +1051,4 @@ add_test_executable(mxs1985_kill_hang.cpp mxs1985_kill_hang replication LABELS R
add_test_executable(mxs1113_schemarouter_ps.cpp mxs1113_schemarouter_ps mxs1113_schemarouter_ps LABELS schemarouter BREAKS_REPL)
configure_file(templates.h.in templates.h @ONLY)
include(CTest)
configure_file(templates.h.in ${CMAKE_CURRENT_BINARY_DIR}/templates.h @ONLY)

View File

@ -1,7 +1,7 @@
#ifndef BIG_TRANSACTION_H
#define BIG_TRANSACTION_H
#include <mariadb/mysql.h>
#include <mysql.h>
#include <stdio.h>
#include <stdlib.h>
#include "sql_t1.h"

View File

@ -14,7 +14,7 @@
* @endverbatim
*/
#include <mariadb/mysql.h>
#include <mysql.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -64,9 +64,11 @@ res=$?
ulimit -c unlimited
if [ $res == 0 ] ; then
. ${script_dir}/set_env.sh $name
cd ${script_dir}/..
cd ${script_dir}/../../
mkdir build && cd build
cmake .. -DBUILDNAME=$name -DCMAKE_BUILD_TYPE=Debug
cmake ../../ -DWITH_SYSTEM_TESTS -DBUILDNAME=$name -DCMAKE_BUILD_TYPE=Debug
cd maxscale-system-test
make
if [ ! -z "${named_test}" ] ; then
@ -82,7 +84,7 @@ if [ $res == 0 ] ; then
exit 1
fi
${mdbci_dir}/mdbci snapshot take --path-to-nodes $name --snapshot-name clean
ctest -VV -D Nightly ${test_set}
ctest -VV ${test_set}
fi
cp core.* ${logs_publish_dir}
${script_dir}/copy_logs.sh

View File

@ -69,15 +69,17 @@ checkExitStatus $? "Error installing Maxscale" $snapshot_lock_file
cd ${script_dir}/..
rm -rf build
mkdir build && cd build
cmake .. -DBUILDNAME=$JOB_NAME-$BUILD_NUMBER-$target
cmake ../../ -DBUILDNAME=$JOB_NAME-$BUILD_NUMBER-$target -DBUILD_SYSTEM_TESTS=Y
cd maxscale-system-test
make
./check_backend --restart-galera
checkExitStatus $? "Failed to check backends" $snapshot_lock_file
ulimit -c unlimited
ctest $test_set -VV -D Nightly
ctest $test_set -VV
cp core.* ${logs_publish_dir}
${script_dir}/copy_logs.sh

View File

@ -105,20 +105,6 @@ add_test_executable_notest(binlog_big_transaction.cpp binlog_big_transaction set
add_test_executable_notest(avro_long.cpp avro_long avro)
add_test_executable_notest(sysbench_example.cpp sysbench_example replication)
# Build the MariaDB Connector/C 3.0
set(CONNECTOR_C_VERSION "v3.0.2" CACHE STRING "The Connector-C version to use")
include(ExternalProject)
ExternalProject_Add(connector-c
GIT_REPOSITORY "https://github.com/MariaDB/mariadb-connector-c.git"
GIT_TAG ${CONNECTOR_C_VERSION}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}
UPDATE_COMMAND "")
include_directories(${CMAKE_BINARY_DIR}/include)
set(MYSQL_CLIENT ${CMAKE_BINARY_DIR}/lib/mariadb/libmariadbclient.a CACHE INTERNAL "")
#
# Check that all required components are present. To build even without them,
# add e.g. -DHAVE_PHP=Y to the CMake invocation
@ -133,32 +119,3 @@ find_program(HAVE_PHP php)
if (NOT HAVE_PHP)
message(FATAL_ERROR "Could not find php.")
endif()
# Build the Jansson library from source
set(JANSSON_REPO "https://github.com/akheron/jansson.git" CACHE STRING "Jansson Git repository")
# Release 2.9 of Jansson
set(JANSSON_TAG "v2.9" CACHE STRING "Jansson Git tag")
ExternalProject_Add(jansson
GIT_REPOSITORY ${JANSSON_REPO}
GIT_TAG ${JANSSON_TAG}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/jansson/install -DCMAKE_C_FLAGS=-fPIC -DJANSSON_BUILD_DOCS=OFF
BINARY_DIR ${CMAKE_BINARY_DIR}/jansson
INSTALL_DIR ${CMAKE_BINARY_DIR}/jansson/install
UPDATE_COMMAND "")
set(JANSSON_FOUND TRUE CACHE INTERNAL "")
set(JANSSON_STATIC_FOUND TRUE CACHE INTERNAL "")
set(JANSSON_INCLUDE_DIR ${CMAKE_BINARY_DIR}/jansson/install/include CACHE INTERNAL "")
set(JANSSON_STATIC_LIBRARIES ${CMAKE_BINARY_DIR}/jansson/install/lib/libjansson.a CACHE INTERNAL "")
set(JANSSON_LIBRARIES ${JANSSON_STATIC_LIBRARIES} CACHE INTERNAL "")
# Build the maxutils library
ExternalProject_Add(maxutils
SOURCE_DIR ${CMAKE_SOURCE_DIR}/../maxutils/
BINARY_DIR ${CMAKE_BINARY_DIR}/maxutils
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/maxutils/install)
set(MAXUTILS_INCLUDE_DIR ${CMAKE_BINARY_DIR}/maxutils/install/include CACHE INTERNAL "")
set(MAXUTILS_LIBRARIES ${CMAKE_BINARY_DIR}/maxutils/install/lib/libmaxbase.a CACHE INTERNAL "")

View File

@ -1,23 +1 @@
enable_testing()
project(maxutils)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_FLAGS "-fPIC -std=c++11 -ggdb -Wall -Werror -Wno-unused-function")
# Check for GLIBC. The XSI version of strerror_r return an int and the GNU version a
# char*. Depending on this check, we make assumptions about the system.
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#define _GNU_SOURCE 1
#include <string.h>\n
int main(){\n
char errbuf[200];\n
return strerror_r(13, errbuf, sizeof(errbuf)) == errbuf;\n
}\n"
HAVE_GLIBC)
if(HAVE_GLIBC)
add_definitions(-DHAVE_GLIBC=1)
endif()
add_subdirectory(maxbase)

View File

@ -61,8 +61,8 @@ elseif(WITH_TCMALLOC)
endif()
target_link_libraries(maxscale-common
maxbase
${MARIADB_CONNECTOR_LIBRARIES}
${MAXUTILS_LIBRARIES}
${LZMA_LINK_FLAGS}
${PCRE2_LIBRARIES}
${JANSSON_LIBRARIES}
@ -88,7 +88,7 @@ if (HAVE_LIBDL)
target_link_libraries(maxscale-common dl)
endif()
add_dependencies(maxscale-common pcre2 connector-c libmicrohttpd jansson maxutils)
add_dependencies(maxscale-common pcre2 connector-c libmicrohttpd jansson maxbase)
set_target_properties(maxscale-common PROPERTIES VERSION "1.0.0")
install_module(maxscale-common core)