Merge branch 'develop' of https://github.com/mariadb-corporation/MaxScale into develop
This commit is contained in:
@ -8,6 +8,9 @@ set_maxscale_version()
|
|||||||
|
|
||||||
set(CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "Prefix prepended to install directories." FORCE)
|
set(CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "Prefix prepended to install directories." FORCE)
|
||||||
|
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/")
|
||||||
|
find_package(Valgrind)
|
||||||
project(MaxScale)
|
project(MaxScale)
|
||||||
|
|
||||||
check_deps()
|
check_deps()
|
||||||
@ -149,11 +152,13 @@ set(CPACK_RPM_USER_FILELIST "%ignore /etc/init.d")
|
|||||||
set(CPACK_RPM_USER_FILELIST "%ignore /etc/ld.so.conf.d")
|
set(CPACK_RPM_USER_FILELIST "%ignore /etc/ld.so.conf.d")
|
||||||
set(CPACK_RPM_USER_FILELIST "%ignore /etc")
|
set(CPACK_RPM_USER_FILELIST "%ignore /etc")
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
|
||||||
add_custom_target(buildtests
|
add_custom_target(buildtests
|
||||||
COMMAND ${CMAKE_COMMAND} -DDEPS_OK=Y -DBUILD_TESTS=Y -DBUILD_TYPE=Debug -DINSTALL_DIR=${CMAKE_BINARY_DIR} -DINSTALL_SYSTEM_FILES=N ${CMAKE_SOURCE_DIR}
|
COMMAND ${CMAKE_COMMAND} -DDEPS_OK=Y -DBUILD_TESTS=Y -DBUILD_TYPE=Debug -DINSTALL_DIR=${CMAKE_BINARY_DIR} -DINSTALL_SYSTEM_FILES=N ${CMAKE_SOURCE_DIR}
|
||||||
COMMAND make
|
COMMAND make
|
||||||
COMMENT "Building test suite..." VERBATIM
|
COMMENT "Building test suite..." VERBATIM
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(testall
|
add_custom_target(testall
|
||||||
COMMAND ${CMAKE_COMMAND} -DDEPS_OK=Y -DBUILD_TESTS=Y -DBUILD_TYPE=Debug -DINSTALL_DIR=${CMAKE_BINARY_DIR} -DINSTALL_SYSTEM_FILES=N ${CMAKE_SOURCE_DIR}
|
COMMAND ${CMAKE_COMMAND} -DDEPS_OK=Y -DBUILD_TESTS=Y -DBUILD_TYPE=Debug -DINSTALL_DIR=${CMAKE_BINARY_DIR} -DINSTALL_SYSTEM_FILES=N ${CMAKE_SOURCE_DIR}
|
||||||
COMMAND make install
|
COMMAND make install
|
||||||
@ -185,3 +190,16 @@ if(DOXYGEN_FOUND)
|
|||||||
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygate)
|
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygate)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Testall target with Valgrind
|
||||||
|
if(VALGRIND_FOUND)
|
||||||
|
add_custom_target(testall-valgrind
|
||||||
|
COMMAND ${CMAKE_COMMAND} -DDEPS_OK=Y -DBUILD_TESTS=Y -DBUILD_TYPE=Debug -DINSTALL_DIR=${CMAKE_BINARY_DIR} -DINSTALL_SYSTEM_FILES=N ${CMAKE_SOURCE_DIR}
|
||||||
|
COMMAND make install
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/server/test/MaxScale_test.cnf ${CMAKE_BINARY_DIR}/etc/MaxScale.cnf
|
||||||
|
COMMAND /bin/sh -c "valgrind --track-fds=yes --leak-check=full --show-leak-kinds=all --log-file=${CMAKE_BINARY_DIR}/valgrind.log ${CMAKE_BINARY_DIR}/bin/maxscale -c ${CMAKE_BINARY_DIR} &>/dev/null"
|
||||||
|
COMMAND /bin/sh -c "make test || echo \"Test results written to: ${CMAKE_BINARY_DIR}/Testing/Temporary/\""
|
||||||
|
COMMAND killall maxscale
|
||||||
|
COMMENT "Running full test suite with Valgrind..." VERBATIM)
|
||||||
|
|
||||||
|
endif()
|
13
FindValgrind.cmake
Normal file
13
FindValgrind.cmake
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# This CMake file tries to find the Valgrind executable
|
||||||
|
# The following variables are set:
|
||||||
|
# VALGRIND_FOUND - System has Valgrind
|
||||||
|
# VALGRIND_EXECUTABLE - The Valgrind executable file
|
||||||
|
find_program(VALGRIND_EXECUTABLE valgrind)
|
||||||
|
if(VALGRIND_EXECUTABLE STREQUAL "VALGRIND_EXECUTABLE-NOTFOUND")
|
||||||
|
message(STATUS "Valgrind not found.")
|
||||||
|
set(VALGRIND_FOUND FALSE CACHE INTERNAL "")
|
||||||
|
unset(VALGRIND_EXECUTABLE)
|
||||||
|
else()
|
||||||
|
message(STATUS "Valgrind found: ${VALGRIND_EXECUTABLE}")
|
||||||
|
set(VALGRIND_FOUND TRUE CACHE INTERNAL "")
|
||||||
|
endif()
|
@ -1042,21 +1042,46 @@ static char* blockbuf_get_writepos(
|
|||||||
}else if(bb->bb_state == BB_CLEARED){
|
}else if(bb->bb_state == BB_CLEARED){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*Move the full buffer to the end of the list
|
*Move the cleared buffer to the end of the list if it is the first one in the list
|
||||||
*/
|
*/
|
||||||
|
|
||||||
simple_mutex_unlock(&bb->bb_mutex);
|
simple_mutex_unlock(&bb->bb_mutex);
|
||||||
simple_mutex_lock(&bb_list->mlist_mutex, true);
|
simple_mutex_lock(&bb_list->mlist_mutex, true);
|
||||||
|
|
||||||
if(node->mlnode_next){
|
if(node == bb_list->mlist_first)
|
||||||
bb_list->mlist_first = node->mlnode_next;
|
{
|
||||||
bb_list->mlist_last->mlnode_next = node;
|
|
||||||
node->mlnode_next = NULL;
|
if(bb_list->mlist_nodecount > 1 &&
|
||||||
bb_list->mlist_last = node;
|
node != bb_list->mlist_last){
|
||||||
node = bb_list->mlist_first;
|
bb_list->mlist_last->mlnode_next = bb_list->mlist_first;
|
||||||
}
|
bb_list->mlist_first = bb_list->mlist_first->mlnode_next;
|
||||||
|
bb_list->mlist_last->mlnode_next->mlnode_next = NULL;
|
||||||
|
bb_list->mlist_last = bb_list->mlist_last->mlnode_next;
|
||||||
|
}
|
||||||
|
|
||||||
|
ss_dassert(node == bb_list->mlist_last);
|
||||||
|
|
||||||
|
simple_mutex_unlock(&bb_list->mlist_mutex);
|
||||||
|
simple_mutex_lock(&bb->bb_mutex, true);
|
||||||
|
|
||||||
|
bb->bb_state = BB_READY;
|
||||||
|
|
||||||
|
simple_mutex_unlock(&bb->bb_mutex);
|
||||||
|
simple_mutex_lock(&bb_list->mlist_mutex, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(node->mlnode_next){
|
||||||
|
node = node->mlnode_next;
|
||||||
|
}else{
|
||||||
|
node = bb_list->mlist_first;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bb->bb_state = BB_READY;
|
|
||||||
|
|
||||||
}else if (bb->bb_state == BB_READY){
|
}else if (bb->bb_state == BB_READY){
|
||||||
/**
|
/**
|
||||||
@ -2701,7 +2726,8 @@ static void filewriter_done(
|
|||||||
* by file writer which traverses the list and accesses block buffers
|
* by file writer which traverses the list and accesses block buffers
|
||||||
* included in list nodes.
|
* included in list nodes.
|
||||||
* List modifications are protected with version numbers.
|
* List modifications are protected with version numbers.
|
||||||
* Before modification, version is increased by one to be odd. After the
|
* Before
|
||||||
|
modification, version is increased by one to be odd. After the
|
||||||
* completion, it is increased again to even. List can be read only when
|
* completion, it is increased again to even. List can be read only when
|
||||||
* version is even and read is consistent only if version hasn't changed
|
* version is even and read is consistent only if version hasn't changed
|
||||||
* during the read.
|
* during the read.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
add_test(NAME ReadWriteSplitTest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/rwsplit.sh testrwsplit.log ${TEST_HOST} ${TEST_PORT_RW} ${TEST_MASTER_ID} ${TEST_USER} ${TEST_PASSWORD} ${CMAKE_CURRENT_SOURCE_DIR})
|
add_test(NAME ReadWriteSplitTest COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/rwsplit.sh testrwsplit.log ${TEST_HOST} ${TEST_PORT_RW} ${TEST_MASTER_ID} ${TEST_USER} ${TEST_PASSWORD} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
if(MYSQLCLIENT_FOUND)
|
if(MYSQLCLIENT_FOUND)
|
||||||
add_test(NAME ReadWriteSplitLoginTest COMMAND $<TARGET_FILE:testconnect> 10000 ${TEST_HOST} ${MASTER_PORT} ${TEST_HOST} ${TEST_PORT_RW} 1.10)
|
add_test(NAME ReadWriteSplitAuthTest COMMAND $<TARGET_FILE:testconnect> 10000 ${TEST_HOST} ${MASTER_PORT} ${TEST_HOST} ${TEST_PORT_RW} 1.10)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(test_hints)
|
add_subdirectory(test_hints)
|
@ -2,5 +2,5 @@ if(MYSQLCLIENT_FOUND)
|
|||||||
add_executable(testconnect testconnect.c)
|
add_executable(testconnect testconnect.c)
|
||||||
message(STATUS "Linking against: ${MYSQLCLIENT_LIBRARIES}")
|
message(STATUS "Linking against: ${MYSQLCLIENT_LIBRARIES}")
|
||||||
target_link_libraries(testconnect ${MYSQLCLIENT_LIBRARIES} ssl crypto dl z m rt pthread)
|
target_link_libraries(testconnect ${MYSQLCLIENT_LIBRARIES} ssl crypto dl z m rt pthread)
|
||||||
add_test(NAME ReadConnRouterLoginTest COMMAND $<TARGET_FILE:testconnect> 10000 ${TEST_HOST} ${MASTER_PORT} ${TEST_HOST} ${TEST_PORT} 1.10)
|
add_test(NAME ReadConnRouterAuthTest COMMAND $<TARGET_FILE:testconnect> 10000 ${TEST_HOST} ${MASTER_PORT} ${TEST_HOST} ${TEST_PORT} 1.10)
|
||||||
endif()
|
endif()
|
Reference in New Issue
Block a user