Removed old unused cmake variables, updated documentation and fixed testall suite.

This commit is contained in:
Markus Makela
2015-05-26 15:12:29 +03:00
parent 5f49a62724
commit 4cbcc4ecb6
8 changed files with 37 additions and 35 deletions

View File

@ -233,19 +233,19 @@ if(PACKAGE)
endif() endif()
add_custom_target(buildtests add_custom_target(buildtests
COMMAND ${CMAKE_COMMAND} -DDEPS_OK=Y -DBUILD_TESTS=Y -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DWITH_SCRIPTS=N ${CMAKE_SOURCE_DIR} COMMAND ${CMAKE_COMMAND} -DBUILD_TESTS=Y -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DWITH_SCRIPTS=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 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DWITH_SCRIPTS=N ${CMAKE_SOURCE_DIR} -DMAXSCALE_VARDIR=${CMAKE_BINARY_DIR} COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -DBUILD_TESTS=Y -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DWITH_SCRIPTS=N -DMAXSCALE_VARDIR=${CMAKE_BINARY_DIR}
COMMAND make install COMMAND make install
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/testall.cmake COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/testall.cmake
COMMENT "Running full test suite..." VERBATIM) COMMENT "Running full test suite..." VERBATIM)
add_custom_target(testcore add_custom_target(testcore
COMMAND ${CMAKE_COMMAND} -DDEPS_OK=Y -DBUILD_TESTS=Y -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DWITH_SCRIPTS=N ${CMAKE_SOURCE_DIR} -DMAXSCALE_VARDIR=${CMAKE_BINARY_DIR} COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -DBUILD_TESTS=Y -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DWITH_SCRIPTS=N -DMAXSCALE_VARDIR=${CMAKE_BINARY_DIR}
COMMAND make install COMMAND make install
COMMAND ctest -R Internal COMMAND ctest -R Internal
COMMENT "Running core test suite..." VERBATIM) COMMENT "Running core test suite..." VERBATIM)
@ -276,7 +276,7 @@ endif()
# Testall target with Valgrind # Testall target with Valgrind
if(VALGRIND_FOUND) if(VALGRIND_FOUND)
add_custom_target(testall-valgrind add_custom_target(testall-valgrind
COMMAND ${CMAKE_COMMAND} -DDEPS_OK=Y -DBUILD_TESTS=Y -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DWITH_SCRIPTS=N ${CMAKE_SOURCE_DIR} COMMAND ${CMAKE_COMMAND} -DBUILD_TESTS=Y -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DWITH_SCRIPTS=N ${CMAKE_SOURCE_DIR}
COMMAND make install 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 ${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 "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"

View File

@ -133,6 +133,14 @@ Configure the directory MaxScale uses to store cached data. An example of cached
cachedir=/tmp/maxscale_cache/ cachedir=/tmp/maxscale_cache/
``` ```
#### `piddir`
Configure the directory for the PID file for MaxScale. This file contains the Process ID for the running MaxScale process.
```
piddir=/tmp/maxscale_cache/
```
#### `language` #### `language`
Set the folder where the errmsg.sys file is located in. MaxScale will look for the errmsg.sys file installed with MaxScale from this folder. Set the folder where the errmsg.sys file is located in. MaxScale will look for the errmsg.sys file installed with MaxScale from this folder.

View File

@ -36,6 +36,8 @@ Switch|Long Option|Description
`-C PATH`|`--configdir=PATH`|path to configuration file directory (default: /etc/) `-C PATH`|`--configdir=PATH`|path to configuration file directory (default: /etc/)
`-B PATH`|`--libdir=PATH`|path to module directory (default: /usr/lib64/maxscale) `-B PATH`|`--libdir=PATH`|path to module directory (default: /usr/lib64/maxscale)
`-A PATH`|`--cachedir=PATH`|path to cache directory (default: /var/cache/maxscale) `-A PATH`|`--cachedir=PATH`|path to cache directory (default: /var/cache/maxscale)
`P PATH`|`--piddir=PATH`|PID file directory
`-U USER`|`--user=USER`|run MaxScale as another user. The user ID and group ID of this user are used to run MaxScale.
`-s [yes no]`|`--syslog=[yes no]`|log messages to syslog (default:yes) `-s [yes no]`|`--syslog=[yes no]`|log messages to syslog (default:yes)
`-S [yes no]`|`--maxscalelog=[yes no]`|log messages to MaxScale log (default: yes) `-S [yes no]`|`--maxscalelog=[yes no]`|log messages to MaxScale log (default: yes)
`-v`|`--version`|print version info and exit `-v`|`--version`|print version info and exit

View File

@ -132,29 +132,9 @@ macro(check_deps)
endif() endif()
# set(MAXSCALE_DEPS aio ssl crypt crypto z m dl rt pthread)
# foreach(lib ${MAXSCALE_DEPS})
# find_library(lib${lib} ${lib})
# if((DEFINED lib${lib}) AND (${lib${lib}} MATCHES "NOTFOUND"))
# set(DEPS_ERROR TRUE)
# set(FAILED_DEPS "${FAILED_DEPS} lib${lib}")
# elseif(DEBUG_OUTPUT)
# message(STATUS "Library was found at: ${lib${lib}}")
# endif()
# endforeach()
# if(DEPS_ERROR)
# set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.")
# message(FATAL_ERROR "Cannot find dependencies: ${FAILED_DEPS}")
# endif()
endmacro() endmacro()
macro(check_dirs) macro(check_dirs)
# This variable is used to prevent redundant checking of dependencies
set(DEPS_OK TRUE CACHE BOOL "If all the dependencies were found.")
# Find the MySQL headers if they were not defined # Find the MySQL headers if they were not defined
if(DEFINED MYSQL_DIR) if(DEFINED MYSQL_DIR)
@ -168,7 +148,6 @@ macro(check_dirs)
debugmsg("Search returned: ${MYSQL_DIR_LOC}") debugmsg("Search returned: ${MYSQL_DIR_LOC}")
if(${MYSQL_DIR_LOC} MATCHES "NOTFOUND") if(${MYSQL_DIR_LOC} MATCHES "NOTFOUND")
set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.")
message(FATAL_ERROR "Fatal Error: MySQL headers were not found.") message(FATAL_ERROR "Fatal Error: MySQL headers were not found.")
else() else()
set(MYSQL_DIR ${MYSQL_DIR_LOC} CACHE PATH "Path to MySQL headers" FORCE) set(MYSQL_DIR ${MYSQL_DIR_LOC} CACHE PATH "Path to MySQL headers" FORCE)
@ -193,7 +172,6 @@ debugmsg("Search returned: ${MYSQL_DIR_LOC}")
else() else()
find_file(ERRMSG_FILE errmsg.sys PATHS /usr/share /usr/share/mysql /usr/local/share/mysql PATH_SUFFIXES english mysql/english) find_file(ERRMSG_FILE errmsg.sys PATHS /usr/share /usr/share/mysql /usr/local/share/mysql PATH_SUFFIXES english mysql/english)
if(${ERRMSG_FILE} MATCHES "NOTFOUND") if(${ERRMSG_FILE} MATCHES "NOTFOUND")
set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.")
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found, please define the path to it by using -DERRMSG=<path>") message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found, please define the path to it by using -DERRMSG=<path>")
else() else()
message(STATUS "Using errmsg.sys found at: ${ERRMSG_FILE}") message(STATUS "Using errmsg.sys found at: ${ERRMSG_FILE}")
@ -208,7 +186,6 @@ debugmsg("Search returned: ${MYSQL_DIR_LOC}")
if(${RPM_FNC} MATCHES "RPM_FNC-NOTFOUND") if(${RPM_FNC} MATCHES "RPM_FNC-NOTFOUND")
find_file(DEB_FNC init-functions PATHS /lib/lsb) find_file(DEB_FNC init-functions PATHS /lib/lsb)
if(${DEB_FNC} MATCHES "DEB_FNC-NOTFOUND") if(${DEB_FNC} MATCHES "DEB_FNC-NOTFOUND")
set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.")
message(FATAL_ERROR "Cannot find required init-functions in /lib/lsb/ or /etc/rc.d/init.d/, please confirm that your system files are OK.") message(FATAL_ERROR "Cannot find required init-functions in /lib/lsb/ or /etc/rc.d/init.d/, please confirm that your system files are OK.")
else() else()
set(DEB_BASED TRUE CACHE BOOL "If init.d script uses /lib/lsb/init-functions instead of /etc/rc.d/init.d/functions.") set(DEB_BASED TRUE CACHE BOOL "If init.d script uses /lib/lsb/init-functions instead of /etc/rc.d/init.d/functions.")

View File

@ -154,6 +154,7 @@ static struct option long_options[] = {
{"logdir", required_argument, 0, 'L'}, {"logdir", required_argument, 0, 'L'},
{"datadir", required_argument, 0, 'D'}, {"datadir", required_argument, 0, 'D'},
{"configdir",required_argument, 0, 'C'}, {"configdir",required_argument, 0, 'C'},
{"piddir",required_argument, 0, 'P'},
{"libdir",required_argument, 0, 'B'}, {"libdir",required_argument, 0, 'B'},
{"cachedir",required_argument, 0, 'A'}, {"cachedir",required_argument, 0, 'A'},
{"language",required_argument, 0, 'N'}, {"language",required_argument, 0, 'N'},
@ -870,6 +871,8 @@ static void usage(void)
" (default: /etc/)\n" " (default: /etc/)\n"
" -D, --datadir=PATH path to data directory, stored embedded mysql tables\n" " -D, --datadir=PATH path to data directory, stored embedded mysql tables\n"
" (default: /var/cache/maxscale)\n" " (default: /var/cache/maxscale)\n"
" -P, --piddir=PATH path to PID file directory\n"
" (default: /var/run/maxscale)\n"
" -U, --user=USER run MaxScale as another user.\n" " -U, --user=USER run MaxScale as another user.\n"
" The user ID and group ID of this user are used to run MaxScale.\n" " The user ID and group ID of this user are used to run MaxScale.\n"
" -s, --syslog=[yes|no] log messages to syslog (default:yes)\n" " -s, --syslog=[yes|no] log messages to syslog (default:yes)\n"
@ -976,7 +979,7 @@ int main(int argc, char **argv)
} }
} }
while ((opt = getopt_long(argc, argv, "dc:f:l:vs:S:?L:D:C:B:U:A:", while ((opt = getopt_long(argc, argv, "dc:f:l:vs:S:?L:D:C:B:U:A:P:",
long_options, &option_index)) != -1) long_options, &option_index)) != -1)
{ {
bool succp = true; bool succp = true;
@ -1045,6 +1048,12 @@ int main(int argc, char **argv)
langdir = tmp_path; langdir = tmp_path;
} }
break; break;
case 'P':
if(handle_path_arg(&tmp_path,optarg,NULL,true,true))
{
piddir = tmp_path;
}
break;
case 'D': case 'D':
sprintf(datadir,"%s",optarg); sprintf(datadir,"%s",optarg);
maxscaledatadir = strdup(optarg); maxscaledatadir = strdup(optarg);
@ -1821,7 +1830,7 @@ static int write_pid_file(char *home_dir) {
int fd = -1; int fd = -1;
snprintf(pidfile, PATH_MAX, "%smaxscale.pid",default_piddir); snprintf(pidfile, PATH_MAX, "%smaxscale.pid",piddir?piddir:default_piddir);
fd = open(pidfile, O_WRONLY | O_CREAT | O_TRUNC, 0777); fd = open(pidfile, O_WRONLY | O_CREAT | O_TRUNC, 0777);
if (fd == -1) { if (fd == -1) {
@ -1920,6 +1929,11 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
if(libdir == NULL) if(libdir == NULL)
handle_path_arg(&libdir,(char*)value,NULL,true,false); handle_path_arg(&libdir,(char*)value,NULL,true,false);
} }
else if(strcmp(name, "piddir") == 0)
{
if(piddir == NULL)
handle_path_arg(&piddir,(char*)value,NULL,true,true);
}
else if(strcmp(name, "datadir") == 0) else if(strcmp(name, "datadir") == 0)
{ {
if(!datadir_defined) if(!datadir_defined)

View File

@ -37,7 +37,7 @@ static char* libdir = NULL;
static char* cachedir = NULL; static char* cachedir = NULL;
static char* maxscaledatadir = NULL; static char* maxscaledatadir = NULL;
static char* langdir = NULL; static char* langdir = NULL;
static char* piddir = NULL;
char* get_libdir(); char* get_libdir();
char* get_datadir(); char* get_datadir();
char* get_cachedir(); char* get_cachedir();

View File

@ -17,8 +17,8 @@ function execute_test()
return 1 return 1
fi fi
LAST_LOG=$(ls $BINDIR/log -1|grep err|sort|uniq|tail -n 1) LAST_LOG=$(ls $BINDIR/ -1|grep error|sort|uniq|tail -n 1)
TEST_RESULT=$(cat $BINDIR/log/$LAST_LOG | grep -i recursive) TEST_RESULT=$(cat $BINDIR/$LAST_LOG | grep -i recursive)
if [[ "$TEST_RESULT" != "" ]] if [[ "$TEST_RESULT" != "" ]]
then then
return 0 return 0

View File

@ -1,10 +1,11 @@
[maxscale] [maxscale]
threads=4 threads=4
libdir=@CMAKE_INSTALL_PREFIX@/@MAXSCALE_LIBDIR@ libdir=@CMAKE_INSTALL_PREFIX@/@MAXSCALE_LIBDIR@
logdir=@CMAKE_INSTALL_PREFIX@/log logdir=@CMAKE_INSTALL_PREFIX@/
datadir=@CMAKE_INSTALL_PREFIX@/data datadir=@CMAKE_INSTALL_PREFIX@/
cachedir=@CMAKE_INSTALL_PREFIX@/cache cachedir=@CMAKE_INSTALL_PREFIX@/
language=@CMAKE_INSTALL_PREFIX@/lib/maxscale/ language=@CMAKE_INSTALL_PREFIX@/lib/maxscale/
piddir=@CMAKE_INSTALL_PREFIX@/
[feedback] [feedback]
feedback_enable=true feedback_enable=true