diff --git a/Makefile b/Makefile index 6251b206..168b4620 100644 --- a/Makefile +++ b/Makefile @@ -81,11 +81,13 @@ reallyclean : check : test -test-compile: +test-compile: mosquitto lib $(MAKE) -C test test-compile + $(MAKE) -C plugins test-compile -test : mosquitto +test : mosquitto lib apps $(MAKE) -C test test + $(MAKE) -C plugins test ptest : mosquitto $(MAKE) -C test ptest diff --git a/apps/db_dump/Makefile b/apps/db_dump/Makefile index ff09106a..7b9bee0f 100644 --- a/apps/db_dump/Makefile +++ b/apps/db_dump/Makefile @@ -41,7 +41,7 @@ stubs.o : stubs.c reallyclean: clean clean : - -rm -f *.o mosquitto_db_dump *.gcda *.gcno + -rm -f $(OBJS) $(BROKER_OBJS) mosquitto_db_dump *.gcda *.gcno install: diff --git a/lib/Makefile b/lib/Makefile index 6811dc9e..ea90fcff 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -101,7 +101,7 @@ uninstall : reallyclean : clean clean : - -rm -f *.o libmosquitto.so.${SOVERSION} libmosquitto.so libmosquitto.a *.gcno *.gcda + -rm -f ${MOSQ_OBJS} libmosquitto.so.${SOVERSION} libmosquitto.so libmosquitto.a *.gcno *.gcda $(MAKE) -C cpp clean libmosquitto.so.${SOVERSION} : ${MOSQ_OBJS} diff --git a/plugins/Makefile b/plugins/Makefile index 9cf8b229..47b06afa 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -3,7 +3,7 @@ DIRS= \ examples \ persist-sqlite -.PHONY : all binary check clean reallyclean test install uninstall +.PHONY : all binary check clean reallyclean test test-compile install uninstall all : set -e; for d in ${DIRS}; do $(MAKE) -C $${d}; done @@ -17,6 +17,9 @@ clean : reallyclean : set -e; for d in ${DIRS}; do $(MAKE) -C $${d} $@; done +test-compile : + set -e; for d in ${DIRS}; do $(MAKE) -C $${d} $@; done + check : test test : set -e; for d in ${DIRS}; do $(MAKE) -C $${d} $@; done diff --git a/plugins/dynamic-security/Makefile b/plugins/dynamic-security/Makefile index 84116fac..208a19fd 100644 --- a/plugins/dynamic-security/Makefile +++ b/plugins/dynamic-security/Makefile @@ -1,7 +1,7 @@ R=../.. include ${R}/config.mk -.PHONY : all binary check clean reallyclean test install uninstall +.PHONY : all binary check clean reallyclean test test-compile install uninstall PLUGIN_NAME=mosquitto_dynamic_security LOCAL_CPPFLAGS=-I${R}/lib/ -I${R}/src/ -I${R}/plugins/common -DWITH_CJSON -DWITH_TLS @@ -115,8 +115,10 @@ reallyclean : clean clean: -rm -f *.o ${PLUGIN_NAME}.so *.gcda *.gcno +test-compile: + check: test -test: +test: test-compile install: all ifeq ($(WITH_CJSON),yes) diff --git a/plugins/examples/Makefile b/plugins/examples/Makefile index 28932f5b..8882b7e7 100644 --- a/plugins/examples/Makefile +++ b/plugins/examples/Makefile @@ -16,7 +16,7 @@ DIRS= \ topic-modification \ wildcard-temp -.PHONY : all binary check clean reallyclean test install uninstall +.PHONY : all binary check clean reallyclean test test-compile install uninstall all : set -e; for d in ${DIRS}; do $(MAKE) -C $${d}; done @@ -30,8 +30,10 @@ clean : reallyclean : set -e; for d in ${DIRS}; do $(MAKE) -C $${d} $@; done +test-compile: + check : test -test : +test: test-compile set -e; for d in ${DIRS}; do $(MAKE) -C $${d} $@; done install : diff --git a/plugins/examples/client-lifetime-stats/Makefile b/plugins/examples/client-lifetime-stats/Makefile index b25d6e4c..b3a45da9 100644 --- a/plugins/examples/client-lifetime-stats/Makefile +++ b/plugins/examples/client-lifetime-stats/Makefile @@ -22,8 +22,8 @@ test: install: ${PLUGIN_NAME}.so # Don't install, these are examples only. - $(INSTALL) -d "${DESTDIR}$(libdir)" - $(INSTALL) ${STRIP_OPTS} ${PLUGIN_NAME}.so "${DESTDIR}${libdir}/${PLUGIN_NAME}.so" + #$(INSTALL) -d "${DESTDIR}$(libdir)" + #$(INSTALL) ${STRIP_OPTS} ${PLUGIN_NAME}.so "${DESTDIR}${libdir}/${PLUGIN_NAME}.so" uninstall : -rm -f "${DESTDIR}${libdir}/${PLUGIN_NAME}.so" diff --git a/plugins/persist-sqlite/Makefile b/plugins/persist-sqlite/Makefile index 8823c5ed..ecc8e8b7 100644 --- a/plugins/persist-sqlite/Makefile +++ b/plugins/persist-sqlite/Makefile @@ -1,7 +1,7 @@ R=../.. include ${R}/config.mk -.PHONY : all binary check clean reallyclean test install uninstall +.PHONY : all binary check clean reallyclean test test-compile install uninstall PLUGIN_NAME=mosquitto_persist_sqlite LOCAL_CPPFLAGS=-I${R}/src/ @@ -60,8 +60,10 @@ reallyclean : clean clean: -rm -f *.o ${PLUGIN_NAME}.so *.gcda *.gcno -check: test -test: +test-compile: + +check : test +test: test-compile install: all ifeq ($(WITH_SQLITE),yes) diff --git a/test/Makefile b/test/Makefile index de12ecdd..d7b66482 100644 --- a/test/Makefile +++ b/test/Makefile @@ -10,20 +10,21 @@ test-compile: $(MAKE) -C client test-compile $(MAKE) -C lib test-compile $(MAKE) -C unit test-compile + $(MAKE) -C apps test-compile check : test test : utest - $(MAKE) -C apps test $(MAKE) -C broker test $(MAKE) -C lib test $(MAKE) -C client test + $(MAKE) -C apps test ptest : utest - $(MAKE) -C apps ptest $(MAKE) -C broker ptest $(MAKE) -C lib ptest $(MAKE) -C client ptest + $(MAKE) -C apps ptest utest : $(MAKE) -C unit test @@ -32,4 +33,6 @@ reallyclean : clean clean : $(MAKE) -C lib clean $(MAKE) -C broker clean + $(MAKE) -C client clean $(MAKE) -C unit clean + $(MAKE) -C apps clean diff --git a/test/apps/CMakeLists.txt b/test/apps/CMakeLists.txt index 7aea0bd1..de8285f6 100644 --- a/test/apps/CMakeLists.txt +++ b/test/apps/CMakeLists.txt @@ -1,19 +1,3 @@ -file(GLOB PY_TEST_FILES [0-9][0-9]-*.py) - -set(EXCLUDE_LIST - # none -) - -foreach(PY_TEST_FILE ${PY_TEST_FILES}) - get_filename_component(PY_TEST_NAME ${PY_TEST_FILE} NAME_WE) - if(${PY_TEST_NAME} IN_LIST EXCLUDE_LIST) - continue() - endif() - add_test(NAME apps-${PY_TEST_NAME} - COMMAND ${PY_TEST_FILE} - ) - set_tests_properties(apps-${PY_TEST_NAME} - PROPERTIES - ENVIRONMENT "BUILD_ROOT=${CMAKE_BINARY_DIR}" - ) -endforeach() +add_subdirectory(ctrl) +add_subdirectory(db_dump) +add_subdirectory(passwd) diff --git a/test/apps/Makefile b/test/apps/Makefile index e2b19007..4e8d6bf8 100644 --- a/test/apps/Makefile +++ b/test/apps/Makefile @@ -7,25 +7,19 @@ include ${R}/config.mk all : check : test -ptest : test -test : 01 02 03 -01 : - ./01-db-dump-client-stats.py - ./01-db-dump-corrupt.py - ./01-db-dump-print-empty.py - ./01-db-dump-print-v6-all.py - ./01-db-dump-print-v6-mqtt-v5-props.py - ./01-db-dump-stats-current.py - ./01-db-dump-stats.py +test-compile: -02 : - ./02-ctrl-args.py - ./02-ctrl-broker.py - ./02-ctrl-dynsec.py +test : + $(MAKE) -C db_dump test + $(MAKE) -C ctrl test + $(MAKE) -C passwd test -03 : - ./03-passwd-args.py - ./03-passwd-changes.py +ptest : + $(MAKE) -C db_dump ptest + $(MAKE) -C ctrl ptest + $(MAKE) -C passwd ptest -clean: +reallyclean : clean +clean : + $(MAKE) -C db_dump clean diff --git a/test/apps/ctrl/CMakeLists.txt b/test/apps/ctrl/CMakeLists.txt new file mode 100644 index 00000000..7aea0bd1 --- /dev/null +++ b/test/apps/ctrl/CMakeLists.txt @@ -0,0 +1,19 @@ +file(GLOB PY_TEST_FILES [0-9][0-9]-*.py) + +set(EXCLUDE_LIST + # none +) + +foreach(PY_TEST_FILE ${PY_TEST_FILES}) + get_filename_component(PY_TEST_NAME ${PY_TEST_FILE} NAME_WE) + if(${PY_TEST_NAME} IN_LIST EXCLUDE_LIST) + continue() + endif() + add_test(NAME apps-${PY_TEST_NAME} + COMMAND ${PY_TEST_FILE} + ) + set_tests_properties(apps-${PY_TEST_NAME} + PROPERTIES + ENVIRONMENT "BUILD_ROOT=${CMAKE_BINARY_DIR}" + ) +endforeach() diff --git a/test/apps/ctrl/Makefile b/test/apps/ctrl/Makefile new file mode 100644 index 00000000..9ecf2c15 --- /dev/null +++ b/test/apps/ctrl/Makefile @@ -0,0 +1,19 @@ +R=../../.. +include ${R}/config.mk + +.PHONY: all check test ptest clean +.NOTPARALLEL: + +all : + +check : test + +test : + ./ctrl-args.py + ./ctrl-broker.py + ./ctrl-dynsec.py + +ptest: + ./test.py + +clean: diff --git a/test/apps/02-ctrl-args.py b/test/apps/ctrl/ctrl-args.py similarity index 100% rename from test/apps/02-ctrl-args.py rename to test/apps/ctrl/ctrl-args.py diff --git a/test/apps/02-ctrl-broker.py b/test/apps/ctrl/ctrl-broker.py similarity index 100% rename from test/apps/02-ctrl-broker.py rename to test/apps/ctrl/ctrl-broker.py diff --git a/test/apps/02-ctrl-dynsec.py b/test/apps/ctrl/ctrl-dynsec.py similarity index 100% rename from test/apps/02-ctrl-dynsec.py rename to test/apps/ctrl/ctrl-dynsec.py diff --git a/test/apps/ctrl/mosq_test_helper.py b/test/apps/ctrl/mosq_test_helper.py new file mode 100644 index 00000000..ffedfdab --- /dev/null +++ b/test/apps/ctrl/mosq_test_helper.py @@ -0,0 +1,19 @@ +import logging + +import sys +from pathlib import Path + +logging.basicConfig( + level=logging.INFO, + format="%(levelname)s %(asctime)s.%(msecs)03d %(module)s: %(message)s", + datefmt="%H:%M:%S", +) + +current_source_dir = Path(__file__).resolve().parent +test_dir = current_source_dir.parents[1] +if test_dir not in sys.path: + sys.path.insert(0, str(test_dir)) + +import mosq_test +import subprocess +import os diff --git a/test/apps/ctrl/test.py b/test/apps/ctrl/test.py new file mode 100755 index 00000000..94efe9ba --- /dev/null +++ b/test/apps/ctrl/test.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import mosq_test_helper +import pathlib +import ptest + +tests = [ + (0, './ctrl-args.py'), + (2, './ctrl-broker.py'), + (2, './ctrl-dynsec.py') +] + +ptest.run_tests(tests) diff --git a/test/apps/db_dump/CMakeLists.txt b/test/apps/db_dump/CMakeLists.txt new file mode 100644 index 00000000..7aea0bd1 --- /dev/null +++ b/test/apps/db_dump/CMakeLists.txt @@ -0,0 +1,19 @@ +file(GLOB PY_TEST_FILES [0-9][0-9]-*.py) + +set(EXCLUDE_LIST + # none +) + +foreach(PY_TEST_FILE ${PY_TEST_FILES}) + get_filename_component(PY_TEST_NAME ${PY_TEST_FILE} NAME_WE) + if(${PY_TEST_NAME} IN_LIST EXCLUDE_LIST) + continue() + endif() + add_test(NAME apps-${PY_TEST_NAME} + COMMAND ${PY_TEST_FILE} + ) + set_tests_properties(apps-${PY_TEST_NAME} + PROPERTIES + ENVIRONMENT "BUILD_ROOT=${CMAKE_BINARY_DIR}" + ) +endforeach() diff --git a/test/apps/db_dump/Makefile b/test/apps/db_dump/Makefile new file mode 100644 index 00000000..6fa3dea1 --- /dev/null +++ b/test/apps/db_dump/Makefile @@ -0,0 +1,21 @@ +.PHONY: all check test test-compile ptest clean + +all : + +check : test + +test-compile: + +test: + ./db-dump-client-stats.py + ./db-dump-corrupt.py + ./db-dump-print-empty.py + ./db-dump-print-v6-all.py + ./db-dump-print-v6-mqtt-v5-props.py + ./db-dump-stats.py + ./db-dump-stats-current.py + +ptest: + ./test.py + +clean : diff --git a/test/apps/01-db-dump-client-stats.py b/test/apps/db_dump/db-dump-client-stats.py similarity index 78% rename from test/apps/01-db-dump-client-stats.py rename to test/apps/db_dump/db-dump-client-stats.py index 42e0c2e0..e95baf27 100755 --- a/test/apps/01-db-dump-client-stats.py +++ b/test/apps/db_dump/db-dump-client-stats.py @@ -9,10 +9,11 @@ def do_test(file, counts): f"MS: {counts[3]} " + \ f" {counts[4]}\n" - cmd = [mosq_test.get_build_root()+'/apps/db_dump/mosquitto_db_dump', - '--client-stats', - f'db_dump/{file}' - ] + cmd = [ + mosq_test.get_build_root()+'/apps/db_dump/mosquitto_db_dump', + '--client-stats', + f'./{file}' + ] res = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=1, encoding='utf-8') if res.stdout != stdout: diff --git a/test/apps/01-db-dump-corrupt.py b/test/apps/db_dump/db-dump-corrupt.py similarity index 87% rename from test/apps/01-db-dump-corrupt.py rename to test/apps/db_dump/db-dump-corrupt.py index b093cf0a..f87f7c60 100755 --- a/test/apps/01-db-dump-corrupt.py +++ b/test/apps/db_dump/db-dump-corrupt.py @@ -4,9 +4,10 @@ from mosq_test_helper import * def do_test(file, stderr, rc_expected): - cmd = [mosq_test.get_build_root()+'/apps/db_dump/mosquitto_db_dump', - f'db_dump/{file}' - ] + cmd = [ + mosq_test.get_build_root()+'/apps/db_dump/mosquitto_db_dump', + f'./{file}' + ] res = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=1, encoding='utf-8') if res.stderr != stderr: @@ -17,7 +18,7 @@ def do_test(file, stderr, rc_expected): print(res.returncode) raise mosq_test.TestError -do_test('missing.test-db', "Error: Unable to open db_dump/missing.test-db\n", 0) +do_test('missing.test-db', "Error: Unable to open ./missing.test-db\n", 0) do_test('bad-magic.test-db', "Error: Unrecognised file format.\n", 1) do_test('short.test-db', "Error: Corrupt persistent database.\n", 1) do_test('bad-dbid-size.test-db', "Error: Incompatible database configuration (dbid size is 5 bytes, expected 8)", 1) diff --git a/test/apps/01-db-dump-print-empty.py b/test/apps/db_dump/db-dump-print-empty.py similarity index 88% rename from test/apps/01-db-dump-print-empty.py rename to test/apps/db_dump/db-dump-print-empty.py index b26f372e..f74312d1 100755 --- a/test/apps/01-db-dump-print-empty.py +++ b/test/apps/db_dump/db-dump-print-empty.py @@ -4,9 +4,10 @@ from mosq_test_helper import * def do_test(file, stdout): - cmd = [mosq_test.get_build_root()+'/apps/db_dump/mosquitto_db_dump', - f'db_dump/{file}' - ] + cmd = [ + mosq_test.get_build_root()+'/apps/db_dump/mosquitto_db_dump', + f'./{file}' + ] res = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=1, encoding='utf-8') if res.stdout != stdout: diff --git a/test/apps/01-db-dump-print-v6-all.py b/test/apps/db_dump/db-dump-print-v6-all.py similarity index 71% rename from test/apps/01-db-dump-print-v6-all.py rename to test/apps/db_dump/db-dump-print-v6-all.py index ed2d8e00..3cf18a27 100755 --- a/test/apps/01-db-dump-print-v6-all.py +++ b/test/apps/db_dump/db-dump-print-v6-all.py @@ -4,13 +4,22 @@ from mosq_test_helper import * def do_test(file, stdout): - cmd = [mosq_test.get_build_root()+'/apps/db_dump/mosquitto_db_dump', - f'db_dump/{file}' + cmd = [ + mosq_test.get_build_root()+'/apps/db_dump/mosquitto_db_dump', + f'./{file}' ] res = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=1, encoding='utf-8') + if res.stdout != stdout: - print(res.stdout) + read_lines = res.stdout.splitlines() + expected_lines = stdout.splitlines() + for (read,expected) in zip(read_lines,expected_lines): + if read != expected: + print(f"- {expected}") + print(f"+ {read}") + else: + print(f" {read}") raise mosq_test.TestError stdout = """Mosquitto DB dump diff --git a/test/apps/01-db-dump-print-v6-mqtt-v5-props.py b/test/apps/db_dump/db-dump-print-v6-mqtt-v5-props.py similarity index 93% rename from test/apps/01-db-dump-print-v6-mqtt-v5-props.py rename to test/apps/db_dump/db-dump-print-v6-mqtt-v5-props.py index 2e871ed3..312ae193 100755 --- a/test/apps/01-db-dump-print-v6-mqtt-v5-props.py +++ b/test/apps/db_dump/db-dump-print-v6-mqtt-v5-props.py @@ -4,9 +4,10 @@ from mosq_test_helper import * def do_test(file, stdout): - cmd = [mosq_test.get_build_root() + '/apps/db_dump/mosquitto_db_dump', - f'db_dump/{file}' - ] + cmd = [ + mosq_test.get_build_root() + '/apps/db_dump/mosquitto_db_dump', + f'./{file}' + ] res = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=3, encoding='utf-8') if res.stdout != stdout: diff --git a/test/apps/01-db-dump-stats-current.py b/test/apps/db_dump/db-dump-stats-current.py similarity index 88% rename from test/apps/01-db-dump-stats-current.py rename to test/apps/db_dump/db-dump-stats-current.py index d84f4898..c97d2a41 100755 --- a/test/apps/01-db-dump-stats-current.py +++ b/test/apps/db_dump/db-dump-stats-current.py @@ -20,10 +20,11 @@ def check_db(port, counts): f"DB_CHUNK_SUB: {counts[4]}\n" + \ f"DB_CHUNK_CLIENT: {counts[5]}\n" - cmd = [mosq_test.get_build_root()+'/apps/db_dump/mosquitto_db_dump', - '--stats', - f'{port}/mosquitto.db' - ] + cmd = [ + mosq_test.get_build_root()+'/apps/db_dump/mosquitto_db_dump', + '--stats', + f'{port}/mosquitto.db' + ] res = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=1, encoding='utf-8') if res.stdout != stdout: print(res.stdout) @@ -51,24 +52,26 @@ def do_test(counts): } # Set up persistent client session, including a subscription - cmd = [mosq_test.get_build_root()+'/client/mosquitto_sub', + cmd = [ + mosq_test.get_build_root()+'/client/mosquitto_sub', '-c', '-i', 'client-id', '-p', str(port), '-q', '1', '-t', 'sub-topic', '-E' - ] + ] subprocess.run(cmd, timeout=1, env=env) # Publish a retained message which is also queued for the subscriber - cmd = [mosq_test.get_build_root()+'/client/mosquitto_pub', + cmd = [ + mosq_test.get_build_root()+'/client/mosquitto_pub', '-p', str(port), '-q', '1', '-t', 'sub-topic', '-m', 'message', '-r' - ] + ] subprocess.run(cmd, timeout=1, env=env) broker.terminate() diff --git a/test/apps/01-db-dump-stats.py b/test/apps/db_dump/db-dump-stats.py similarity index 91% rename from test/apps/01-db-dump-stats.py rename to test/apps/db_dump/db-dump-stats.py index 417826d1..b29a310c 100755 --- a/test/apps/01-db-dump-stats.py +++ b/test/apps/db_dump/db-dump-stats.py @@ -10,10 +10,11 @@ def do_test(file, counts): f"DB_CHUNK_SUB: {counts[4]}\n" + \ f"DB_CHUNK_CLIENT: {counts[5]}\n" - cmd = [mosq_test.get_build_root()+'/apps/db_dump/mosquitto_db_dump', + cmd = [ + mosq_test.get_build_root()+'/apps/db_dump/mosquitto_db_dump', '--stats', - f'db_dump/{file}' - ] + f'./{file}' + ] res = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=1, encoding='utf-8') if res.stdout != stdout: diff --git a/test/apps/db_dump/mosq_test_helper.py b/test/apps/db_dump/mosq_test_helper.py new file mode 100644 index 00000000..fe77c6e0 --- /dev/null +++ b/test/apps/db_dump/mosq_test_helper.py @@ -0,0 +1,18 @@ +import logging +import sys +from pathlib import Path + +logging.basicConfig( + level=logging.INFO, + format="%(levelname)s %(asctime)s.%(msecs)03d %(module)s: %(message)s", + datefmt="%H:%M:%S", +) + +current_source_dir = Path(__file__).resolve().parent +test_dir = current_source_dir.parents[1] +if test_dir not in sys.path: + sys.path.insert(0, str(test_dir)) + +import mosq_test +import subprocess +import os diff --git a/test/apps/db_dump/test.py b/test/apps/db_dump/test.py new file mode 100755 index 00000000..7baee14b --- /dev/null +++ b/test/apps/db_dump/test.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + +import mosq_test_helper +import pathlib +import ptest + +tests = [] + +for test_file in pathlib.Path('.').glob('db-dump-*.py'): + tests.append((1, test_file.resolve())) + +ptest.run_tests(tests) diff --git a/test/apps/passwd/CMakeLists.txt b/test/apps/passwd/CMakeLists.txt new file mode 100644 index 00000000..7aea0bd1 --- /dev/null +++ b/test/apps/passwd/CMakeLists.txt @@ -0,0 +1,19 @@ +file(GLOB PY_TEST_FILES [0-9][0-9]-*.py) + +set(EXCLUDE_LIST + # none +) + +foreach(PY_TEST_FILE ${PY_TEST_FILES}) + get_filename_component(PY_TEST_NAME ${PY_TEST_FILE} NAME_WE) + if(${PY_TEST_NAME} IN_LIST EXCLUDE_LIST) + continue() + endif() + add_test(NAME apps-${PY_TEST_NAME} + COMMAND ${PY_TEST_FILE} + ) + set_tests_properties(apps-${PY_TEST_NAME} + PROPERTIES + ENVIRONMENT "BUILD_ROOT=${CMAKE_BINARY_DIR}" + ) +endforeach() diff --git a/test/apps/passwd/Makefile b/test/apps/passwd/Makefile new file mode 100644 index 00000000..6f665b4e --- /dev/null +++ b/test/apps/passwd/Makefile @@ -0,0 +1,18 @@ +R=../../.. +include ${R}/config.mk + +.PHONY: all check test ptest clean +.NOTPARALLEL: + +all : + +check : test + +test : + ./passwd-args.py + ./passwd-changes.py + +ptest : + ./test.py + +clean: diff --git a/test/apps/passwd/mosq_test_helper.py b/test/apps/passwd/mosq_test_helper.py new file mode 100644 index 00000000..fe77c6e0 --- /dev/null +++ b/test/apps/passwd/mosq_test_helper.py @@ -0,0 +1,18 @@ +import logging +import sys +from pathlib import Path + +logging.basicConfig( + level=logging.INFO, + format="%(levelname)s %(asctime)s.%(msecs)03d %(module)s: %(message)s", + datefmt="%H:%M:%S", +) + +current_source_dir = Path(__file__).resolve().parent +test_dir = current_source_dir.parents[1] +if test_dir not in sys.path: + sys.path.insert(0, str(test_dir)) + +import mosq_test +import subprocess +import os diff --git a/test/apps/03-passwd-args.py b/test/apps/passwd/passwd-args.py similarity index 100% rename from test/apps/03-passwd-args.py rename to test/apps/passwd/passwd-args.py diff --git a/test/apps/03-passwd-changes.py b/test/apps/passwd/passwd-changes.py similarity index 100% rename from test/apps/03-passwd-changes.py rename to test/apps/passwd/passwd-changes.py diff --git a/test/apps/passwd/test.py b/test/apps/passwd/test.py new file mode 100755 index 00000000..0616be50 --- /dev/null +++ b/test/apps/passwd/test.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + +import mosq_test_helper +import pathlib +import ptest + +tests = [] + +for test_file in pathlib.Path('.').glob('passwd-*.py'): + tests.append((1, test_file.resolve())) + +ptest.run_tests(tests) diff --git a/test/client/Makefile b/test/client/Makefile index 0f81780c..b60274a6 100644 --- a/test/client/Makefile +++ b/test/client/Makefile @@ -76,7 +76,7 @@ endif ptest : ./test.sh - #./test-ws.sh + ./test-ws.sh ./test.py clean: