Add make check
and document testing procedure.
Also support test target in cmake.
This commit is contained in:
parent
2c0d6e3304
commit
d6c7923d16
@ -138,4 +138,5 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmosquittopp.pc" DESTINATION "${PKG
|
||||
# ========================================
|
||||
# Testing
|
||||
# ========================================
|
||||
add_custom_target(Tests COMMAND make -C ${mosquitto_SOURCE_DIR}/test test)
|
||||
enable_testing()
|
||||
add_test("test" make -C ${mosquitto_SOURCE_DIR}/test test)
|
||||
|
@ -7,6 +7,9 @@ Broker:
|
||||
Clients:
|
||||
- Fix compilation on non glibc systems due to missing sys/time.h header.
|
||||
|
||||
Build:
|
||||
- Add `make check` target and document testing procedure. Closes #1230.
|
||||
|
||||
|
||||
1.6 - 20190417
|
||||
==============
|
||||
|
4
Makefile
4
Makefile
@ -4,7 +4,7 @@ DIRS=lib client src
|
||||
DOCDIRS=man
|
||||
DISTDIRS=man
|
||||
|
||||
.PHONY : all mosquitto api docs binary clean reallyclean test install uninstall dist sign copy
|
||||
.PHONY : all mosquitto api docs binary check clean reallyclean test install uninstall dist sign copy
|
||||
|
||||
all : $(MAKE_ALL)
|
||||
|
||||
@ -36,6 +36,8 @@ reallyclean :
|
||||
$(MAKE) -C test reallyclean
|
||||
-rm -f *.orig
|
||||
|
||||
check : test
|
||||
|
||||
test : mosquitto
|
||||
$(MAKE) -C test test
|
||||
|
||||
|
30
readme-tests.md
Normal file
30
readme-tests.md
Normal file
@ -0,0 +1,30 @@
|
||||
# Tests
|
||||
|
||||
## Running
|
||||
|
||||
The Mosquitto test suite can be invoked using either of
|
||||
|
||||
```
|
||||
make test
|
||||
make check
|
||||
```
|
||||
|
||||
The tests run in series and due to the nature of some of the tests being made
|
||||
can take a while.
|
||||
|
||||
## Parallel Tests
|
||||
|
||||
To run the tests with some parallelism, use
|
||||
|
||||
```
|
||||
make ptest
|
||||
```
|
||||
|
||||
This runs up to 20 tests in parallel at once, yielding much faster overall run
|
||||
time at the expense of having up to 20 instances of Python running at once.
|
||||
This is not a particularly CPU intensive option, but does require more memory
|
||||
and may be unsuitable on e.g. a Raspberry Pi.
|
||||
|
||||
## Dependencies
|
||||
|
||||
The tests require Python 3 and CUnit to be installed.
|
@ -1,9 +1,11 @@
|
||||
include ../config.mk
|
||||
|
||||
.PHONY: all test ptest clean
|
||||
.PHONY: all check test ptest clean
|
||||
|
||||
all :
|
||||
|
||||
check : test
|
||||
|
||||
test : utest
|
||||
$(MAKE) -C broker test
|
||||
$(MAKE) -C lib test
|
||||
|
@ -1,10 +1,12 @@
|
||||
include ../../config.mk
|
||||
|
||||
.PHONY: all clean test ptest
|
||||
.PHONY: all check clean test ptest
|
||||
.NOTPARALLEL:
|
||||
|
||||
all :
|
||||
|
||||
check : test
|
||||
|
||||
clean :
|
||||
-rm -f *.vglog *.db
|
||||
$(MAKE) -C c clean
|
||||
|
@ -1,12 +1,14 @@
|
||||
include ../../config.mk
|
||||
|
||||
.PHONY: all test test-compile test-compile-c test-compile-cpp c cpp
|
||||
.PHONY: all check test test-compile test-compile-c test-compile-cpp c cpp
|
||||
.NOTPARALLEL:
|
||||
|
||||
LD_LIBRARY_PATH=../../lib
|
||||
|
||||
all :
|
||||
|
||||
check : test
|
||||
|
||||
ptest : test-compile
|
||||
./test.py
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
include ../../config.mk
|
||||
|
||||
.PHONY: all test test-broker test-lib clean coverage
|
||||
.PHONY: all check test test-broker test-lib clean coverage
|
||||
|
||||
CFLAGS=-I../.. -I../../lib -I../../src -I../../src/deps -coverage -Wall -ggdb
|
||||
TEST_LDFLAGS=-lcunit -coverage
|
||||
@ -56,6 +56,7 @@ PERSIST_WRITE_OBJS = \
|
||||
|
||||
all : test
|
||||
|
||||
check : test
|
||||
|
||||
mosq_test : ${TEST_OBJS} ${LIB_OBJS}
|
||||
$(CROSS_COMPILE)$(CC) -o $@ $^ ${TEST_LDFLAGS}
|
||||
|
Loading…
Reference in New Issue
Block a user