From d428292ec023e3ae53f48665994dfe433b889826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Sat, 18 Aug 2018 21:08:51 +0300 Subject: [PATCH] Add workaround to building tests without all dependencies The system tests can be build even if not all of the dependencies for MaxScale are met. --- CMakeLists.txt | 6 ++++-- maxctrl/CMakeLists.txt | 2 +- maxscale-system-test/mdbci/run_test.sh | 2 +- server/modules/authenticator/MySQLAuth/CMakeLists.txt | 2 +- server/modules/filter/dbfwfilter/CMakeLists.txt | 2 ++ 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a88a5352..45d728799 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,9 @@ project(MaxScale) include(${CMAKE_SOURCE_DIR}/cmake/install_layout.cmake) # Do the platform check -include(cmake/CheckPlatform.cmake) +if (NOT BUILD_SYSTEM_TESTS) + include(cmake/CheckPlatform.cmake) +endif() check_dirs() find_package(OpenSSL) @@ -60,7 +62,7 @@ include(cmake/BuildMicroHttpd.cmake) include_directories(${JANSSON_INCLUDE_DIR}) -if(NOT OPENSSL_FOUND) +if(NOT OPENSSL_FOUND AND NOT BUILD_SYSTEM_TESTS) message(FATAL_ERROR "Failed to locate dependency: OpenSSL") else() if(OPENSSL_VERSION VERSION_LESS 1 AND NOT FORCE_OPENSSL100) diff --git a/maxctrl/CMakeLists.txt b/maxctrl/CMakeLists.txt index 4ab468542..cd04841e9 100644 --- a/maxctrl/CMakeLists.txt +++ b/maxctrl/CMakeLists.txt @@ -19,7 +19,7 @@ if (BUILD_MAXCTRL) ${CMAKE_BINARY_DIR}/maxctrl-test/ # Location where tests are built and run WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) - else() + elseif(NOT BUILD_SYSTEM_TESTS) message(FATAL_ERROR "Not building MaxCtrl: npm or Node.js >= 6.0.0 not found. Add the following to skip MaxCtrl: -DBUILD_MAXCTRL=N") endif() else() diff --git a/maxscale-system-test/mdbci/run_test.sh b/maxscale-system-test/mdbci/run_test.sh index 63fbc1f53..8cf13563d 100755 --- a/maxscale-system-test/mdbci/run_test.sh +++ b/maxscale-system-test/mdbci/run_test.sh @@ -67,7 +67,7 @@ if [ $res == 0 ] ; then cd ${script_dir}/../../ mkdir build && cd build - cmake ../../ -DWITH_SYSTEM_TESTS -DBUILDNAME=$name -DCMAKE_BUILD_TYPE=Debug + cmake ../../ -DBUILD_SYSTEM_TESTS=Y -DBUILDNAME=$name -DCMAKE_BUILD_TYPE=Debug cd maxscale-system-test make diff --git a/server/modules/authenticator/MySQLAuth/CMakeLists.txt b/server/modules/authenticator/MySQLAuth/CMakeLists.txt index a4869c8a7..e266f35b4 100644 --- a/server/modules/authenticator/MySQLAuth/CMakeLists.txt +++ b/server/modules/authenticator/MySQLAuth/CMakeLists.txt @@ -1,4 +1,4 @@ -if(SQLITE_VERSION VERSION_LESS 3.3) +if(SQLITE_VERSION VERSION_LESS 3.3 AND NOT BUILD_SYSTEM_TESTS) message(FATAL_ERROR "SQLite version 3.3 or higher is required") else() add_library(mysqlauth SHARED mysql_auth.cc dbusers.cc) diff --git a/server/modules/filter/dbfwfilter/CMakeLists.txt b/server/modules/filter/dbfwfilter/CMakeLists.txt index 4d0802d31..f07c8cfde 100644 --- a/server/modules/filter/dbfwfilter/CMakeLists.txt +++ b/server/modules/filter/dbfwfilter/CMakeLists.txt @@ -24,6 +24,8 @@ if(BISON_FOUND AND FLEX_FOUND) if(BUILD_TESTS) add_subdirectory(test) endif() +elseif (BUILD_SYSTEM_TESTS) + message(STATUS "Not building dbfwfilter when tests are built and both flex and bison were not found") else() message(FATAL_ERROR "Could not find Bison or Flex: ${BISON_EXECUTABLE} ${FLEX_EXECUTABLE}") endif()