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:
VilhoRaatikka
2014-02-07 11:06:37 +02:00
parent 0a13bf9989
commit e8ce2268e0
17 changed files with 763 additions and 228 deletions

65
test/README Normal file
View 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
View 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)