Test system for MaxScale.
Every test/makefile have the following targets: cleantests - clean local and subdirectories' tests buildtests - build all local and subdirectories' tests runtests - run all local tests testall - clean, build and run local and subdirectories' tests Tests for directory random_dir are always in its subdirectory, in this case in random_dir/test . If random_dir has subdirectories with tests, random_dir/child_dir, for example, tests of child_dir can be started from random_dir/test/makefile where make -C child_dir/test <test target> is called. See MAXSCALE_HOME/test/README for further information.
This commit is contained in:
30
Makefile
30
Makefile
@ -18,8 +18,23 @@
|
|||||||
# Date Who Description
|
# Date Who Description
|
||||||
# 16/07/13 Mark Riddoch Initial implementation
|
# 16/07/13 Mark Riddoch Initial implementation
|
||||||
|
|
||||||
|
include build_gateway.inc
|
||||||
|
|
||||||
DEST=$(HOME)/usr/local/skysql
|
DEST=$(HOME)/usr/local/skysql
|
||||||
|
|
||||||
|
#
|
||||||
|
# A special build of MaxScale is done for tests.
|
||||||
|
# HAVE_SRV carries information whether test MaxScale server
|
||||||
|
# is built already or not.
|
||||||
|
# HAVE_SRV == Y when test server is built,
|
||||||
|
# HAVE_SRV == N when not.
|
||||||
|
# It prevents unnecessary recompilation and also clean-up
|
||||||
|
# in the middle of the test.
|
||||||
|
#
|
||||||
|
HAVE_SRV := N
|
||||||
|
|
||||||
|
.PHONY: buildtestserver
|
||||||
|
|
||||||
all:
|
all:
|
||||||
(cd log_manager; make)
|
(cd log_manager; make)
|
||||||
(cd query_classifier; make)
|
(cd query_classifier; make)
|
||||||
@ -40,5 +55,20 @@ install:
|
|||||||
(cd log_manager; make DEST=$(DEST) install)
|
(cd log_manager; make DEST=$(DEST) install)
|
||||||
(cd query_classifier; make DEST=$(DEST) install)
|
(cd query_classifier; make DEST=$(DEST) install)
|
||||||
|
|
||||||
|
cleantests:
|
||||||
|
$(MAKE) -C test cleantests
|
||||||
|
|
||||||
|
buildtests:
|
||||||
|
$(MAKE) -C test buildtests
|
||||||
|
|
||||||
|
testall:
|
||||||
|
$(MAKE) -C test HAVE_SRV=$(HAVE_SRV) testall
|
||||||
|
|
||||||
|
buildtestserver:
|
||||||
|
$(MAKE) DEBUG=Y DYNLIB=Y DEST=$(ROOT_PATH)/server/test clean depend all install
|
||||||
|
$(eval HAVE_SRV := Y)
|
||||||
|
|
||||||
documentation:
|
documentation:
|
||||||
doxygen doxygate
|
doxygen doxygate
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,14 +4,14 @@ include ../makefile.inc
|
|||||||
CC = gcc
|
CC = gcc
|
||||||
CPP = g++
|
CPP = g++
|
||||||
|
|
||||||
SRCS = log_manager.cc
|
SRCS := log_manager.cc
|
||||||
|
UTILS_PATH := $(ROOT_PATH)/utils
|
||||||
LOG_WRITER_PATH := $(shell pwd)
|
CUR_DIR := $(shell pwd)
|
||||||
|
|
||||||
makeall: clean all
|
makeall: clean all
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
make -C ../utils clean
|
$(MAKE) -C $(UTILS_PATH) clean
|
||||||
- $(DEL) *.o
|
- $(DEL) *.o
|
||||||
- $(DEL) *.so
|
- $(DEL) *.so
|
||||||
- $(DEL) *.so.1.0.1
|
- $(DEL) *.so.1.0.1
|
||||||
@ -20,16 +20,16 @@ clean:
|
|||||||
|
|
||||||
all: utils lib
|
all: utils lib
|
||||||
|
|
||||||
|
|
||||||
utils:
|
utils:
|
||||||
make -C $(ROOT_PATH)/utils clean all
|
$(MAKE) -C $(UTILS_PATH) clean all
|
||||||
$(COPY) $(ROOT_PATH)/utils/skygw_utils.o ./
|
|
||||||
|
|
||||||
lib: libcomp liblink
|
lib: libcomp liblink
|
||||||
|
|
||||||
libcomp:
|
libcomp:
|
||||||
$(CPP) -c $(CFLAGS) \
|
$(CPP) -c $(CFLAGS) \
|
||||||
$(MYSQL_HEADERS) \
|
$(MYSQL_HEADERS) \
|
||||||
-I../utils/ -I./ \
|
-I$(UTILS_PATH) -I./ \
|
||||||
-fPIC ./log_manager.cc -o log_manager.o $(LDLIBS)
|
-fPIC ./log_manager.cc -o log_manager.o $(LDLIBS)
|
||||||
|
|
||||||
liblink:
|
liblink:
|
||||||
@ -47,7 +47,21 @@ depend:
|
|||||||
@rm -f depend
|
@rm -f depend
|
||||||
$(CPP) -M $(CFLAGS) \
|
$(CPP) -M $(CFLAGS) \
|
||||||
$(MYSQL_HEADERS) \
|
$(MYSQL_HEADERS) \
|
||||||
-I../utils/ -I./ \
|
-I$(UTILS_PATH) -I./ \
|
||||||
$(SRCS) > depend
|
$(SRCS) > depend
|
||||||
|
|
||||||
|
cleantests:
|
||||||
|
$(MAKE) -C test cleantests
|
||||||
|
|
||||||
|
buildtests:
|
||||||
|
$(MAKE) -C test DEBUG=Y buildtests
|
||||||
|
|
||||||
|
runtests:
|
||||||
|
$(MAKE) -C test runtests
|
||||||
|
|
||||||
|
testall:
|
||||||
|
$(MAKE) -C test testall
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
include depend
|
include depend
|
||||||
|
@ -1,35 +1,64 @@
|
|||||||
|
# cleantests - clean local and subdirectories' tests
|
||||||
|
# buildtests - build all local and subdirectories' tests
|
||||||
|
# runtests - run all local tests
|
||||||
|
# testall - clean, build and run local and subdirectories' tests
|
||||||
|
|
||||||
include ../../build_gateway.inc
|
include ../../build_gateway.inc
|
||||||
include ../../makefile.inc
|
include ../../makefile.inc
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CPP = g++
|
CPP = g++
|
||||||
|
|
||||||
TESTPATH := $(shell pwd)
|
TESTPATH := $(shell pwd)
|
||||||
LOG_MANAGER_PATH := $(ROOT_PATH)/log_manager
|
TESTLOG := $(TESTPATH)/testlog.log
|
||||||
TESTAPP = $(TESTPATH)/testlog
|
LOG_MANAGER_PATH:= $(ROOT_PATH)/log_manager
|
||||||
|
TESTAPP := $(TESTPATH)/testlog
|
||||||
|
UTILS_PATH := $(ROOT_PATH)/utils
|
||||||
|
|
||||||
runtest: makeall testall
|
# Use two threads by default
|
||||||
|
ifndef NTHR
|
||||||
|
NTHR=2
|
||||||
|
endif
|
||||||
|
|
||||||
makeall: clean all
|
testall:
|
||||||
|
$(MAKE) cleantests
|
||||||
|
$(MAKE) DEBUG=Y buildtests
|
||||||
|
$(MAKE) runtests
|
||||||
|
|
||||||
clean:
|
cleantests:
|
||||||
- $(DEL) *.o
|
- $(DEL) *.o
|
||||||
- $(DEL) testlog
|
- $(DEL) testlog
|
||||||
- $(DEL) *~
|
- $(DEL) *~
|
||||||
|
|
||||||
all: testcomp testall
|
buildtests:
|
||||||
|
|
||||||
testcomp:
|
|
||||||
$(CC) $(CFLAGS) \
|
$(CC) $(CFLAGS) \
|
||||||
-L$(LOG_MANAGER_PATH) \
|
-L$(LOG_MANAGER_PATH) \
|
||||||
-Wl,-rpath,$(DEST)/lib \
|
-Wl,-rpath,$(DEST)/lib \
|
||||||
-Wl,-rpath,$(LOG_MANAGER_PATH)/ \
|
-Wl,-rpath,$(LOG_MANAGER_PATH)/ \
|
||||||
-o testlog \
|
-o testlog \
|
||||||
-I$(MARIADB_SRC_PATH)/include \
|
-I$(MARIADB_SRC_PATH)/include \
|
||||||
-I$(LOG_MANAGER_PATH) -I$(ROOT_PATH)/utils testlog.c \
|
-I$(LOG_MANAGER_PATH) -I$(UTILS_PATH) testlog.c \
|
||||||
-llog_manager $(LDLIBS) \
|
-llog_manager $(LDLIBS) \
|
||||||
$(LOG_MANAGER_PATH)/skygw_utils.o \
|
$(UTILS_PATH)/skygw_utils.o
|
||||||
|
|
||||||
|
|
||||||
testall:
|
runtests:
|
||||||
- $(LAUNCH_DEBUGGER) $(TESTAPP) $(BACKGR)
|
@echo "" >> $(TESTLOG)
|
||||||
|
@echo "-------------------------------" >> $(TESTLOG)
|
||||||
|
@echo $(shell date) >> $(TESTLOG)
|
||||||
|
@echo "Test Log Manager" >> $(TESTLOG)
|
||||||
|
@echo "-------------------------------" >> $(TESTLOG)
|
||||||
|
@echo "" >> $(TESTLOG)
|
||||||
|
@echo "Use 1 thread" >> $(TESTLOG)
|
||||||
|
@echo "" >> $(TESTLOG)
|
||||||
|
@-$(LAUNCH_DEBUGGER) $(TESTAPP) "-t 1" 2>>$(TESTLOG)
|
||||||
|
@echo "" >> $(TESTLOG)
|
||||||
|
@echo "Use 8 threads" >> $(TESTLOG)
|
||||||
|
@echo "" >> $(TESTLOG)
|
||||||
|
@-$(LAUNCH_DEBUGGER) $(TESTAPP) "-t 8" 2>>$(TESTLOG)
|
||||||
|
@echo "" >> $(TESTLOG)
|
||||||
|
@echo "Use 16 threads" >> $(TESTLOG)
|
||||||
|
@echo "" >> $(TESTLOG)
|
||||||
|
@-$(LAUNCH_DEBUGGER) $(TESTAPP) "-t 16" 2>>$(TESTLOG)
|
||||||
|
@echo "Log Manager PASSED" >> $(TESTLOG)
|
||||||
|
@echo "" >> $(TESTLOG)
|
||||||
|
@ -37,7 +37,7 @@ typedef struct thread_st {
|
|||||||
static void* thr_run(void* data);
|
static void* thr_run(void* data);
|
||||||
static void* thr_run_morelog(void* data);
|
static void* thr_run_morelog(void* data);
|
||||||
|
|
||||||
#define NTHR 256
|
#define MAX_NTHR 256
|
||||||
#define NITER 100
|
#define NITER 100
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
@ -57,22 +57,56 @@ int main(int argc, char* argv[])
|
|||||||
char* logstr;
|
char* logstr;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
bool r;
|
bool succp;
|
||||||
skygw_message_t* mes;
|
skygw_message_t* mes;
|
||||||
simple_mutex_t* mtx;
|
simple_mutex_t* mtx;
|
||||||
size_t nactive;
|
size_t nactive;
|
||||||
thread_t* thr[NTHR];
|
thread_t** thr = NULL;
|
||||||
time_t t;
|
time_t t;
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
|
char c;
|
||||||
|
int nthr = 0;
|
||||||
|
int log_argc = 0;
|
||||||
|
char** log_argv = NULL;
|
||||||
|
|
||||||
|
while ((c = getopt(argc, argv, "t:")) != -1)
|
||||||
|
{
|
||||||
|
switch (c) {
|
||||||
|
case 't':
|
||||||
|
nthr = atoi(optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nthr <= 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Thread count argument is zero or "
|
||||||
|
"negative. Exiting.\n");
|
||||||
|
err = 1;
|
||||||
|
goto return_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
thr = (thread_t*)calloc(1, nthr*sizeof(thread_t*));
|
||||||
|
|
||||||
|
if (thr == NULL)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Failed to allocate memory for thread "
|
||||||
|
"structure. Exiting.\n");
|
||||||
|
err = 1;
|
||||||
|
goto return_err;
|
||||||
|
|
||||||
|
}
|
||||||
i = atexit(skygw_logmanager_exit);
|
i = atexit(skygw_logmanager_exit);
|
||||||
|
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
fprintf(stderr, "Couldn't register exit function.\n");
|
fprintf(stderr, "Couldn't register exit function.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
r = skygw_logmanager_init( argc, argv);
|
succp = skygw_logmanager_init( log_argc, log_argv);
|
||||||
ss_dassert(r);
|
ss_dassert(succp);
|
||||||
|
|
||||||
t = time(NULL);
|
t = time(NULL);
|
||||||
tm = *(localtime(&t));
|
tm = *(localtime(&t));
|
||||||
@ -85,7 +119,7 @@ int main(int argc, char* argv[])
|
|||||||
tm.tm_min,
|
tm.tm_min,
|
||||||
tm.tm_sec);
|
tm.tm_sec);
|
||||||
|
|
||||||
skygw_logmanager_init( argc, argv);
|
skygw_logmanager_init( log_argc, log_argv);
|
||||||
logstr = ("First write with flush.");
|
logstr = ("First write with flush.");
|
||||||
err = skygw_log_write_flush(LOGFILE_ERROR, logstr);
|
err = skygw_log_write_flush(LOGFILE_ERROR, logstr);
|
||||||
|
|
||||||
@ -133,7 +167,7 @@ int main(int argc, char* argv[])
|
|||||||
logstr = "Ph%dlip.";
|
logstr = "Ph%dlip.";
|
||||||
err = skygw_log_write(LOGFILE_TRACE, logstr, 1);
|
err = skygw_log_write(LOGFILE_TRACE, logstr, 1);
|
||||||
|
|
||||||
skygw_logmanager_init( argc, argv);
|
skygw_logmanager_init( log_argc, log_argv);
|
||||||
logstr = ("A terrible error has occurred!");
|
logstr = ("A terrible error has occurred!");
|
||||||
err = skygw_log_write_flush(LOGFILE_ERROR, logstr);
|
err = skygw_log_write_flush(LOGFILE_ERROR, logstr);
|
||||||
|
|
||||||
@ -159,40 +193,40 @@ int main(int argc, char* argv[])
|
|||||||
fprintf(stderr, "\nStarting test #1 \n");
|
fprintf(stderr, "\nStarting test #1 \n");
|
||||||
|
|
||||||
/** 1 */
|
/** 1 */
|
||||||
for (i=0; i<NTHR; i++) {
|
for (i=0; i<nthr; i++) {
|
||||||
thr[i] = (thread_t*)calloc(1, sizeof(thread_t));
|
thr[i] = (thread_t*)calloc(1, sizeof(thread_t));
|
||||||
thr[i]->mes = mes;
|
thr[i]->mes = mes;
|
||||||
thr[i]->mtx = mtx;
|
thr[i]->mtx = mtx;
|
||||||
thr[i]->nactive = &nactive;
|
thr[i]->nactive = &nactive;
|
||||||
}
|
}
|
||||||
nactive = NTHR;
|
nactive = nthr;
|
||||||
|
|
||||||
for (i=0; i<NTHR; i++) {
|
for (i=0; i<nthr; i++) {
|
||||||
pthread_t p;
|
pthread_t p;
|
||||||
pthread_create(&p, NULL, thr_run, thr[i]);
|
pthread_create(&p, NULL, thr_run, thr[i]);
|
||||||
thr[i]->tid = p;
|
thr[i]->tid = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
skygw_message_wait(mes);
|
skygw_message_wait(mes);
|
||||||
simple_mutex_lock(mtx, true);
|
simple_mutex_lock(mtx, true);
|
||||||
if (nactive > 0) {
|
if (nactive > 0) {
|
||||||
simple_mutex_unlock(mtx);
|
simple_mutex_unlock(mtx);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} while(true);
|
} while(true);
|
||||||
|
|
||||||
for (i=0; i<NTHR; i++) {
|
for (i=0; i<nthr; i++) {
|
||||||
pthread_join(thr[i]->tid, NULL);
|
pthread_join(thr[i]->tid, NULL);
|
||||||
}
|
}
|
||||||
/** This is to release memory */
|
/** This is to release memory */
|
||||||
skygw_logmanager_done();
|
skygw_logmanager_done();
|
||||||
|
|
||||||
simple_mutex_unlock(mtx);
|
simple_mutex_unlock(mtx);
|
||||||
|
|
||||||
for (i=0; i<NTHR; i++) {
|
for (i=0; i<nthr; i++) {
|
||||||
free(thr[i]);
|
free(thr[i]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -201,23 +235,23 @@ int main(int argc, char* argv[])
|
|||||||
fprintf(stderr, "\nStarting test #2 \n");
|
fprintf(stderr, "\nStarting test #2 \n");
|
||||||
|
|
||||||
/** 2 */
|
/** 2 */
|
||||||
for (i=0; i<NTHR; i++) {
|
for (i=0; i<nthr; i++) {
|
||||||
thr[i] = (thread_t*)calloc(1, sizeof(thread_t));
|
thr[i] = (thread_t*)calloc(1, sizeof(thread_t));
|
||||||
thr[i]->mes = mes;
|
thr[i]->mes = mes;
|
||||||
thr[i]->mtx = mtx;
|
thr[i]->mtx = mtx;
|
||||||
thr[i]->nactive = &nactive;
|
thr[i]->nactive = &nactive;
|
||||||
}
|
}
|
||||||
nactive = NTHR;
|
nactive = nthr;
|
||||||
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\nLaunching %d threads, each iterating %d times.",
|
"\nLaunching %d threads, each iterating %d times.",
|
||||||
NTHR,
|
nthr,
|
||||||
NITER);
|
NITER);
|
||||||
|
|
||||||
for (i=0; i<NTHR; i++) {
|
for (i=0; i<nthr; i++) {
|
||||||
pthread_t p;
|
pthread_t p;
|
||||||
pthread_create(&p, NULL, thr_run_morelog, thr[i]);
|
pthread_create(&p, NULL, thr_run_morelog, thr[i]);
|
||||||
thr[i]->tid = p;
|
thr[i]->tid = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, ".. done");
|
fprintf(stderr, ".. done");
|
||||||
@ -225,17 +259,17 @@ int main(int argc, char* argv[])
|
|||||||
fprintf(stderr, "\nStarting to wait threads.\n");
|
fprintf(stderr, "\nStarting to wait threads.\n");
|
||||||
|
|
||||||
do {
|
do {
|
||||||
skygw_message_wait(mes);
|
skygw_message_wait(mes);
|
||||||
simple_mutex_lock(mtx, true);
|
simple_mutex_lock(mtx, true);
|
||||||
if (nactive > 0) {
|
if (nactive > 0) {
|
||||||
simple_mutex_unlock(mtx);
|
simple_mutex_unlock(mtx);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} while(true);
|
} while(true);
|
||||||
|
|
||||||
for (i=0; i<NTHR; i++) {
|
for (i=0; i<nthr; i++) {
|
||||||
pthread_join(thr[i]->tid, NULL);
|
pthread_join(thr[i]->tid, NULL);
|
||||||
}
|
}
|
||||||
/** This is to release memory */
|
/** This is to release memory */
|
||||||
skygw_logmanager_done();
|
skygw_logmanager_done();
|
||||||
@ -244,8 +278,8 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
fprintf(stderr, "\nFreeing thread memory.");
|
fprintf(stderr, "\nFreeing thread memory.");
|
||||||
|
|
||||||
for (i=0; i<NTHR; i++) {
|
for (i=0; i<nthr; i++) {
|
||||||
free(thr[i]);
|
free(thr[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Test ended here */
|
/** Test ended here */
|
||||||
@ -265,8 +299,8 @@ int main(int argc, char* argv[])
|
|||||||
err = skygw_log_write(LOGFILE_ERROR, logstr);
|
err = skygw_log_write(LOGFILE_ERROR, logstr);
|
||||||
ss_dassert(err == 0);
|
ss_dassert(err == 0);
|
||||||
|
|
||||||
r = skygw_logmanager_init(argc, argv);
|
succp = skygw_logmanager_init(log_argc, log_argv);
|
||||||
ss_dassert(r);
|
ss_dassert(succp);
|
||||||
|
|
||||||
skygw_log_disable(LOGFILE_TRACE);
|
skygw_log_disable(LOGFILE_TRACE);
|
||||||
|
|
||||||
@ -326,8 +360,8 @@ int main(int argc, char* argv[])
|
|||||||
#endif /* TEST 3 */
|
#endif /* TEST 3 */
|
||||||
|
|
||||||
#if defined(TEST4)
|
#if defined(TEST4)
|
||||||
r = skygw_logmanager_init(argc, argv);
|
succp = skygw_logmanager_init(log_argc, log_argv);
|
||||||
ss_dassert(r);
|
ss_dassert(succp);
|
||||||
#if !defined(SS_DEBUG)
|
#if !defined(SS_DEBUG)
|
||||||
skygw_log_enable(LOGFILE_TRACE);
|
skygw_log_enable(LOGFILE_TRACE);
|
||||||
#endif
|
#endif
|
||||||
@ -361,8 +395,8 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
skygw_logmanager_done();
|
skygw_logmanager_done();
|
||||||
|
|
||||||
r = skygw_logmanager_init(argc, argv);
|
succp = skygw_logmanager_init(log_argc, log_argv);
|
||||||
ss_dassert(r);
|
ss_dassert(succp);
|
||||||
#if !defined(SS_DEBUG)
|
#if !defined(SS_DEBUG)
|
||||||
skygw_log_enable(LOGFILE_TRACE);
|
skygw_log_enable(LOGFILE_TRACE);
|
||||||
#endif
|
#endif
|
||||||
@ -421,6 +455,11 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
#endif /* TEST 4 */
|
#endif /* TEST 4 */
|
||||||
fprintf(stderr, ".. done.\n");
|
fprintf(stderr, ".. done.\n");
|
||||||
|
return_err:
|
||||||
|
if (thr != NULL)
|
||||||
|
{
|
||||||
|
free(thr);
|
||||||
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,18 +565,18 @@ static int nstr(
|
|||||||
}
|
}
|
||||||
|
|
||||||
char* logs[] = {
|
char* logs[] = {
|
||||||
"foo",
|
"foo",
|
||||||
"bar",
|
"bar",
|
||||||
"done",
|
"done",
|
||||||
"critical test logging",
|
"critical test logging",
|
||||||
"longer test l o g g g i n g",
|
"longer test l o g g g i n g",
|
||||||
"reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeally loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong line",
|
"reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeally loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong line",
|
||||||
"shoorter one",
|
"shoorter one",
|
||||||
"two",
|
"two",
|
||||||
"scrap : 834nuft984pnw8ynup4598yp8wup8upwn48t5gpn45",
|
"scrap : 834nuft984pnw8ynup4598yp8wup8upwn48t5gpn45",
|
||||||
"more the same : f98uft5p8ut2p44449upnt5",
|
"more the same : f98uft5p8ut2p44449upnt5",
|
||||||
"asdasd987987asdasd987987asdasd987987asdasd987987asdasd987987asdasd987987asdasd987987asdasd98987",
|
"asdasd987987asdasd987987asdasd987987asdasd987987asdasd987987asdasd987987asdasd987987asdasd98987",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -554,11 +593,11 @@ static void* thr_run_morelog(
|
|||||||
nmsg = nstr(logs);
|
nmsg = nstr(logs);
|
||||||
|
|
||||||
for (i=0; i<NITER; i++) {
|
for (i=0; i<NITER; i++) {
|
||||||
char* str = logs[rand()%nmsg];
|
char* str = logs[rand()%nmsg];
|
||||||
err = skygw_log_write((logfile_id_t)(rand()%(LOGFILE_LAST+1)),
|
err = skygw_log_write((logfile_id_t)(rand()%(LOGFILE_LAST+1)),
|
||||||
"%s - iteration # %d",
|
"%s - iteration # %d",
|
||||||
str,
|
str,
|
||||||
i);
|
i);
|
||||||
}
|
}
|
||||||
simple_mutex_lock(td->mtx, true);
|
simple_mutex_lock(td->mtx, true);
|
||||||
*td->nactive -= 1;
|
*td->nactive -= 1;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
DEL := rm -f
|
DEL := rm -fr
|
||||||
LINK := ln -s
|
LINK := ln -s
|
||||||
COPY := cp
|
COPY := cp
|
||||||
NOHUP := nohup
|
NOHUP := nohup
|
||||||
|
@ -4,33 +4,45 @@ include ../makefile.inc
|
|||||||
CC = gcc
|
CC = gcc
|
||||||
CPP = g++
|
CPP = g++
|
||||||
|
|
||||||
SRCS = query_classifier.cc
|
SRCS := query_classifier.cc
|
||||||
|
UTILS_PATH := $(ROOT_PATH)/utils
|
||||||
QUERY_CLASSIFIER_PATH := $(shell pwd)
|
QUERY_CLASSIFIER_PATH := $(ROOT_PATH)/query_classifier
|
||||||
|
LOG_MANAGER_PATH := $(ROOT_PATH)/log_manager
|
||||||
|
|
||||||
makeall: clean all
|
makeall: clean all
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
make -C ../utils clean
|
$(MAKE) -C $(UTILS_PATH) clean
|
||||||
- $(DEL) query_classifier.o
|
- $(DEL) query_classifier.o
|
||||||
- $(DEL) libquery_classifier.so
|
- $(DEL) libquery_classifier.so
|
||||||
- $(DEL) libquery_classifier.so.1.0.1
|
- $(DEL) libquery_classifier.so.1.0.1
|
||||||
- $(DEL) skygw_utils.o
|
|
||||||
- $(DEL) *~
|
- $(DEL) *~
|
||||||
- $(DEL) depend
|
- $(DEL) depend
|
||||||
|
|
||||||
all: utils lib
|
all: utils lib
|
||||||
|
|
||||||
|
cleantests:
|
||||||
|
$(MAKE) -C test cleantests
|
||||||
|
|
||||||
|
buildtests:
|
||||||
|
$(MAKE) -C test DEBUG=Y DYNLIB=Y buildtests
|
||||||
|
|
||||||
|
runtests:
|
||||||
|
$(MAKE) -C test runtests
|
||||||
|
|
||||||
|
testall:
|
||||||
|
$(MAKE) -C test testall
|
||||||
|
|
||||||
|
|
||||||
utils:
|
utils:
|
||||||
make -C $(ROOT_PATH)/utils clean all
|
$(MAKE) -C $(UTILS_PATH) clean all
|
||||||
$(COPY) $(ROOT_PATH)/utils/skygw_utils.o ./
|
|
||||||
|
|
||||||
lib: libcomp liblink
|
lib: libcomp liblink
|
||||||
|
|
||||||
libcomp:
|
libcomp:
|
||||||
$(CPP) -c $(CFLAGS) \
|
$(CPP) -c $(CFLAGS) \
|
||||||
$(MYSQL_HEADERS) \
|
$(MYSQL_HEADERS) \
|
||||||
-I$(ROOT_PATH)/log_manager/ \
|
-I$(LOG_MANAGER_PATH) \
|
||||||
-I./ \
|
-I./ \
|
||||||
-fPIC ./query_classifier.cc -o query_classifier.o
|
-fPIC ./query_classifier.cc -o query_classifier.o
|
||||||
|
|
||||||
@ -53,7 +65,7 @@ depend:
|
|||||||
@rm -f depend
|
@rm -f depend
|
||||||
$(CPP) -M $(CFLAGS) \
|
$(CPP) -M $(CFLAGS) \
|
||||||
$(MYSQL_HEADERS) \
|
$(MYSQL_HEADERS) \
|
||||||
-I$(ROOT_PATH)/log_manager/ \
|
-I$(LOG_MANAGER_PATH) \
|
||||||
-I./ \
|
-I./ \
|
||||||
$(SRCS) > depend
|
$(SRCS) > depend
|
||||||
|
|
||||||
|
@ -1,36 +1,61 @@
|
|||||||
|
# cleantests - clean local and subdirectories' tests
|
||||||
|
# buildtests - build all local and subdirectories' tests
|
||||||
|
# runtests - run all local tests
|
||||||
|
# testall - clean, build and run local and subdirectories' tests
|
||||||
|
|
||||||
include ../../build_gateway.inc
|
include ../../build_gateway.inc
|
||||||
include ../../makefile.inc
|
include ../../makefile.inc
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CPP = g++
|
CPP = g++
|
||||||
|
|
||||||
TESTPATH := $(shell pwd)
|
TESTPATH := $(shell pwd)
|
||||||
QUERY_CLASSIFIER_PATH := $(ROOT_PATH)/query_classifier/
|
TESTLOG := $(TESTPATH)/testqclass.log
|
||||||
|
QUERY_CLASSIFIER_PATH := $(ROOT_PATH)/query_classifier
|
||||||
|
LOG_MANAGER_PATH := $(ROOT_PATH)/log_manager
|
||||||
|
UTILS_PATH := $(ROOT_PATH)/utils
|
||||||
TESTAPP = $(TESTPATH)/testmain
|
TESTAPP = $(TESTPATH)/testmain
|
||||||
|
|
||||||
runtest: makeall testall
|
testall:
|
||||||
|
$(MAKE) cleantests
|
||||||
|
$(MAKE) DEBUG=Y DYNLIB=Y buildtests
|
||||||
|
$(MAKE) runtests
|
||||||
|
|
||||||
makeall: clean all
|
cleantests:
|
||||||
|
|
||||||
clean:
|
|
||||||
- $(DEL) testmain.o
|
- $(DEL) testmain.o
|
||||||
- $(DEL) testmain
|
- $(DEL) testmain
|
||||||
|
- $(DEL) data
|
||||||
- $(DEL) *~
|
- $(DEL) *~
|
||||||
|
|
||||||
all: testcomp testall
|
buildtests:
|
||||||
|
|
||||||
testcomp:
|
|
||||||
$(CC) $(CFLAGS) \
|
$(CC) $(CFLAGS) \
|
||||||
-L$(QUERY_CLASSIFIER_PATH) \
|
-L$(QUERY_CLASSIFIER_PATH) \
|
||||||
-L$(MARIADB_SRC_PATH)/libmysqld \
|
-L$(LOG_MANAGER_PATH) \
|
||||||
|
-L$(EMBEDDED_LIB) \
|
||||||
-Wl,-rpath,$(DEST)/lib \
|
-Wl,-rpath,$(DEST)/lib \
|
||||||
-Wl,-rpath,$(MARIADB_SRC_PATH)/libmysqld \
|
-Wl,-rpath,$(EMBEDDED_LIB) \
|
||||||
-Wl,-rpath,$(QUERY_CLASSIFIER_PATH)/ \
|
-Wl,-rpath,$(LOG_MANAGER_PATH) \
|
||||||
|
-Wl,-rpath,$(QUERY_CLASSIFIER_PATH) \
|
||||||
-o testmain -DSS_DEBUG \
|
-o testmain -DSS_DEBUG \
|
||||||
-I$(MARIADB_SRC_PATH)/include testmain.c \
|
$(MYSQL_HEADERS) \
|
||||||
-lquery_classifier $(LDLIBS) $(LDMYSQL) \
|
-I$(QUERY_CLASSIFIER_PATH) \
|
||||||
$(QUERY_CLASSIFIER_PATH)/skygw_utils.o
|
-I./ \
|
||||||
|
-I$(UTILS_PATH) \
|
||||||
|
testmain.c \
|
||||||
|
$(UTILS_PATH)/skygw_utils.o \
|
||||||
|
-lquery_classifier -lz -ldl -lssl -laio -lcrypt \
|
||||||
|
-llog_manager \
|
||||||
|
$(LDLIBS) $(LDMYSQL)
|
||||||
|
|
||||||
|
runtests:
|
||||||
testall:
|
@echo "" >> $(TESTLOG)
|
||||||
- $(LAUNCH_DEBUGGER) $(TESTAPP) $(BACKGR)
|
@echo "-------------------------------" >> $(TESTLOG)
|
||||||
|
@echo $(shell date) >> $(TESTLOG)
|
||||||
|
@echo "Test Query Classifier" >> $(TESTLOG)
|
||||||
|
@echo "-------------------------------" >> $(TESTLOG)
|
||||||
|
@ -$(LAUNCH_DEBUGGER) $(TESTAPP) $(BACKGR) 2>> $(TESTLOG)
|
||||||
|
ifeq ($?, 0)
|
||||||
|
@echo "Query Classifier PASSED" >> $(TESTLOG)
|
||||||
|
else
|
||||||
|
@echo "Query Classifier FAILED" >> $(TESTLOG)
|
||||||
|
endif
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -5,27 +7,25 @@
|
|||||||
#include <mysql.h>
|
#include <mysql.h>
|
||||||
|
|
||||||
#include "../../utils/skygw_utils.h"
|
#include "../../utils/skygw_utils.h"
|
||||||
//#include "skygw_debug.h"
|
|
||||||
//#include "skygw_types.h"
|
|
||||||
#include "../query_classifier.h"
|
#include "../query_classifier.h"
|
||||||
|
|
||||||
static char datadir[1024] = "";
|
static char datadir[1024] = "";
|
||||||
static char mysqldir[1024] = "";
|
static char mysqldir[1024] = "";
|
||||||
|
|
||||||
static char* server_options[] = {
|
static char* server_options[] = {
|
||||||
"SkySQL Gateway",
|
"SkySQL Gateway",
|
||||||
"--datadir=",
|
"--datadir=",
|
||||||
"--default-storage-engine=myisam",
|
"--default-storage-engine=myisam",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
const int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;
|
const int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;
|
||||||
|
|
||||||
static char* server_groups[] = {
|
static char* server_groups[] = {
|
||||||
"embedded",
|
"embedded",
|
||||||
"server",
|
"server",
|
||||||
"server",
|
"server",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static void slcursor_add_case(
|
static void slcursor_add_case(
|
||||||
@ -117,12 +117,12 @@ int main(int argc, char** argv)
|
|||||||
slist_cursor_t* c;
|
slist_cursor_t* c;
|
||||||
const char* q;
|
const char* q;
|
||||||
query_test_t* qtest;
|
query_test_t* qtest;
|
||||||
skygw_query_type_t qtype;
|
|
||||||
bool succp;
|
bool succp;
|
||||||
bool failp = true;
|
bool failp = true;
|
||||||
unsigned int f = 0;
|
unsigned int f = 0;
|
||||||
int nsucc = 0;
|
int nsucc = 0;
|
||||||
int nfail = 0;
|
int nfail = 0;
|
||||||
|
int rc = 0;
|
||||||
MYSQL* mysql;
|
MYSQL* mysql;
|
||||||
char* workingdir;
|
char* workingdir;
|
||||||
char ddoption[1024];
|
char ddoption[1024];
|
||||||
@ -178,7 +178,7 @@ int main(int argc, char** argv)
|
|||||||
query_test_init(q, QUERY_TYPE_READ, false, true));
|
query_test_init(q, QUERY_TYPE_READ, false, true));
|
||||||
|
|
||||||
q = "select tt1.id, tt2.id from t1 tt1, t2 tt2 where tt1.name is "
|
q = "select tt1.id, tt2.id from t1 tt1, t2 tt2 where tt1.name is "
|
||||||
"not null and tt2.name is not null";
|
"not null and tt2.name is not null";
|
||||||
slcursor_add_case(
|
slcursor_add_case(
|
||||||
c,
|
c,
|
||||||
query_test_init(q, QUERY_TYPE_READ, false, false));
|
query_test_init(q, QUERY_TYPE_READ, false, false));
|
||||||
@ -227,15 +227,15 @@ int main(int argc, char** argv)
|
|||||||
query_test_init(q, QUERY_TYPE_SESSION_WRITE, false, false));
|
query_test_init(q, QUERY_TYPE_SESSION_WRITE, false, false));
|
||||||
|
|
||||||
q = "select * from table1 "
|
q = "select * from table1 "
|
||||||
"where table1.field IN "
|
"where table1.field IN "
|
||||||
"(select * from table1a union select * from table1b) union "
|
"(select * from table1a union select * from table1b) union "
|
||||||
"select * from table2 where table2.field = "
|
"select * from table2 where table2.field = "
|
||||||
"(select (select f1 from table2a where table2a.f2 = table2b.f3) "
|
"(select (select f1 from table2a where table2a.f2 = table2b.f3) "
|
||||||
"from table2b where table2b.f1 = table2.f2) union "
|
"from table2b where table2b.f1 = table2.f2) union "
|
||||||
"select * from table3";
|
"select * from table3";
|
||||||
slcursor_add_case(
|
slcursor_add_case(
|
||||||
c,
|
c,
|
||||||
query_test_init(q, QUERY_TYPE_READ, false, true));
|
query_test_init(q, QUERY_TYPE_READ, false, true));
|
||||||
|
|
||||||
/** RENAME TABLEs */
|
/** RENAME TABLEs */
|
||||||
q = "RENAME TABLE T1 to T2";
|
q = "RENAME TABLE T1 to T2";
|
||||||
@ -293,7 +293,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
/** Object creation statements */
|
/** Object creation statements */
|
||||||
q = "create procedure si (out param1 int) \nbegin select count(*) "
|
q = "create procedure si (out param1 int) \nbegin select count(*) "
|
||||||
"into param1 from t1; \nend";
|
"into param1 from t1; \nend";
|
||||||
slcursor_add_case(
|
slcursor_add_case(
|
||||||
c,
|
c,
|
||||||
query_test_init(q, QUERY_TYPE_WRITE, false, true));
|
query_test_init(q, QUERY_TYPE_WRITE, false, true));
|
||||||
@ -334,7 +334,7 @@ int main(int argc, char** argv)
|
|||||||
query_test_init(q, QUERY_TYPE_WRITE, false, true));
|
query_test_init(q, QUERY_TYPE_WRITE, false, true));
|
||||||
|
|
||||||
q = "SELECT NOW();CREATE TABLE T1 (ID INTEGER);"
|
q = "SELECT NOW();CREATE TABLE T1 (ID INTEGER);"
|
||||||
"SET sql_log_bin=0;CREATE TABLE T2 (ID INTEGER)";
|
"SET sql_log_bin=0;CREATE TABLE T2 (ID INTEGER)";
|
||||||
slcursor_add_case(
|
slcursor_add_case(
|
||||||
c,
|
c,
|
||||||
query_test_init(q, QUERY_TYPE_WRITE, false, true));
|
query_test_init(q, QUERY_TYPE_WRITE, false, true));
|
||||||
@ -342,7 +342,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
/** Setting database makes this SESSION_WRITE */
|
/** Setting database makes this SESSION_WRITE */
|
||||||
q = "USE TEST;CREATE TABLE T1 (ID INTEGER);"
|
q = "USE TEST;CREATE TABLE T1 (ID INTEGER);"
|
||||||
"SET sql_log_bin=0;CREATE TABLE T2 (ID INTEGER)";
|
"SET sql_log_bin=0;CREATE TABLE T2 (ID INTEGER)";
|
||||||
slcursor_add_case(
|
slcursor_add_case(
|
||||||
c,
|
c,
|
||||||
query_test_init(q, QUERY_TYPE_SESSION_WRITE, false, true));
|
query_test_init(q, QUERY_TYPE_SESSION_WRITE, false, true));
|
||||||
@ -356,13 +356,13 @@ int main(int argc, char** argv)
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Failed to resolve the working directory, $PWD is not "
|
"Failed to resolve the working directory, $PWD is not "
|
||||||
"set.\n");
|
"set.\n");
|
||||||
goto return_without_server;
|
ss_dassert(workingdir != NULL);
|
||||||
} else if (access(workingdir, R_OK) != 0) {
|
} else if (access(workingdir, R_OK) != 0) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Failed to access the working directory due %d, %s\n",
|
"Failed to access the working directory due %d, %s\n",
|
||||||
errno,
|
errno,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
goto return_without_server;
|
ss_dassert(false);
|
||||||
} else {
|
} else {
|
||||||
char** so = server_options;
|
char** so = server_options;
|
||||||
snprintf(datadir, 1023, "%s/data", workingdir);
|
snprintf(datadir, 1023, "%s/data", workingdir);
|
||||||
@ -373,7 +373,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
if (*so == NULL) {
|
if (*so == NULL) {
|
||||||
fprintf(stderr, "Failed to find datadir option.\n");
|
fprintf(stderr, "Failed to find datadir option.\n");
|
||||||
goto return_without_server;
|
ss_dassert(*so != NULL);
|
||||||
}
|
}
|
||||||
*so = ddoption;
|
*so = ddoption;
|
||||||
|
|
||||||
@ -383,13 +383,13 @@ int main(int argc, char** argv)
|
|||||||
failp = mysql_library_init(num_elements, server_options, server_groups);
|
failp = mysql_library_init(num_elements, server_options, server_groups);
|
||||||
|
|
||||||
if (failp) {
|
if (failp) {
|
||||||
MYSQL* mysql = mysql_init(NULL);
|
MYSQL* mysql = mysql_init(NULL);
|
||||||
ss_dassert(mysql != NULL);
|
ss_dassert(mysql != NULL);
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"mysql_init failed, %d : %s\n",
|
"mysql_init failed, %d : %s\n",
|
||||||
mysql_errno(mysql),
|
mysql_errno(mysql),
|
||||||
mysql_error(mysql));
|
mysql_error(mysql));
|
||||||
goto return_without_server;
|
ss_dassert(!failp);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@ -402,10 +402,10 @@ int main(int argc, char** argv)
|
|||||||
succp = slcursor_move_to_begin(c);
|
succp = slcursor_move_to_begin(c);
|
||||||
|
|
||||||
while(succp) {
|
while(succp) {
|
||||||
qtest = slcursor_get_case(c);
|
qtest = slcursor_get_case(c);
|
||||||
qtest->qt_result_type =
|
qtest->qt_result_type =
|
||||||
skygw_query_classifier_get_type(qtest->qt_query_str, f);
|
skygw_query_classifier_get_type(qtest->qt_query_str, f);
|
||||||
succp = slcursor_step_ahead(c);
|
succp = slcursor_step_ahead(c);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Scan through test results and compare them against expected
|
* Scan through test results and compare them against expected
|
||||||
@ -415,23 +415,23 @@ int main(int argc, char** argv)
|
|||||||
fprintf(stderr, "\nScanning through the results :\n\n");
|
fprintf(stderr, "\nScanning through the results :\n\n");
|
||||||
|
|
||||||
while(succp) {
|
while(succp) {
|
||||||
qtest = slcursor_get_case(c);
|
qtest = slcursor_get_case(c);
|
||||||
|
|
||||||
if (!query_test_types_match(qtest)) {
|
if (!query_test_types_match(qtest)) {
|
||||||
nfail += 1;
|
nfail += 1;
|
||||||
ss_dfprintf(stderr,
|
ss_dfprintf(stderr,
|
||||||
"* Failed: \"%s\" -> %s (Expected %s)\n",
|
"* Failed: \"%s\" -> %s (Expected %s)\n",
|
||||||
query_test_get_querystr(qtest),
|
query_test_get_querystr(qtest),
|
||||||
STRQTYPE(query_test_get_result_type(qtest)),
|
STRQTYPE(query_test_get_result_type(qtest)),
|
||||||
STRQTYPE(query_test_get_query_type(qtest)));
|
STRQTYPE(query_test_get_query_type(qtest)));
|
||||||
} else {
|
} else {
|
||||||
nsucc += 1;
|
nsucc += 1;
|
||||||
ss_dfprintf(stderr,
|
ss_dfprintf(stderr,
|
||||||
"Succeed\t: \"%s\" -> %s\n",
|
"Succeed\t: \"%s\" -> %s\n",
|
||||||
query_test_get_querystr(qtest),
|
query_test_get_querystr(qtest),
|
||||||
STRQTYPE(query_test_get_query_type(qtest)));
|
STRQTYPE(query_test_get_query_type(qtest)));
|
||||||
}
|
}
|
||||||
succp = slcursor_step_ahead(c);
|
succp = slcursor_step_ahead(c);
|
||||||
}
|
}
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"------------------------------------------\n"
|
"------------------------------------------\n"
|
||||||
@ -448,8 +448,8 @@ int main(int argc, char** argv)
|
|||||||
mysql = mysql_init(NULL);
|
mysql = mysql_init(NULL);
|
||||||
|
|
||||||
if (mysql == NULL) {
|
if (mysql == NULL) {
|
||||||
fprintf(stderr, "mysql_init failed\n");
|
fprintf(stderr, "mysql_init failed\n");
|
||||||
goto return_without_server;
|
ss_dassert(mysql != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
mysql_options(mysql,
|
mysql_options(mysql,
|
||||||
@ -468,50 +468,50 @@ int main(int argc, char** argv)
|
|||||||
CLIENT_MULTI_STATEMENTS);
|
CLIENT_MULTI_STATEMENTS);
|
||||||
|
|
||||||
if (mysql == NULL) {
|
if (mysql == NULL) {
|
||||||
fprintf(stderr, "mysql_real_connect failed\n");
|
fprintf(stderr, "mysql_real_connect failed\n");
|
||||||
goto return_with_handle;
|
ss_dassert(mysql != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\nRe-execution of selected cases in Embedded server :\n\n");
|
"\nRe-execution of selected cases in Embedded server :\n\n");
|
||||||
|
|
||||||
while(succp) {
|
while(succp) {
|
||||||
qtest = slcursor_get_case(c);
|
qtest = slcursor_get_case(c);
|
||||||
|
|
||||||
if (query_test_exec_also_in_server(qtest)) {
|
if (query_test_exec_also_in_server(qtest)) {
|
||||||
MYSQL_RES* results;
|
MYSQL_RES* results;
|
||||||
MYSQL_ROW record;
|
MYSQL_ROW record;
|
||||||
const char* query_str;
|
const char* query_str;
|
||||||
|
|
||||||
query_str = query_test_get_querystr(qtest);
|
query_str = query_test_get_querystr(qtest);
|
||||||
failp = mysql_query(mysql, query_str);
|
failp = mysql_query(mysql, query_str);
|
||||||
|
|
||||||
if (failp) {
|
if (failp) {
|
||||||
ss_dfprintf(stderr,
|
ss_dfprintf(stderr,
|
||||||
"* Failed: \"%s\" -> %d : %s\n",
|
"* Failed: \"%s\" -> %d : %s\n",
|
||||||
query_str,
|
query_str,
|
||||||
mysql_errno(mysql),
|
mysql_errno(mysql),
|
||||||
mysql_error(mysql));
|
mysql_error(mysql));
|
||||||
} else {
|
} else {
|
||||||
ss_dfprintf(stderr,
|
ss_dfprintf(stderr,
|
||||||
"Succeed\t: \"%s\"\n",
|
"Succeed\t: \"%s\"\n",
|
||||||
query_str);
|
query_str);
|
||||||
results = mysql_store_result(mysql);
|
results = mysql_store_result(mysql);
|
||||||
|
|
||||||
if (results != NULL) {
|
if (results != NULL) {
|
||||||
|
|
||||||
while((record = mysql_fetch_row(results))) {
|
while((record = mysql_fetch_row(results))) {
|
||||||
while(record != NULL && *record != NULL) {
|
while(record != NULL && *record != NULL) {
|
||||||
ss_dfprintf(stderr, "%s ", *record);
|
ss_dfprintf(stderr, "%s ", *record);
|
||||||
record++;
|
record++;
|
||||||
}
|
}
|
||||||
ss_dfprintf(stderr, "\n");
|
ss_dfprintf(stderr, "\n");
|
||||||
|
}
|
||||||
|
mysql_free_result(results);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mysql_free_result(results);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
succp = slcursor_step_ahead(c);
|
||||||
succp = slcursor_step_ahead(c);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
slist_done(c);
|
slist_done(c);
|
||||||
@ -525,5 +525,5 @@ return_with_handle:
|
|||||||
return_without_server:
|
return_without_server:
|
||||||
ss_dfprintf(stderr, "\n<< testmain\n");
|
ss_dfprintf(stderr, "\n<< testmain\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
return 0;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,15 @@ all:
|
|||||||
(cd modules/protocol; touch depend.mk ;make)
|
(cd modules/protocol; touch depend.mk ;make)
|
||||||
(cd modules/monitor; touch depend.mk ;make)
|
(cd modules/monitor; touch depend.mk ;make)
|
||||||
|
|
||||||
|
cleantests:
|
||||||
|
$(MAKE) -C test cleantests
|
||||||
|
|
||||||
|
buildtests:
|
||||||
|
$(MAKE) -C test HAVE_SRV=$(HAVE_SRV) buildtests
|
||||||
|
|
||||||
|
testall:
|
||||||
|
$(MAKE) -C test HAVE_SRV=$(HAVE_SRV) testall
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
(cd Documentation; rm -rf html)
|
(cd Documentation; rm -rf html)
|
||||||
(cd core; touch depend.mk ; make clean)
|
(cd core; touch depend.mk ; make clean)
|
||||||
|
@ -77,6 +77,18 @@ LIBS=-L../inih/extra -linih -lssl -lstdc++ \
|
|||||||
|
|
||||||
all: maxscale maxkeys maxpasswd
|
all: maxscale maxkeys maxpasswd
|
||||||
|
|
||||||
|
cleantests:
|
||||||
|
$(MAKE) -C test cleantests
|
||||||
|
|
||||||
|
buildtests:
|
||||||
|
$(MAKE) -C test buildtests
|
||||||
|
|
||||||
|
runtests:
|
||||||
|
$(MAKE) -C test runtests
|
||||||
|
|
||||||
|
testall:
|
||||||
|
$(MAKE) -C test testall
|
||||||
|
|
||||||
maxscale: $(OBJ)
|
maxscale: $(OBJ)
|
||||||
$(CC) $(LDFLAGS) $(OBJ) $(UTILSPATH)/skygw_utils.o $(LIBS) -o $@
|
$(CC) $(LDFLAGS) $(OBJ) $(UTILSPATH)/skygw_utils.o $(LIBS) -o $@
|
||||||
|
|
||||||
|
@ -1,32 +1,44 @@
|
|||||||
|
# cleantests - clean local and subdirectories' tests
|
||||||
|
# buildtests - build all local and subdirectories' tests
|
||||||
|
# runtests - run all local tests
|
||||||
|
# testall - clean, build and run local and subdirectories' tests
|
||||||
|
|
||||||
include ../../../build_gateway.inc
|
include ../../../build_gateway.inc
|
||||||
include ../../../makefile.inc
|
include ../../../makefile.inc
|
||||||
|
|
||||||
CC=cc
|
CC=cc
|
||||||
|
TESTLOG := $(shell pwd)/testhash.log
|
||||||
|
|
||||||
clean:
|
cleantests:
|
||||||
- $(DEL) *.o
|
- $(DEL) *.o
|
||||||
- $(DEL) testhash
|
- $(DEL) testhash
|
||||||
- $(DEL) *~
|
- $(DEL) *~
|
||||||
|
|
||||||
all:
|
testall:
|
||||||
$(MAKE) clean
|
$(MAKE) cleantests
|
||||||
$(MAKE) buildall
|
$(MAKE) DEBUG=Y buildtests
|
||||||
$(MAKE) runall
|
$(MAKE) runtests
|
||||||
|
|
||||||
buildall :
|
buildtests :
|
||||||
$(CC) $(CFLAGS) \
|
$(CC) $(CFLAGS) \
|
||||||
-I$(ROOT_PATH)/server/include \
|
-I$(ROOT_PATH)/server/include \
|
||||||
-I$(ROOT_PATH)/utils \
|
-I$(ROOT_PATH)/utils \
|
||||||
testhash.c ../hashtable.o ../atomic.o ../spinlock.o -o testhash \
|
testhash.c ../hashtable.o ../atomic.o ../spinlock.o -o testhash \
|
||||||
|
|
||||||
runall:
|
runtests:
|
||||||
- @./testhash 0 1
|
@echo "" >> $(TESTLOG)
|
||||||
- @./testhash 10 1
|
@echo "-------------------------------" >> $(TESTLOG)
|
||||||
- @./testhash 1000 10
|
@echo $(shell date) >> $(TESTLOG)
|
||||||
- @./testhash 10 0
|
@echo "Test MaxScale core" >> $(TESTLOG)
|
||||||
- @./testhash 1500 17
|
@echo "-------------------------------" >> $(TESTLOG)
|
||||||
- @./testhash 1 1
|
@./testhash 0 1 2>> $(TESTLOG)
|
||||||
- @./testhash 10000 133
|
@./testhash 10 1 2>> $(TESTLOG)
|
||||||
- @./testhash 1000 1000
|
@./testhash 1000 10 2>> $(TESTLOG)
|
||||||
- @./testhash 1000 100000
|
@./testhash 10 0 2>> $(TESTLOG)
|
||||||
|
@./testhash 1500 17 2>> $(TESTLOG)
|
||||||
|
@./testhash 1 1 2>> $(TESTLOG)
|
||||||
|
@./testhash 10000 133 2>> $(TESTLOG)
|
||||||
|
@./testhash 1000 1000 2>> $(TESTLOG)
|
||||||
|
@./testhash 1000 100000 2>> $(TESTLOG)
|
||||||
|
@echo "MaxScale core PASSED" >> $(TESTLOG)
|
||||||
|
@echo "" >> $(TESTLOG)
|
||||||
|
117
server/test/MaxScale_test.cnf
Normal file
117
server/test/MaxScale_test.cnf
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
#
|
||||||
|
# Example MaxScale.cnf configuration file
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Number of server threads
|
||||||
|
# Valid options are:
|
||||||
|
# threads=<number of threads>
|
||||||
|
|
||||||
|
[maxscale]
|
||||||
|
threads=1
|
||||||
|
|
||||||
|
# Define a monitor that can be used to determine the state and role of
|
||||||
|
# the servers.
|
||||||
|
#
|
||||||
|
# Valid options are:
|
||||||
|
#
|
||||||
|
# module=<name of module to load>
|
||||||
|
# servers=<server name>,<server name>,...
|
||||||
|
# user =<user name - must have slave replication and
|
||||||
|
# slave client privileges>
|
||||||
|
# passwd=<password of the above user, plain text currently>
|
||||||
|
|
||||||
|
[MySQL Monitor]
|
||||||
|
type=monitor
|
||||||
|
module=mysqlmon
|
||||||
|
servers=server1,server2,server3
|
||||||
|
user=maxuser
|
||||||
|
passwd=maxpwd
|
||||||
|
|
||||||
|
# A series of service definition
|
||||||
|
#
|
||||||
|
# Valid options are:
|
||||||
|
#
|
||||||
|
# router=<name of router module>
|
||||||
|
# servers=<server name>,<server name>,...
|
||||||
|
# user=<User to fetch password inforamtion with>
|
||||||
|
# passwd=<Password of the user, plain text currently>
|
||||||
|
#
|
||||||
|
# Valid router modules currently are:
|
||||||
|
# readwritesplit, readconnroute and debugcli
|
||||||
|
|
||||||
|
[RW Split Router]
|
||||||
|
type=service
|
||||||
|
router=readwritesplit
|
||||||
|
servers=server1,server2,server3
|
||||||
|
user=maxuser
|
||||||
|
passwd=maxpwd
|
||||||
|
|
||||||
|
[Read Connection Router]
|
||||||
|
type=service
|
||||||
|
router=readconnroute
|
||||||
|
router_options=slave
|
||||||
|
servers=server1,server2,server3
|
||||||
|
user=maxuser
|
||||||
|
passwd=maxpwd
|
||||||
|
|
||||||
|
[HTTPD Router]
|
||||||
|
type=service
|
||||||
|
router=testroute
|
||||||
|
servers=server1,server2,server3
|
||||||
|
|
||||||
|
[Debug Interface]
|
||||||
|
type=service
|
||||||
|
router=debugcli
|
||||||
|
|
||||||
|
# Listener definitions for the services
|
||||||
|
#
|
||||||
|
# Valid options are:
|
||||||
|
#
|
||||||
|
# service=<name of service defined elsewhere>
|
||||||
|
# protocol=<name of protocol module with which to listen>
|
||||||
|
# port=<Listening port>
|
||||||
|
|
||||||
|
[RW Split Listener]
|
||||||
|
type=listener
|
||||||
|
service=RW Split Router
|
||||||
|
protocol=MySQLClient
|
||||||
|
port=4006
|
||||||
|
|
||||||
|
[Read Connection Listener]
|
||||||
|
type=listener
|
||||||
|
service=Read Connection Router
|
||||||
|
protocol=MySQLClient
|
||||||
|
port=4008
|
||||||
|
|
||||||
|
[Debug Listener]
|
||||||
|
type=listener
|
||||||
|
service=Debug Interface
|
||||||
|
protocol=telnetd
|
||||||
|
port=4442
|
||||||
|
|
||||||
|
[HTTPD Listener]
|
||||||
|
type=listener
|
||||||
|
service=HTTPD Router
|
||||||
|
protocol=HTTPD
|
||||||
|
port=6444
|
||||||
|
|
||||||
|
# Definition of the servers
|
||||||
|
|
||||||
|
[server1]
|
||||||
|
type=server
|
||||||
|
address=127.0.0.1
|
||||||
|
port=3000
|
||||||
|
protocol=MySQLBackend
|
||||||
|
|
||||||
|
[server2]
|
||||||
|
type=server
|
||||||
|
address=127.0.0.1
|
||||||
|
port=3001
|
||||||
|
protocol=MySQLBackend
|
||||||
|
|
||||||
|
[server3]
|
||||||
|
type=server
|
||||||
|
address=127.0.0.1
|
||||||
|
port=3002
|
||||||
|
protocol=MySQLBackend
|
67
server/test/makefile
Normal file
67
server/test/makefile
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# cleantests - clean local and subdirectories' tests
|
||||||
|
# buildtests - build all local and subdirectories' tests
|
||||||
|
# runtests - run all local tests
|
||||||
|
# testall - clean, build and run local and subdirectories' tests
|
||||||
|
|
||||||
|
include ../../build_gateway.inc
|
||||||
|
include ../../makefile.inc
|
||||||
|
|
||||||
|
TEST_ROOT := $(ROOT_PATH)/test
|
||||||
|
PARENT_DIR := $(ROOT_PATH)/server
|
||||||
|
CUR_DIR := $(PARENT_DIR)/test
|
||||||
|
export MAXSCALE_HOME=$(CUR_DIR)/MaxScale
|
||||||
|
|
||||||
|
CC=cc
|
||||||
|
TESTLOG := $(CUR_DIR)/testserver.log
|
||||||
|
|
||||||
|
ifndef $(HAVE_SRV)
|
||||||
|
HAVE_SRV := N
|
||||||
|
endif
|
||||||
|
|
||||||
|
cleantests:
|
||||||
|
- $(DEL) *.o
|
||||||
|
- $(DEL) *~
|
||||||
|
ifeq ($(HAVE_SRV), N)
|
||||||
|
- $(DEL) Documentation
|
||||||
|
- $(DEL) bin
|
||||||
|
- $(DEL) lib
|
||||||
|
- $(DEL) MaxScale/etc
|
||||||
|
- $(DEL) MaxScale/modules
|
||||||
|
- $(DEL) MaxScale/mysql
|
||||||
|
endif
|
||||||
|
$(MAKE) -C $(PARENT_DIR)/core cleantests
|
||||||
|
|
||||||
|
testall:
|
||||||
|
$(MAKE) HAVE_SRV=$(HAVE_SRV) cleantests
|
||||||
|
$(MAKE) HAVE_SRV=$(HAVE_SRV) buildtests
|
||||||
|
$(MAKE) runtests
|
||||||
|
@echo "" >> $(TESTLOG)
|
||||||
|
@echo "-------------------------------" >> $(TESTLOG)
|
||||||
|
@echo $(shell date) >> $(TESTLOG)
|
||||||
|
@echo "Test Server Core" >> $(TESTLOG)
|
||||||
|
$(MAKE) -C $(ROOT_PATH)/server/core testall
|
||||||
|
@echo "Query Classifier PASSED" >> $(TESTLOG)
|
||||||
|
|
||||||
|
|
||||||
|
buildtests:
|
||||||
|
ifeq ($(HAVE_SRV), Y)
|
||||||
|
@echo "Test server already built"
|
||||||
|
else
|
||||||
|
$(MAKE) -C $(ROOT_PATH) buildtestserver
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtests:
|
||||||
|
@echo "" >> $(TESTLOG)
|
||||||
|
@echo "-------------------------------" >> $(TESTLOG)
|
||||||
|
@echo $(shell date) >> $(TESTLOG)
|
||||||
|
@echo "Test MaxScale server" >> $(TESTLOG)
|
||||||
|
@echo "-------------------------------" >> $(TESTLOG)
|
||||||
|
@echo "MAXSCALE_HOME="$(MAXSCALE_HOME) >> $(TESTLOG)
|
||||||
|
cp $(CUR_DIR)/MaxScale_test.cnf $(MAXSCALE_HOME)/etc/MaxScale.cnf
|
||||||
|
bin/maxscale 2>> $(TESTLOG)
|
||||||
|
@echo "Put your tests here"
|
||||||
|
@sleep 5
|
||||||
|
@echo "MaxScale server PASSED" >> $(TESTLOG)
|
||||||
|
@echo "" >> $(TESTLOG)
|
||||||
|
@killall maxscale
|
||||||
|
|
65
test/README
Normal file
65
test/README
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
Source tree structure and test targets for make. In a given source directory,
|
||||||
|
MAXSCALE_HOME/server, for example, there is a test directory which includes
|
||||||
|
tests for that directory ('local tests') and targets for every subdirectory
|
||||||
|
of MAXSCALE_HOME/server.
|
||||||
|
|
||||||
|
In the outline below, target, such as 'cleantest' includes instructions for
|
||||||
|
executing tests or make command pointing to subdirectories. If target is
|
||||||
|
followed by colon and a list of directory names ('cleantest:log_manager,
|
||||||
|
query_classifier'), the target is executed locally and in the listed
|
||||||
|
directories.
|
||||||
|
|
||||||
|
Note : add new tests for any component as close to the actual implementation
|
||||||
|
as possible. For example, DCB tests in MAXSCALE_HOME/server/core/test instead
|
||||||
|
of MAXSCALE_HOME/server/test etc.
|
||||||
|
|
||||||
|
MAXSCALE_HOME
|
||||||
|
|
|
||||||
|
|- log_manager cleantests, buildtests, runtests, testall
|
||||||
|
| |
|
||||||
|
| |- test cleantests, buildtests, runtests, testall
|
||||||
|
|
|
||||||
|
|- query_classifier cleantests, buildtests, runtests, testall
|
||||||
|
| |
|
||||||
|
| |- test cleantests, buildtests, runtests, testall
|
||||||
|
|
|
||||||
|
|- server cleantests, buildtests, testall
|
||||||
|
| |
|
||||||
|
| |- core cleantests, buildtests, runtests, testall
|
||||||
|
| | |
|
||||||
|
| | |- test cleantests, buildtests, runtests, testall
|
||||||
|
| |
|
||||||
|
| |- inih
|
||||||
|
| | |
|
||||||
|
| | |- test
|
||||||
|
| |
|
||||||
|
| |- modules
|
||||||
|
| | |
|
||||||
|
| | |- monitor
|
||||||
|
| | |
|
||||||
|
| | |- protocol
|
||||||
|
| | |
|
||||||
|
| | |- routing
|
||||||
|
| | | |
|
||||||
|
| | | |- readwritesplit
|
||||||
|
| |
|
||||||
|
| |- test cleantests:server/core,
|
||||||
|
| | buildtests,
|
||||||
|
| | runtests,
|
||||||
|
| | testall:server/core
|
||||||
|
|
|
||||||
|
|- test cleantests:log_manager, query_classifier, server, utils
|
||||||
|
buildtests:buildtestserver, log_manager, query_classifier, server, utils
|
||||||
|
runtests:<empty>
|
||||||
|
testall:cleantests,
|
||||||
|
buildtests,
|
||||||
|
runtests,
|
||||||
|
log_manager,
|
||||||
|
query_classifier,
|
||||||
|
server,
|
||||||
|
utils
|
||||||
|
|
|
||||||
|
|- utils cleantests, buildtests, runtests, testall
|
||||||
|
| |
|
||||||
|
| |- test cleantests, buildtests, runtests, testall
|
||||||
|
|
|
63
test/makefile
Normal file
63
test/makefile
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# cleantests - clean local and subdirectories' tests
|
||||||
|
# buildtests - build all local and subdirectories' tests
|
||||||
|
# runtests - run all local tests
|
||||||
|
# testall - clean, build and run local and subdirectories' tests
|
||||||
|
|
||||||
|
include ../build_gateway.inc
|
||||||
|
include ../makefile.inc
|
||||||
|
|
||||||
|
export MAXSCALE_HOME=$(shell pwd)/MaxScale
|
||||||
|
|
||||||
|
CC=cc
|
||||||
|
TESTLOG := $(shell pwd)/testmaxscale.log
|
||||||
|
|
||||||
|
testall:
|
||||||
|
$(MAKE) cleantests
|
||||||
|
$(MAKE) buildtests
|
||||||
|
$(MAKE) runtests
|
||||||
|
@echo "" >> $(TESTLOG)
|
||||||
|
@echo "-------------------------------" >> $(TESTLOG)
|
||||||
|
@echo $(shell date) >> $(TESTLOG)
|
||||||
|
@echo "Test Log Manager" >> $(TESTLOG)
|
||||||
|
$(MAKE) -C $(ROOT_PATH)/log_manager testall
|
||||||
|
@echo "Log Manager PASSED" >> $(TESTLOG)
|
||||||
|
@echo "" >> $(TESTLOG)
|
||||||
|
@echo "-------------------------------" >> $(TESTLOG)
|
||||||
|
@echo $(shell date) >> $(TESTLOG)
|
||||||
|
@echo "Test Query Classifier" >> $(TESTLOG)
|
||||||
|
$(MAKE) -C $(ROOT_PATH)/query_classifier testall
|
||||||
|
@echo "Query Classifier PASSED" >> $(TESTLOG)
|
||||||
|
@echo "" >> $(TESTLOG)
|
||||||
|
@echo "-------------------------------" >> $(TESTLOG)
|
||||||
|
@echo $(shell date) >> $(TESTLOG)
|
||||||
|
@echo "Test MaxScale server" >> $(TESTLOG)
|
||||||
|
$(MAKE) -C $(ROOT_PATH)/server HAVE_SRV=$(HAVE_SRV) testall
|
||||||
|
@echo "MaxScale server PASSED" >> $(TESTLOG)
|
||||||
|
@echo "" >> $(TESTLOG)
|
||||||
|
@echo "-------------------------------" >> $(TESTLOG)
|
||||||
|
@echo $(shell date) >> $(TESTLOG)
|
||||||
|
@echo "Test utils" >> $(TESTLOG)
|
||||||
|
$(MAKE) -C $(ROOT_PATH)/utils testall
|
||||||
|
@echo "Utils PASSED" >> $(TESTLOG)
|
||||||
|
|
||||||
|
cleantests:
|
||||||
|
$(DEL) *~
|
||||||
|
$(MAKE) -C $(ROOT_PATH)/log_manager cleantests
|
||||||
|
$(MAKE) -C $(ROOT_PATH)/query_classifier cleantests
|
||||||
|
$(MAKE) -C $(ROOT_PATH)/server cleantests
|
||||||
|
$(MAKE) -C $(ROOT_PATH)/utils cleantests
|
||||||
|
|
||||||
|
buildtests:
|
||||||
|
$(MAKE) -C $(ROOT_PATH) buildtestserver
|
||||||
|
$(MAKE) -C $(ROOT_PATH)/log_manager buildtests
|
||||||
|
$(MAKE) -C $(ROOT_PATH)/query_classifier buildtests
|
||||||
|
$(MAKE) -C $(ROOT_PATH)/server HAVE_SRV=$(HAVE_SRV) buildtests
|
||||||
|
$(MAKE) -C $(ROOT_PATH)/utils buildtests
|
||||||
|
|
||||||
|
runtests:
|
||||||
|
@echo "" >> $(TESTLOG)
|
||||||
|
@echo "-------------------------------" >> $(TESTLOG)
|
||||||
|
@echo $(shell date) >> $(TESTLOG)
|
||||||
|
@echo "Test MaxScale root" >> $(TESTLOG)
|
||||||
|
@echo "-------------------------------" >> $(TESTLOG)
|
||||||
|
@echo "Nothing to run here so far" >> $(TESTLOG)
|
@ -16,3 +16,14 @@ all:
|
|||||||
$(CPP) -c $(CFLAGS) \
|
$(CPP) -c $(CFLAGS) \
|
||||||
-fPIC skygw_utils.cc -o skygw_utils.o
|
-fPIC skygw_utils.cc -o skygw_utils.o
|
||||||
|
|
||||||
|
cleantests:
|
||||||
|
$(MAKE) -C test cleantests
|
||||||
|
|
||||||
|
buildtests:
|
||||||
|
$(MAKE) -C test DEBUG=Y buildtests
|
||||||
|
|
||||||
|
runtests:
|
||||||
|
$(MAKE) -C test runtests
|
||||||
|
|
||||||
|
testall:
|
||||||
|
$(MAKE) -C test testall
|
||||||
|
30
utils/test/makefile
Normal file
30
utils/test/makefile
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# cleantests - clean local and subdirectories' tests
|
||||||
|
# buildtests - build all local and subdirectories' tests
|
||||||
|
# runtests - run all local tests
|
||||||
|
# testall - clean, build and run local and subdirectories' tests
|
||||||
|
|
||||||
|
include ../../build_gateway.inc
|
||||||
|
include ../../makefile.inc
|
||||||
|
|
||||||
|
CC=cc
|
||||||
|
TESTLOG := $(shell pwd)/testutils.log
|
||||||
|
|
||||||
|
testall:
|
||||||
|
$(MAKE) cleantests
|
||||||
|
$(MAKE) buildtests
|
||||||
|
$(MAKE) runtests
|
||||||
|
@echo "No subdirectories to test" >> $(TESTLOG)
|
||||||
|
|
||||||
|
cleantests:
|
||||||
|
$(DEL) *~
|
||||||
|
|
||||||
|
buildtests:
|
||||||
|
@echo "Nothing to build here so far" >> $(TESTLOG)
|
||||||
|
|
||||||
|
runtests:
|
||||||
|
@echo "" >> $(TESTLOG)
|
||||||
|
@echo "-------------------------------" >> $(TESTLOG)
|
||||||
|
@echo $(shell date) >> $(TESTLOG)
|
||||||
|
@echo "Test Utils" >> $(TESTLOG)
|
||||||
|
@echo "-------------------------------" >> $(TESTLOG)
|
||||||
|
@echo "Nothing to run here so far" >> $(TESTLOG)
|
Reference in New Issue
Block a user