Fix CMake problems in system test

The paths were wrong in the scripts used to run tests. The same problem
was in the CMake files that used CMAKE_SOURCE_DIR instead of
CMAKE_CURRENT_SOURCE_DIR.

Added missing check for BUILD_SYSTEM_TESTS in avrorouter for the
workaround to building without all dependencies present.
This commit is contained in:
Markus Mäkelä
2018-08-19 20:49:40 +03:00
parent d428292ec0
commit 930be8d77a
7 changed files with 11 additions and 13 deletions

View File

@ -28,9 +28,7 @@ project(MaxScale)
include(${CMAKE_SOURCE_DIR}/cmake/install_layout.cmake) include(${CMAKE_SOURCE_DIR}/cmake/install_layout.cmake)
# Do the platform check # Do the platform check
if (NOT BUILD_SYSTEM_TESTS)
include(cmake/CheckPlatform.cmake) include(cmake/CheckPlatform.cmake)
endif()
check_dirs() check_dirs()
find_package(OpenSSL) find_package(OpenSSL)

View File

@ -5,13 +5,13 @@
find_library(LIBUUID_LIBRARIES NAMES uuid) find_library(LIBUUID_LIBRARIES NAMES uuid)
if (NOT LIBUUID_LIBRARIES) if (NOT LIBUUID_LIBRARIES)
message(FATAL_ERROR "Could not find libuuid library") message(STATUS "Could not find libuuid library")
else() else()
message(STATUS "Found libuuid ${LIBUUID_LIBRARIES}") message(STATUS "Found libuuid ${LIBUUID_LIBRARIES}")
endif() endif()
find_path(LIBUUID_HEADERS uuid.h PATH_SUFFIXES uuid/) find_path(LIBUUID_HEADERS uuid.h PATH_SUFFIXES uuid/)
if (NOT LIBUUID_HEADERS) if (NOT LIBUUID_HEADERS)
message(FATAL_ERROR "Could not find libuuid headers") message(STATUS "Could not find libuuid headers")
else() else()
message(STATUS "Found libuuid headers ${LIBUUID_HEADERS}") message(STATUS "Found libuuid headers ${LIBUUID_HEADERS}")
endif() endif()

View File

@ -67,7 +67,7 @@ if [ $res == 0 ] ; then
cd ${script_dir}/../../ cd ${script_dir}/../../
mkdir build && cd build mkdir build && cd build
cmake ../../ -DBUILD_SYSTEM_TESTS=Y -DBUILDNAME=$name -DCMAKE_BUILD_TYPE=Debug cmake .. -DBUILD_SYSTEM_TESTS=Y -DBUILDNAME=$name -DCMAKE_BUILD_TYPE=Debug
cd maxscale-system-test cd maxscale-system-test
make make

View File

@ -66,12 +66,12 @@ ${mdbci_dir}/mdbci install_product --product maxscale_ci $name/maxscale
checkExitStatus $? "Error installing Maxscale" $snapshot_lock_file checkExitStatus $? "Error installing Maxscale" $snapshot_lock_file
cd ${script_dir}/.. cd ${script_dir}/../../
rm -rf build rm -rf build
mkdir build && cd build mkdir build && cd build
cmake ../../ -DBUILDNAME=$JOB_NAME-$BUILD_NUMBER-$target -DBUILD_SYSTEM_TESTS=Y cmake .. -DBUILDNAME=$JOB_NAME-$BUILD_NUMBER-$target -DBUILD_SYSTEM_TESTS=Y
cd maxscale-system-test cd maxscale-system-test
make make

View File

@ -12,6 +12,6 @@ static struct
static const char * default_template __attribute__((unused)) = "replication"; static const char * default_template __attribute__((unused)) = "replication";
/** This is the working directory for all tests */ /** This is the working directory for all tests */
static const char *test_dir __attribute__((unused)) = "@CMAKE_SOURCE_DIR@"; static const char *test_dir __attribute__((unused)) = "@CMAKE_CURRENT_SOURCE_DIR@";
#endif #endif

View File

@ -21,7 +21,7 @@ function(add_test_executable source name template)
add_template(${name} ${template}) add_template(${name} ${template})
add_executable(${name} ${source}) add_executable(${name} ${source})
target_link_libraries(${name} testcore) target_link_libraries(${name} testcore)
add_test(NAME ${name} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${name} ${name} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) 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) list(REMOVE_AT ARGV 0 1 2 3)
@ -42,7 +42,7 @@ endfunction()
# Add a test which uses another test as the executable # Add a test which uses another test as the executable
function(add_test_derived name executable template) function(add_test_derived name executable template)
add_template(${name} ${template}) add_template(${name} ${template})
add_test(NAME ${name} COMMAND ${CMAKE_BINARY_DIR}/${executable} ${name} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) add_test(NAME ${name} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${executable} ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_property(TEST ${name} PROPERTY TIMEOUT ${TIMEOUT}) set_property(TEST ${name} PROPERTY TIMEOUT ${TIMEOUT})
list(REMOVE_AT ARGV 0 1 2) list(REMOVE_AT ARGV 0 1 2)
@ -58,7 +58,7 @@ endfunction()
# also suitable for symlinks # also suitable for symlinks
function(add_test_script name script template labels) function(add_test_script name script template labels)
add_template(${name} ${template}) add_template(${name} ${template})
add_test(NAME ${name} COMMAND ${CMAKE_SOURCE_DIR}/${script} ${name} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) add_test(NAME ${name} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${script} ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
list(REMOVE_AT ARGV 0 1 2) list(REMOVE_AT ARGV 0 1 2)

View File

@ -18,7 +18,7 @@ if(AVRO_FOUND AND JANSSON_FOUND)
if (BUILD_TESTS) if (BUILD_TESTS)
add_subdirectory(test) add_subdirectory(test)
endif() endif()
else() elseif(NOT BUILD_SYSTEM_TESTS)
message(FATAL_ERROR "No Avro C or Jansson libraries found, cannot build avrorouter. " message(FATAL_ERROR "No Avro C or Jansson libraries found, cannot build avrorouter. "
"Use the -DBUILD_CDC=N option to `cmake` to disable building of the avrorouter.") "Use the -DBUILD_CDC=N option to `cmake` to disable building of the avrorouter.")
endif() endif()