diff --git a/.github/workflows/mosquitto-make.yml b/.github/workflows/mosquitto-make.yml new file mode 100644 index 00000000..170777cd --- /dev/null +++ b/.github/workflows/mosquitto-make.yml @@ -0,0 +1,28 @@ +name: Mosquitto - Make + +on: + push: + branches: [ develop ] + pull_request: + branches: [ develop ] + +jobs: + build: + + runs-on: ubuntu-20.04 + + steps: + - + name: Install third party dependencies + run: sudo apt-get install -y debhelper libc-ares-dev libssl-dev libwrap0-dev python-all python3-all xsltproc docbook-xsl libcunit1-dev libjwt-dev libcjson-dev libcjson1 + - + uses: actions/checkout@v3 + with: + submodules: 'true' + - + name: make + run: make + - + name: make test + run: | + make test diff --git a/test/broker/01-connect-575314.py b/test/broker/01-connect-575314.py index cfa9f810..de63e1c8 100755 --- a/test/broker/01-connect-575314.py +++ b/test/broker/01-connect-575314.py @@ -38,7 +38,9 @@ def do_test(): pass finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/01-connect-accept-protocol.py b/test/broker/01-connect-accept-protocol.py index 44e7e3a9..4fb50645 100755 --- a/test/broker/01-connect-accept-protocol.py +++ b/test/broker/01-connect-accept-protocol.py @@ -44,7 +44,9 @@ def do_test(accept, expect_success): if write_config is not None: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/01-connect-allow-anonymous.py b/test/broker/01-connect-allow-anonymous.py index a06f34df..7da3d1ef 100755 --- a/test/broker/01-connect-allow-anonymous.py +++ b/test/broker/01-connect-allow-anonymous.py @@ -61,7 +61,9 @@ def do_test(use_conf, write_config, expect_success): if write_config is not None: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/01-connect-disconnect-v5.py b/test/broker/01-connect-disconnect-v5.py index 3342fb2d..56963e80 100755 --- a/test/broker/01-connect-disconnect-v5.py +++ b/test/broker/01-connect-disconnect-v5.py @@ -64,7 +64,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/01-connect-global-max-clients.py b/test/broker/01-connect-global-max-clients.py index 3ad021d0..3adc64bc 100755 --- a/test/broker/01-connect-global-max-clients.py +++ b/test/broker/01-connect-global-max-clients.py @@ -62,7 +62,9 @@ def do_test(): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/01-connect-global-max-connections.py b/test/broker/01-connect-global-max-connections.py index 860d33bb..b7f5fafa 100755 --- a/test/broker/01-connect-global-max-connections.py +++ b/test/broker/01-connect-global-max-connections.py @@ -69,7 +69,9 @@ def do_test(): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/01-connect-max-connections.py b/test/broker/01-connect-max-connections.py index a41fea13..ab410ea9 100755 --- a/test/broker/01-connect-max-connections.py +++ b/test/broker/01-connect-max-connections.py @@ -69,7 +69,9 @@ def do_test(): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/01-connect-max-keepalive.py b/test/broker/01-connect-max-keepalive.py index ea9d6eb6..d9429448 100755 --- a/test/broker/01-connect-max-keepalive.py +++ b/test/broker/01-connect-max-keepalive.py @@ -33,7 +33,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/01-connect-take-over.py b/test/broker/01-connect-take-over.py index a275ad7e..18e8c074 100755 --- a/test/broker/01-connect-take-over.py +++ b/test/broker/01-connect-take-over.py @@ -27,7 +27,9 @@ except Exception as e: print(e) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/01-connect-uname-no-password-denied.py b/test/broker/01-connect-uname-no-password-denied.py index 62bf67af..c1cf6fee 100755 --- a/test/broker/01-connect-uname-no-password-denied.py +++ b/test/broker/01-connect-uname-no-password-denied.py @@ -35,7 +35,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/01-connect-uname-or-anon.py b/test/broker/01-connect-uname-or-anon.py index 6db34fb8..02f505d5 100755 --- a/test/broker/01-connect-uname-or-anon.py +++ b/test/broker/01-connect-uname-or-anon.py @@ -49,7 +49,9 @@ def do_test(allow_anonymous, password_file, username, expect_success): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/01-connect-uname-password-denied-no-will.py b/test/broker/01-connect-uname-password-denied-no-will.py index 31d9ca85..411c20dd 100755 --- a/test/broker/01-connect-uname-password-denied-no-will.py +++ b/test/broker/01-connect-uname-password-denied-no-will.py @@ -58,7 +58,9 @@ def do_test(proto_ver): os.remove(conf_file) os.remove(pw_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/01-connect-uname-password-denied.py b/test/broker/01-connect-uname-password-denied.py index fce66b8f..f2836c63 100755 --- a/test/broker/01-connect-uname-password-denied.py +++ b/test/broker/01-connect-uname-password-denied.py @@ -37,7 +37,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/01-connect-uname-password-success-no-tls.py b/test/broker/01-connect-uname-password-success-no-tls.py index 4d1b0a14..cbfdd68e 100755 --- a/test/broker/01-connect-uname-password-success-no-tls.py +++ b/test/broker/01-connect-uname-password-success-no-tls.py @@ -33,7 +33,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/01-connect-unix-socket.py b/test/broker/01-connect-unix-socket.py index 799e4fed..013ea95c 100755 --- a/test/broker/01-connect-unix-socket.py +++ b/test/broker/01-connect-unix-socket.py @@ -53,7 +53,9 @@ def do_test(): print(err) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 os.remove(conf_file) try: os.remove(f"{port}.sock") diff --git a/test/broker/01-connect-windows-line-endings.py b/test/broker/01-connect-windows-line-endings.py index 48cc221e..b0658ae3 100755 --- a/test/broker/01-connect-windows-line-endings.py +++ b/test/broker/01-connect-windows-line-endings.py @@ -36,7 +36,9 @@ def do_test(): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/01-connect-zero-length-id.py b/test/broker/01-connect-zero-length-id.py index e99385ca..b66295b6 100755 --- a/test/broker/01-connect-zero-length-id.py +++ b/test/broker/01-connect-zero-length-id.py @@ -52,7 +52,9 @@ def do_test(per_listener, proto_ver, clean_start, allow_zero, client_port, expec pass finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) if rc: diff --git a/test/broker/02-shared-nolocal.py b/test/broker/02-shared-nolocal.py index 047af6f4..f294e8ce 100755 --- a/test/broker/02-shared-nolocal.py +++ b/test/broker/02-shared-nolocal.py @@ -30,7 +30,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-shared-qos0-v5.py b/test/broker/02-shared-qos0-v5.py index 7a285bfc..0377fae2 100755 --- a/test/broker/02-shared-qos0-v5.py +++ b/test/broker/02-shared-qos0-v5.py @@ -127,7 +127,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subhier-crash.py b/test/broker/02-subhier-crash.py index 8fb892fa..e4cd6232 100755 --- a/test/broker/02-subhier-crash.py +++ b/test/broker/02-subhier-crash.py @@ -49,7 +49,9 @@ def do_test(start_broker=True): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-b2c-topic-alias.py b/test/broker/02-subpub-b2c-topic-alias.py index 4a8e701d..d8c38fe1 100755 --- a/test/broker/02-subpub-b2c-topic-alias.py +++ b/test/broker/02-subpub-b2c-topic-alias.py @@ -80,7 +80,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos0-long-topic.py b/test/broker/02-subpub-qos0-long-topic.py index d9b9d2ec..ae66847c 100755 --- a/test/broker/02-subpub-qos0-long-topic.py +++ b/test/broker/02-subpub-qos0-long-topic.py @@ -36,7 +36,9 @@ def do_test(start_broker, topic, succeeds): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos0-oversize-payload.py b/test/broker/02-subpub-qos0-oversize-payload.py index 3d8f22b5..9a40054e 100755 --- a/test/broker/02-subpub-qos0-oversize-payload.py +++ b/test/broker/02-subpub-qos0-oversize-payload.py @@ -61,7 +61,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos0-queued-bytes.py b/test/broker/02-subpub-qos0-queued-bytes.py index 228f3e83..3d95d246 100755 --- a/test/broker/02-subpub-qos0-queued-bytes.py +++ b/test/broker/02-subpub-qos0-queued-bytes.py @@ -47,7 +47,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos0-retain-as-publish.py b/test/broker/02-subpub-qos0-retain-as-publish.py index 955628e8..1a1c74b5 100755 --- a/test/broker/02-subpub-qos0-retain-as-publish.py +++ b/test/broker/02-subpub-qos0-retain-as-publish.py @@ -48,7 +48,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos0-send-retain.py b/test/broker/02-subpub-qos0-send-retain.py index 6741888b..38bd0aa6 100755 --- a/test/broker/02-subpub-qos0-send-retain.py +++ b/test/broker/02-subpub-qos0-send-retain.py @@ -71,7 +71,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos0-subscription-id.py b/test/broker/02-subpub-qos0-subscription-id.py index 5fdc56ea..2c216ef9 100755 --- a/test/broker/02-subpub-qos0-subscription-id.py +++ b/test/broker/02-subpub-qos0-subscription-id.py @@ -98,7 +98,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos0-topic-alias-unknown.py b/test/broker/02-subpub-qos0-topic-alias-unknown.py index 6be5c631..e9889391 100755 --- a/test/broker/02-subpub-qos0-topic-alias-unknown.py +++ b/test/broker/02-subpub-qos0-topic-alias-unknown.py @@ -32,7 +32,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos0-topic-alias.py b/test/broker/02-subpub-qos0-topic-alias.py index 3fba4185..ad22dff1 100755 --- a/test/broker/02-subpub-qos0-topic-alias.py +++ b/test/broker/02-subpub-qos0-topic-alias.py @@ -49,7 +49,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos1-message-expiry-retain.py b/test/broker/02-subpub-qos1-message-expiry-retain.py index 8e1010e3..b6366b1e 100755 --- a/test/broker/02-subpub-qos1-message-expiry-retain.py +++ b/test/broker/02-subpub-qos1-message-expiry-retain.py @@ -80,7 +80,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos1-message-expiry-will.py b/test/broker/02-subpub-qos1-message-expiry-will.py index 224ff722..74c82f31 100755 --- a/test/broker/02-subpub-qos1-message-expiry-will.py +++ b/test/broker/02-subpub-qos1-message-expiry-will.py @@ -61,7 +61,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos1-message-expiry.py b/test/broker/02-subpub-qos1-message-expiry.py index b8af078a..0c765b1e 100755 --- a/test/broker/02-subpub-qos1-message-expiry.py +++ b/test/broker/02-subpub-qos1-message-expiry.py @@ -67,7 +67,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos1-nolocal.py b/test/broker/02-subpub-qos1-nolocal.py index 45b87de5..a0b7f6db 100755 --- a/test/broker/02-subpub-qos1-nolocal.py +++ b/test/broker/02-subpub-qos1-nolocal.py @@ -53,7 +53,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos1-oversize-payload.py b/test/broker/02-subpub-qos1-oversize-payload.py index 597180c7..077cecce 100755 --- a/test/broker/02-subpub-qos1-oversize-payload.py +++ b/test/broker/02-subpub-qos1-oversize-payload.py @@ -67,7 +67,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos1.py b/test/broker/02-subpub-qos1.py index ba7efeca..d80685f6 100755 --- a/test/broker/02-subpub-qos1.py +++ b/test/broker/02-subpub-qos1.py @@ -40,7 +40,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos2-1322.py b/test/broker/02-subpub-qos2-1322.py index 481dbc20..56d1bf8e 100755 --- a/test/broker/02-subpub-qos2-1322.py +++ b/test/broker/02-subpub-qos2-1322.py @@ -137,7 +137,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos2-max-inflight-bytes.py b/test/broker/02-subpub-qos2-max-inflight-bytes.py index e26f76eb..cf4d9cbc 100755 --- a/test/broker/02-subpub-qos2-max-inflight-bytes.py +++ b/test/broker/02-subpub-qos2-max-inflight-bytes.py @@ -97,7 +97,9 @@ def do_test(proto_ver): for i in range(0, 12): helper(port) #pub = subprocess.Popen(['./02-subpub-qos2-receive-maximum-helper.py', str(port)], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - #pub.wait() + #if mosq_test.wait_for_subprocess(pub): + # print("pub not terminated") + # if rc == 0: rc=1 #(stdo, stde) = pub.communicate() mid += 1 @@ -187,7 +189,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: #print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos2-pubrec-error.py b/test/broker/02-subpub-qos2-pubrec-error.py index 4d8b8a3d..e7ae7f66 100755 --- a/test/broker/02-subpub-qos2-pubrec-error.py +++ b/test/broker/02-subpub-qos2-pubrec-error.py @@ -74,7 +74,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos2-receive-maximum-1.py b/test/broker/02-subpub-qos2-receive-maximum-1.py index facf5e2e..1de8fb0d 100755 --- a/test/broker/02-subpub-qos2-receive-maximum-1.py +++ b/test/broker/02-subpub-qos2-receive-maximum-1.py @@ -102,7 +102,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos2-receive-maximum-2.py b/test/broker/02-subpub-qos2-receive-maximum-2.py index e6666d3f..02040e38 100755 --- a/test/broker/02-subpub-qos2-receive-maximum-2.py +++ b/test/broker/02-subpub-qos2-receive-maximum-2.py @@ -105,7 +105,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-qos2.py b/test/broker/02-subpub-qos2.py index 10e20dec..cb319ac6 100755 --- a/test/broker/02-subpub-qos2.py +++ b/test/broker/02-subpub-qos2.py @@ -50,7 +50,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subpub-recover-subscriptions.py b/test/broker/02-subpub-recover-subscriptions.py index e372299e..678f80ea 100755 --- a/test/broker/02-subpub-recover-subscriptions.py +++ b/test/broker/02-subpub-recover-subscriptions.py @@ -69,7 +69,9 @@ def do_test(proto_ver): print(err) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subscribe-dollar-v5.py b/test/broker/02-subscribe-dollar-v5.py index 9a654c97..befdcdff 100755 --- a/test/broker/02-subscribe-dollar-v5.py +++ b/test/broker/02-subscribe-dollar-v5.py @@ -34,7 +34,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subscribe-invalid-utf8.py b/test/broker/02-subscribe-invalid-utf8.py index 78b98835..d204207e 100755 --- a/test/broker/02-subscribe-invalid-utf8.py +++ b/test/broker/02-subscribe-invalid-utf8.py @@ -37,7 +37,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subscribe-long-topic.py b/test/broker/02-subscribe-long-topic.py index 70fd8127..08b82971 100755 --- a/test/broker/02-subscribe-long-topic.py +++ b/test/broker/02-subscribe-long-topic.py @@ -35,7 +35,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/02-subscribe-persistence-flipflop.py b/test/broker/02-subscribe-persistence-flipflop.py index 233aae06..1a37ac21 100755 --- a/test/broker/02-subscribe-persistence-flipflop.py +++ b/test/broker/02-subscribe-persistence-flipflop.py @@ -81,7 +81,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-pattern-matching.py b/test/broker/03-pattern-matching.py index f49728ec..882c92e8 100755 --- a/test/broker/03-pattern-matching.py +++ b/test/broker/03-pattern-matching.py @@ -49,7 +49,9 @@ def pattern_test(sub_topic, pub_topic): pass finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-b2c-disconnect-qos1.py b/test/broker/03-publish-b2c-disconnect-qos1.py index 85076275..c67be2a4 100755 --- a/test/broker/03-publish-b2c-disconnect-qos1.py +++ b/test/broker/03-publish-b2c-disconnect-qos1.py @@ -70,7 +70,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-b2c-disconnect-qos2.py b/test/broker/03-publish-b2c-disconnect-qos2.py index 95af627d..03205526 100755 --- a/test/broker/03-publish-b2c-disconnect-qos2.py +++ b/test/broker/03-publish-b2c-disconnect-qos2.py @@ -83,7 +83,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-b2c-qos1-len.py b/test/broker/03-publish-b2c-qos1-len.py index f53033a7..e9800bb3 100755 --- a/test/broker/03-publish-b2c-qos1-len.py +++ b/test/broker/03-publish-b2c-qos1-len.py @@ -52,7 +52,9 @@ def do_test(start_broker, test, puback_packet): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-b2c-qos2-len.py b/test/broker/03-publish-b2c-qos2-len.py index 4a91a60c..cb05057b 100755 --- a/test/broker/03-publish-b2c-qos2-len.py +++ b/test/broker/03-publish-b2c-qos2-len.py @@ -60,7 +60,9 @@ def do_test(start_broker, test, pubrec_packet, pubcomp_packet): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-c2b-disconnect-qos2.py b/test/broker/03-publish-c2b-disconnect-qos2.py index 9b8795c3..4d40c4b2 100755 --- a/test/broker/03-publish-c2b-disconnect-qos2.py +++ b/test/broker/03-publish-c2b-disconnect-qos2.py @@ -72,7 +72,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-c2b-qos2-len.py b/test/broker/03-publish-c2b-qos2-len.py index 0c29845e..d2686dea 100755 --- a/test/broker/03-publish-c2b-qos2-len.py +++ b/test/broker/03-publish-c2b-qos2-len.py @@ -35,7 +35,9 @@ def do_test(start_broker, test, pubrel_packet): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-dollar-v5.py b/test/broker/03-publish-dollar-v5.py index de8f9f6b..71713024 100755 --- a/test/broker/03-publish-dollar-v5.py +++ b/test/broker/03-publish-dollar-v5.py @@ -41,7 +41,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-dollar.py b/test/broker/03-publish-dollar.py index 8279cfd4..b560c967 100755 --- a/test/broker/03-publish-dollar.py +++ b/test/broker/03-publish-dollar.py @@ -29,7 +29,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-invalid-utf8.py b/test/broker/03-publish-invalid-utf8.py index e52bc7f8..876972a3 100755 --- a/test/broker/03-publish-invalid-utf8.py +++ b/test/broker/03-publish-invalid-utf8.py @@ -37,7 +37,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-long-topic.py b/test/broker/03-publish-long-topic.py index bc6b989c..c89ee0da 100755 --- a/test/broker/03-publish-long-topic.py +++ b/test/broker/03-publish-long-topic.py @@ -36,7 +36,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-qos1-max-inflight-expire.py b/test/broker/03-publish-qos1-max-inflight-expire.py index 1f04e101..5163567e 100755 --- a/test/broker/03-publish-qos1-max-inflight-expire.py +++ b/test/broker/03-publish-qos1-max-inflight-expire.py @@ -80,7 +80,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-qos1-max-inflight.py b/test/broker/03-publish-qos1-max-inflight.py index 2e12280c..b826de34 100755 --- a/test/broker/03-publish-qos1-max-inflight.py +++ b/test/broker/03-publish-qos1-max-inflight.py @@ -39,7 +39,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-qos1-no-subscribers-v5.py b/test/broker/03-publish-qos1-no-subscribers-v5.py index eca26f75..a94c8a78 100755 --- a/test/broker/03-publish-qos1-no-subscribers-v5.py +++ b/test/broker/03-publish-qos1-no-subscribers-v5.py @@ -66,7 +66,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-qos1-retain-disabled.py b/test/broker/03-publish-qos1-retain-disabled.py index 5bc81de6..0cf11c0b 100755 --- a/test/broker/03-publish-qos1-retain-disabled.py +++ b/test/broker/03-publish-qos1-retain-disabled.py @@ -43,7 +43,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-qos1.py b/test/broker/03-publish-qos1.py index 1b6265e3..ce4dd237 100755 --- a/test/broker/03-publish-qos1.py +++ b/test/broker/03-publish-qos1.py @@ -33,7 +33,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-qos2-max-inflight-exceeded.py b/test/broker/03-publish-qos2-max-inflight-exceeded.py index 4433f8a7..f2d9746a 100755 --- a/test/broker/03-publish-qos2-max-inflight-exceeded.py +++ b/test/broker/03-publish-qos2-max-inflight-exceeded.py @@ -36,7 +36,9 @@ def do_test(proto_ver): pass finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-qos2-max-inflight.py b/test/broker/03-publish-qos2-max-inflight.py index e3479a62..e9fbac90 100755 --- a/test/broker/03-publish-qos2-max-inflight.py +++ b/test/broker/03-publish-qos2-max-inflight.py @@ -44,7 +44,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-qos2-reuse-mid.py b/test/broker/03-publish-qos2-reuse-mid.py index a4cccded..e9454d01 100755 --- a/test/broker/03-publish-qos2-reuse-mid.py +++ b/test/broker/03-publish-qos2-reuse-mid.py @@ -47,7 +47,9 @@ def do_test(proto_ver): pass finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/03-publish-qos2.py b/test/broker/03-publish-qos2.py index dc01a829..b07c5d51 100755 --- a/test/broker/03-publish-qos2.py +++ b/test/broker/03-publish-qos2.py @@ -32,7 +32,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/04-retain-check-source-persist-diff-port.py b/test/broker/04-retain-check-source-persist-diff-port.py index e1b93de2..cceca028 100755 --- a/test/broker/04-retain-check-source-persist-diff-port.py +++ b/test/broker/04-retain-check-source-persist-diff-port.py @@ -80,7 +80,9 @@ def do_test(proto_ver, per_listener, username): # Remove "write" ability write_acl_2(acl_file, username) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 if os.path.isfile(persistence_file) == False: raise FileNotFoundError("Persistence file not written") @@ -97,7 +99,9 @@ def do_test(proto_ver, per_listener, username): pass finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 os.remove(conf_file) os.remove(acl_file) try: diff --git a/test/broker/04-retain-check-source-persist.py b/test/broker/04-retain-check-source-persist.py index c4fc819b..3cebd886 100755 --- a/test/broker/04-retain-check-source-persist.py +++ b/test/broker/04-retain-check-source-persist.py @@ -67,7 +67,9 @@ def do_test(proto_ver, per_listener, username): # Remove "write" ability write_acl_2(acl_file, username) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -82,7 +84,9 @@ def do_test(proto_ver, per_listener, username): pass finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 os.remove(conf_file) os.remove(acl_file) os.remove(persistence_file) diff --git a/test/broker/04-retain-check-source.py b/test/broker/04-retain-check-source.py index 9e3712f4..b409729b 100755 --- a/test/broker/04-retain-check-source.py +++ b/test/broker/04-retain-check-source.py @@ -69,7 +69,9 @@ def do_test(proto_ver, per_listener): os.remove(conf_file) os.remove(acl_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/04-retain-qos0-clear.py b/test/broker/04-retain-qos0-clear.py index 38c95c02..ce69aaa0 100755 --- a/test/broker/04-retain-qos0-clear.py +++ b/test/broker/04-retain-qos0-clear.py @@ -56,7 +56,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/04-retain-qos0-fresh.py b/test/broker/04-retain-qos0-fresh.py index 465f6078..d0ec44a9 100755 --- a/test/broker/04-retain-qos0-fresh.py +++ b/test/broker/04-retain-qos0-fresh.py @@ -35,7 +35,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/04-retain-qos0-repeated.py b/test/broker/04-retain-qos0-repeated.py index 3781c4d7..20cc23ff 100755 --- a/test/broker/04-retain-qos0-repeated.py +++ b/test/broker/04-retain-qos0-repeated.py @@ -42,7 +42,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/04-retain-qos0.py b/test/broker/04-retain-qos0.py index 311508f0..930da869 100755 --- a/test/broker/04-retain-qos0.py +++ b/test/broker/04-retain-qos0.py @@ -33,7 +33,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/04-retain-qos1-qos0.py b/test/broker/04-retain-qos1-qos0.py index 31158f08..6c0cbc46 100755 --- a/test/broker/04-retain-qos1-qos0.py +++ b/test/broker/04-retain-qos1-qos0.py @@ -41,7 +41,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/04-retain-upgrade-outgoing-qos.py b/test/broker/04-retain-upgrade-outgoing-qos.py index 017b5e9c..e0b1ef6e 100755 --- a/test/broker/04-retain-upgrade-outgoing-qos.py +++ b/test/broker/04-retain-upgrade-outgoing-qos.py @@ -45,7 +45,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/05-clean-session-qos1.py b/test/broker/05-clean-session-qos1.py index 64bd54e9..06bcfcb9 100755 --- a/test/broker/05-clean-session-qos1.py +++ b/test/broker/05-clean-session-qos1.py @@ -65,7 +65,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/05-session-expiry-v5.py b/test/broker/05-session-expiry-v5.py index 796e861d..c7d9b368 100755 --- a/test/broker/05-session-expiry-v5.py +++ b/test/broker/05-session-expiry-v5.py @@ -95,7 +95,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/06-bridge-b2br-disconnect-qos1.py b/test/broker/06-bridge-b2br-disconnect-qos1.py index 79b2605b..6efb8984 100755 --- a/test/broker/06-bridge-b2br-disconnect-qos1.py +++ b/test/broker/06-bridge-b2br-disconnect-qos1.py @@ -105,7 +105,9 @@ def do_test(proto_ver): pass broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() ssock.close() if rc: diff --git a/test/broker/06-bridge-b2br-disconnect-qos2.py b/test/broker/06-bridge-b2br-disconnect-qos2.py index b121f4fb..07b05b85 100755 --- a/test/broker/06-bridge-b2br-disconnect-qos2.py +++ b/test/broker/06-bridge-b2br-disconnect-qos2.py @@ -120,7 +120,9 @@ def do_test(proto_ver): pass broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() ssock.close() if rc: diff --git a/test/broker/06-bridge-b2br-late-connection-retain.py b/test/broker/06-bridge-b2br-late-connection-retain.py index b26954dd..87227a28 100755 --- a/test/broker/06-bridge-b2br-late-connection-retain.py +++ b/test/broker/06-bridge-b2br-late-connection-retain.py @@ -70,7 +70,9 @@ def do_test(proto_ver): client.close() broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 # Restart, with retained message in place write_config2(conf_file, persistence_file, port1, port2, bridge_protocol) @@ -101,7 +103,9 @@ def do_test(proto_ver): pass broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(persistence_file) ssock.close() diff --git a/test/broker/06-bridge-b2br-late-connection.py b/test/broker/06-bridge-b2br-late-connection.py index ee2b841a..f69d61c1 100755 --- a/test/broker/06-bridge-b2br-late-connection.py +++ b/test/broker/06-bridge-b2br-late-connection.py @@ -75,7 +75,9 @@ def do_test(proto_ver): pass broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() ssock.close() if rc: diff --git a/test/broker/06-bridge-b2br-remapping.py b/test/broker/06-bridge-b2br-remapping.py index eb789613..8f152754 100755 --- a/test/broker/06-bridge-b2br-remapping.py +++ b/test/broker/06-bridge-b2br-remapping.py @@ -144,7 +144,9 @@ def do_test(proto_ver): pass broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() ssock.close() if rc: diff --git a/test/broker/06-bridge-br2b-disconnect-qos1.py b/test/broker/06-bridge-br2b-disconnect-qos1.py index 583adeb7..4cdc57b6 100755 --- a/test/broker/06-bridge-br2b-disconnect-qos1.py +++ b/test/broker/06-bridge-br2b-disconnect-qos1.py @@ -108,7 +108,9 @@ def do_test(proto_ver): pass broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() ssock.close() if rc: diff --git a/test/broker/06-bridge-br2b-disconnect-qos2.py b/test/broker/06-bridge-br2b-disconnect-qos2.py index 7d0d2741..ba8b8856 100755 --- a/test/broker/06-bridge-br2b-disconnect-qos2.py +++ b/test/broker/06-bridge-br2b-disconnect-qos2.py @@ -136,7 +136,9 @@ def do_test(proto_ver): pass broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() ssock.close() if rc: diff --git a/test/broker/06-bridge-br2b-remapping.py b/test/broker/06-bridge-br2b-remapping.py index 4ea07735..a2e23aa0 100755 --- a/test/broker/06-bridge-br2b-remapping.py +++ b/test/broker/06-bridge-br2b-remapping.py @@ -122,7 +122,9 @@ def do_test(proto_ver): pass broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() ssock.close() if rc: diff --git a/test/broker/06-bridge-clean-session-core.py b/test/broker/06-bridge-clean-session-core.py index 79eaa81e..11f18505 100755 --- a/test/broker/06-bridge-clean-session-core.py +++ b/test/broker/06-bridge-clean-session-core.py @@ -141,6 +141,7 @@ def do_test(proto_ver, cs, lcs=None): pub_b3r = make_pub("br_in/test-queued3", mid=2, proto=proto_ver) # without queueing, there is no b2 success = False + broker_termination_success = True stde_a1 = stde_b1 = None try: # b must start first, as it's the destination of a @@ -162,7 +163,9 @@ def do_test(proto_ver, cs, lcs=None): tprint("Normal bi-dir bridging works. continuing") broker_b.terminate() - broker_b.wait() + if mosq_test.wait_for_subprocess(broker_b): + print("broker_b not terminated") + broker_termination_success = False (stdo_b1, stde_b1) = broker_b.communicate() # as we're _terminating_ the connections should close ~straight away @@ -197,7 +200,9 @@ def do_test(proto_ver, cs, lcs=None): # ok, now repeat in the other direction... broker_a.terminate() - broker_a.wait() + if mosq_test.wait_for_subprocess(broker_a): + print("broker_a not terminated") + broker_termination_success = False (stdo_a1, stde_a1) = broker_a.communicate() time.sleep(0.5) @@ -221,7 +226,7 @@ def do_test(proto_ver, cs, lcs=None): tprint("not expecting message b->a_2") mosq_test.do_receive_send(client_a, pub_b3r.p, pub_b3r.ack, "b->a_3(r)") - success = True + success = broker_termination_success except mosq_test.TestError: pass @@ -230,8 +235,12 @@ def do_test(proto_ver, cs, lcs=None): os.remove(conf_file_b) broker_a.terminate() broker_b.terminate() - broker_a.wait() - broker_b.wait() + if mosq_test.wait_for_subprocess(broker_a): + print("broker_a not terminated") + success = False + if mosq_test.wait_for_subprocess(broker_b): + print("broker_b not terminated") + success = False (stdo_a, stde_a) = broker_a.communicate() (stdo_b, stde_b) = broker_b.communicate() # Must be after terminating! diff --git a/test/broker/06-bridge-config-reload.py b/test/broker/06-bridge-config-reload.py index 5e3374f7..499c8903 100755 --- a/test/broker/06-bridge-config-reload.py +++ b/test/broker/06-bridge-config-reload.py @@ -101,7 +101,9 @@ def do_test(): finally: try: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 _, stde = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/06-bridge-fail-persist-resend-qos1.py b/test/broker/06-bridge-fail-persist-resend-qos1.py index f261a825..6f73ba10 100755 --- a/test/broker/06-bridge-fail-persist-resend-qos1.py +++ b/test/broker/06-bridge-fail-persist-resend-qos1.py @@ -89,7 +89,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() sock.close() if rc: diff --git a/test/broker/06-bridge-fail-persist-resend-qos2.py b/test/broker/06-bridge-fail-persist-resend-qos2.py index 71ceb30f..d046b887 100755 --- a/test/broker/06-bridge-fail-persist-resend-qos2.py +++ b/test/broker/06-bridge-fail-persist-resend-qos2.py @@ -101,7 +101,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() sock.close() if rc: diff --git a/test/broker/06-bridge-no-local.py b/test/broker/06-bridge-no-local.py index bbf57f32..34eb8c67 100755 --- a/test/broker/06-bridge-no-local.py +++ b/test/broker/06-bridge-no-local.py @@ -35,7 +35,9 @@ def do_test(start_broker, proto_ver_connect, proto_ver_msgs, sub_opts): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/06-bridge-outgoing-retain.py b/test/broker/06-bridge-outgoing-retain.py index 073a99fe..8ce41b03 100755 --- a/test/broker/06-bridge-outgoing-retain.py +++ b/test/broker/06-bridge-outgoing-retain.py @@ -95,7 +95,9 @@ def do_test(proto_ver, outgoing_retain): pass broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() ssock.close() if rc: diff --git a/test/broker/06-bridge-per-listener-settings.py b/test/broker/06-bridge-per-listener-settings.py index cb7f0877..3a031992 100755 --- a/test/broker/06-bridge-per-listener-settings.py +++ b/test/broker/06-bridge-per-listener-settings.py @@ -141,7 +141,9 @@ def do_test(proto_ver): pass broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() ssock.close() if rc: diff --git a/test/broker/06-bridge-reconnect-local-out.py b/test/broker/06-bridge-reconnect-local-out.py index c6cd3ffe..2dc150ad 100755 --- a/test/broker/06-bridge-reconnect-local-out.py +++ b/test/broker/06-bridge-reconnect-local-out.py @@ -55,7 +55,9 @@ def do_test(proto_ver): else: time.sleep(0.5) local_broker.terminate() - local_broker.wait() + if mosq_test.wait_for_subprocess(local_broker): + print("local_broker not terminated") + if rc == 0: rc=1 if os.environ.get('MOSQ_USE_VALGRIND') is not None: time.sleep(5) else: @@ -95,12 +97,16 @@ def do_test(proto_ver): os.remove(conf_file) time.sleep(1) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) local_broker.terminate() - local_broker.wait() + if mosq_test.wait_for_subprocess(local_broker): + print("local_broker not terminated") + if rc == 0: rc=1 try: os.remove('mosquitto-%d.db' % (port1)) except OSError: diff --git a/test/broker/07-will-delay-invalid-573191.py b/test/broker/07-will-delay-invalid-573191.py index 4c44a174..16b00fa0 100755 --- a/test/broker/07-will-delay-invalid-573191.py +++ b/test/broker/07-will-delay-invalid-573191.py @@ -22,7 +22,9 @@ def do_test(): rc = 0 finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/07-will-delay-reconnect.py b/test/broker/07-will-delay-reconnect.py index 2dc4362f..d36ec27b 100755 --- a/test/broker/07-will-delay-reconnect.py +++ b/test/broker/07-will-delay-reconnect.py @@ -54,7 +54,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/07-will-delay-recover.py b/test/broker/07-will-delay-recover.py index ce54f3a6..82013c3d 100755 --- a/test/broker/07-will-delay-recover.py +++ b/test/broker/07-will-delay-recover.py @@ -57,7 +57,9 @@ def do_test(start_broker, clean_session): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/07-will-delay-session-expiry.py b/test/broker/07-will-delay-session-expiry.py index f1c3f276..e89d0fbe 100755 --- a/test/broker/07-will-delay-session-expiry.py +++ b/test/broker/07-will-delay-session-expiry.py @@ -48,7 +48,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/07-will-delay-session-expiry2.py b/test/broker/07-will-delay-session-expiry2.py index 1017e35c..ac050429 100755 --- a/test/broker/07-will-delay-session-expiry2.py +++ b/test/broker/07-will-delay-session-expiry2.py @@ -48,7 +48,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/07-will-delay.py b/test/broker/07-will-delay.py index 73a86ac7..bacf661c 100755 --- a/test/broker/07-will-delay.py +++ b/test/broker/07-will-delay.py @@ -44,7 +44,9 @@ def do_test(start_broker, clean_session): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/07-will-disconnect-with-will.py b/test/broker/07-will-disconnect-with-will.py index 38ed882b..a4c98dfe 100755 --- a/test/broker/07-will-disconnect-with-will.py +++ b/test/broker/07-will-disconnect-with-will.py @@ -42,7 +42,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/07-will-invalid-utf8.py b/test/broker/07-will-invalid-utf8.py index 7abcd3b4..2455df79 100755 --- a/test/broker/07-will-invalid-utf8.py +++ b/test/broker/07-will-invalid-utf8.py @@ -26,7 +26,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/07-will-no-flag.py b/test/broker/07-will-no-flag.py index 8173854a..c7355842 100755 --- a/test/broker/07-will-no-flag.py +++ b/test/broker/07-will-no-flag.py @@ -28,7 +28,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/07-will-null-topic.py b/test/broker/07-will-null-topic.py index 3b1392e7..439a61cd 100755 --- a/test/broker/07-will-null-topic.py +++ b/test/broker/07-will-null-topic.py @@ -26,7 +26,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/07-will-null.py b/test/broker/07-will-null.py index 074e1f98..820efb30 100755 --- a/test/broker/07-will-null.py +++ b/test/broker/07-will-null.py @@ -40,7 +40,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/07-will-oversize-payload.py b/test/broker/07-will-oversize-payload.py index 15852940..f6e36284 100755 --- a/test/broker/07-will-oversize-payload.py +++ b/test/broker/07-will-oversize-payload.py @@ -57,7 +57,9 @@ def do_test(proto_ver, clean_session): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/07-will-per-listener.py b/test/broker/07-will-per-listener.py index 43457559..29c14c64 100755 --- a/test/broker/07-will-per-listener.py +++ b/test/broker/07-will-per-listener.py @@ -45,7 +45,9 @@ def do_test(proto_ver, clean_session): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/07-will-properties.py b/test/broker/07-will-properties.py index 6310bbdf..a25d9329 100755 --- a/test/broker/07-will-properties.py +++ b/test/broker/07-will-properties.py @@ -43,7 +43,9 @@ def do_test(start_broker, will_props, recvd_props): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/07-will-qos0.py b/test/broker/07-will-qos0.py index 8e65b6ec..f23dee48 100755 --- a/test/broker/07-will-qos0.py +++ b/test/broker/07-will-qos0.py @@ -44,7 +44,9 @@ def do_test(start_broker, proto_ver, clean_session): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/07-will-reconnect-1273.py b/test/broker/07-will-reconnect-1273.py index bd4a82db..398a7966 100755 --- a/test/broker/07-will-reconnect-1273.py +++ b/test/broker/07-will-reconnect-1273.py @@ -67,7 +67,9 @@ def do_test(start_broker, proto_ver): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/07-will-takeover.py b/test/broker/07-will-takeover.py index eda479ec..b27f9558 100755 --- a/test/broker/07-will-takeover.py +++ b/test/broker/07-will-takeover.py @@ -86,7 +86,9 @@ def do_test(start_broker, proto_ver, clean_session1, clean_session2): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/08-ssl-bridge.py b/test/broker/08-ssl-bridge.py index 85f35cd6..47cfdefc 100755 --- a/test/broker/08-ssl-bridge.py +++ b/test/broker/08-ssl-bridge.py @@ -51,11 +51,14 @@ try: bridge.send(suback_packet) pub = subprocess.Popen(['./08-ssl-bridge-helper.py', str(port2)], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - pub.wait() + pub_terminated = 0 + if mosq_test.wait_for_subprocess(pub): + print("pub not terminated") + pub_terminated = 1 (stdo, stde) = pub.communicate() mosq_test.expect_packet(bridge, "publish", publish_packet) - rc = 0 + rc = pub_terminated bridge.close() except mosq_test.TestError: @@ -68,7 +71,9 @@ finally: pass broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/08-ssl-connect-cert-auth-crl.py b/test/broker/08-ssl-connect-cert-auth-crl.py index 8747e9c2..d80ef530 100755 --- a/test/broker/08-ssl-connect-cert-auth-crl.py +++ b/test/broker/08-ssl-connect-cert-auth-crl.py @@ -44,7 +44,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/08-ssl-connect-cert-auth-expired-allowed.py b/test/broker/08-ssl-connect-cert-auth-expired-allowed.py index eba46d4e..b49b775e 100755 --- a/test/broker/08-ssl-connect-cert-auth-expired-allowed.py +++ b/test/broker/08-ssl-connect-cert-auth-expired-allowed.py @@ -43,7 +43,9 @@ finally: os.remove(conf_file) time.sleep(0.5) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/08-ssl-connect-cert-auth-expired.py b/test/broker/08-ssl-connect-cert-auth-expired.py index 7904d1f7..9dcbd030 100755 --- a/test/broker/08-ssl-connect-cert-auth-expired.py +++ b/test/broker/08-ssl-connect-cert-auth-expired.py @@ -47,7 +47,9 @@ finally: os.remove(conf_file) time.sleep(0.5) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/08-ssl-connect-cert-auth-revoked.py b/test/broker/08-ssl-connect-cert-auth-revoked.py index 42cdefc0..eb21c732 100755 --- a/test/broker/08-ssl-connect-cert-auth-revoked.py +++ b/test/broker/08-ssl-connect-cert-auth-revoked.py @@ -48,7 +48,9 @@ finally: os.remove(conf_file) time.sleep(0.5) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/08-ssl-connect-cert-auth-without.py b/test/broker/08-ssl-connect-cert-auth-without.py index 486beb79..3f30e6cd 100755 --- a/test/broker/08-ssl-connect-cert-auth-without.py +++ b/test/broker/08-ssl-connect-cert-auth-without.py @@ -43,7 +43,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/08-ssl-connect-cert-auth.py b/test/broker/08-ssl-connect-cert-auth.py index 752c3d43..29ff471b 100755 --- a/test/broker/08-ssl-connect-cert-auth.py +++ b/test/broker/08-ssl-connect-cert-auth.py @@ -45,7 +45,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/08-ssl-connect-identity.py b/test/broker/08-ssl-connect-identity.py index e0a35c68..f9c5a4c5 100755 --- a/test/broker/08-ssl-connect-identity.py +++ b/test/broker/08-ssl-connect-identity.py @@ -47,7 +47,9 @@ finally: os.remove(conf_file) time.sleep(0.5) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/08-ssl-connect-no-auth-wrong-ca.py b/test/broker/08-ssl-connect-no-auth-wrong-ca.py index 40edecce..54986993 100755 --- a/test/broker/08-ssl-connect-no-auth-wrong-ca.py +++ b/test/broker/08-ssl-connect-no-auth-wrong-ca.py @@ -43,7 +43,9 @@ finally: time.sleep(0.5) broker.terminate() -broker.wait() +if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/08-ssl-connect-no-auth.py b/test/broker/08-ssl-connect-no-auth.py index d25ccaf2..2ed774b7 100755 --- a/test/broker/08-ssl-connect-no-auth.py +++ b/test/broker/08-ssl-connect-no-auth.py @@ -45,7 +45,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/08-ssl-connect-no-identity.py b/test/broker/08-ssl-connect-no-identity.py index 69550b57..cbb028a9 100755 --- a/test/broker/08-ssl-connect-no-identity.py +++ b/test/broker/08-ssl-connect-no-identity.py @@ -46,7 +46,9 @@ finally: os.remove(conf_file) time.sleep(2) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/08-ssl-hup-disconnect.py b/test/broker/08-ssl-hup-disconnect.py index 35e27bde..314e99e1 100755 --- a/test/broker/08-ssl-hup-disconnect.py +++ b/test/broker/08-ssl-hup-disconnect.py @@ -61,7 +61,9 @@ def do_test(option): os.remove(conf_file) os.remove(pw_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/08-tls-psk-bridge.py b/test/broker/08-tls-psk-bridge.py index 31d4fd9b..22e68bf0 100755 --- a/test/broker/08-tls-psk-bridge.py +++ b/test/broker/08-tls-psk-bridge.py @@ -64,12 +64,16 @@ try: mosq_test.do_send_receive(sock, subscribe_packet, suback_packet, "suback") pub = subprocess.Popen(['./c/08-tls-psk-bridge.test', str(port3)], env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - if pub.wait(): + pub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(pub): + print("pub not terminated") + pub_terminate_rc = 1 + if pub.returncode != 0: raise ValueError (stdo, stde) = pub.communicate() mosq_test.expect_packet(sock, "publish", publish_packet) - rc = 0 + rc = pub_terminate_rc sock.close() except mosq_test.TestError: @@ -79,10 +83,14 @@ finally: os.remove(conf_file2) time.sleep(1) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 time.sleep(1) bridge.terminate() - bridge.wait() + if mosq_test.wait_for_subprocess(bridge): + print("bridge not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/08-tls-psk-pub.py b/test/broker/08-tls-psk-pub.py index 395b3386..1883eade 100755 --- a/test/broker/08-tls-psk-pub.py +++ b/test/broker/08-tls-psk-pub.py @@ -48,12 +48,16 @@ try: mosq_test.do_send_receive(sock, subscribe_packet, suback_packet, "suback") pub = subprocess.Popen(['./c/08-tls-psk-pub.test', str(port1)], env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - if pub.wait(): + pub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(pub): + print("pub not terminated") + pub_terminate_rc = 1 + if pub.returncode != 0: raise ValueError (stdo, stde) = pub.communicate() mosq_test.expect_packet(sock, "publish", publish_packet) - rc = 0 + rc = pub_terminate_rc sock.close() except mosq_test.TestError: @@ -61,7 +65,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-acl-access-variants.py b/test/broker/09-acl-access-variants.py index 06413ef5..59132ef7 100755 --- a/test/broker/09-acl-access-variants.py +++ b/test/broker/09-acl-access-variants.py @@ -81,7 +81,9 @@ def acl_test(port, per_listener, global_en, user_en, pattern_en): os.remove(conf_file) os.remove(acl_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-acl-change.py b/test/broker/09-acl-change.py index 432c9dca..b57b756b 100755 --- a/test/broker/09-acl-change.py +++ b/test/broker/09-acl-change.py @@ -114,7 +114,9 @@ finally: os.remove(conf_file) os.remove(acl_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-acl-empty-file.py b/test/broker/09-acl-empty-file.py index 3ded8274..85c8bc74 100755 --- a/test/broker/09-acl-empty-file.py +++ b/test/broker/09-acl-empty-file.py @@ -53,7 +53,9 @@ def do_test(port, per_listener): os.remove(conf_file) os.remove(acl_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-auth-bad-method.py b/test/broker/09-auth-bad-method.py index 4087dcb2..1a0cb626 100755 --- a/test/broker/09-auth-bad-method.py +++ b/test/broker/09-auth-bad-method.py @@ -24,7 +24,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-extended-auth-change-username.py b/test/broker/09-extended-auth-change-username.py index 95175fc2..07dd6a32 100755 --- a/test/broker/09-extended-auth-change-username.py +++ b/test/broker/09-extended-auth-change-username.py @@ -75,7 +75,9 @@ def do_test(per_listener): os.remove(conf_file) os.remove(acl_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-extended-auth-multistep-reauth.py b/test/broker/09-extended-auth-multistep-reauth.py index 672b8f17..bbc4b104 100755 --- a/test/broker/09-extended-auth-multistep-reauth.py +++ b/test/broker/09-extended-auth-multistep-reauth.py @@ -84,7 +84,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-extended-auth-multistep.py b/test/broker/09-extended-auth-multistep.py index eee6768c..a91a5bdb 100755 --- a/test/broker/09-extended-auth-multistep.py +++ b/test/broker/09-extended-auth-multistep.py @@ -45,7 +45,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-extended-auth-reauth.py b/test/broker/09-extended-auth-reauth.py index b48f7f9f..1d036fd5 100755 --- a/test/broker/09-extended-auth-reauth.py +++ b/test/broker/09-extended-auth-reauth.py @@ -42,7 +42,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-extended-auth-single.py b/test/broker/09-extended-auth-single.py index 55df2a81..bad1c102 100755 --- a/test/broker/09-extended-auth-single.py +++ b/test/broker/09-extended-auth-single.py @@ -76,7 +76,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-extended-auth-single2.py b/test/broker/09-extended-auth-single2.py index 5f850490..a359f3af 100755 --- a/test/broker/09-extended-auth-single2.py +++ b/test/broker/09-extended-auth-single2.py @@ -78,7 +78,9 @@ def do_test(suffix): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-acl-change.py b/test/broker/09-plugin-acl-change.py index 4c15c480..3e49ee77 100755 --- a/test/broker/09-plugin-acl-change.py +++ b/test/broker/09-plugin-acl-change.py @@ -60,7 +60,9 @@ def do_test(plugin_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-auth-acl-pub.py b/test/broker/09-plugin-auth-acl-pub.py index 78acd408..d8d2d82b 100755 --- a/test/broker/09-plugin-auth-acl-pub.py +++ b/test/broker/09-plugin-auth-acl-pub.py @@ -58,7 +58,9 @@ def do_test(plugin_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-auth-acl-sub-denied.py b/test/broker/09-plugin-auth-acl-sub-denied.py index 914eec15..27a637aa 100755 --- a/test/broker/09-plugin-auth-acl-sub-denied.py +++ b/test/broker/09-plugin-auth-acl-sub-denied.py @@ -44,7 +44,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-auth-acl-sub.py b/test/broker/09-plugin-auth-acl-sub.py index b135d530..b7e3e39d 100755 --- a/test/broker/09-plugin-auth-acl-sub.py +++ b/test/broker/09-plugin-auth-acl-sub.py @@ -46,7 +46,9 @@ def do_test(plugin_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-auth-context-params.py b/test/broker/09-plugin-auth-context-params.py index 6bc6fdb5..394dbaaf 100755 --- a/test/broker/09-plugin-auth-context-params.py +++ b/test/broker/09-plugin-auth-context-params.py @@ -42,7 +42,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-auth-defer-unpwd-fail.py b/test/broker/09-plugin-auth-defer-unpwd-fail.py index 7b910993..06934b33 100755 --- a/test/broker/09-plugin-auth-defer-unpwd-fail.py +++ b/test/broker/09-plugin-auth-defer-unpwd-fail.py @@ -30,7 +30,9 @@ def do_test(plugin_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-auth-defer-unpwd-success.py b/test/broker/09-plugin-auth-defer-unpwd-success.py index 15f00f63..8eb6d7f5 100755 --- a/test/broker/09-plugin-auth-defer-unpwd-success.py +++ b/test/broker/09-plugin-auth-defer-unpwd-success.py @@ -32,7 +32,9 @@ def do_test(plugin_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-auth-msg-params.py b/test/broker/09-plugin-auth-msg-params.py index 347aff5c..b5e6847b 100755 --- a/test/broker/09-plugin-auth-msg-params.py +++ b/test/broker/09-plugin-auth-msg-params.py @@ -46,7 +46,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-auth-unpwd-fail.py b/test/broker/09-plugin-auth-unpwd-fail.py index c0d41b77..bdbf8b54 100755 --- a/test/broker/09-plugin-auth-unpwd-fail.py +++ b/test/broker/09-plugin-auth-unpwd-fail.py @@ -32,7 +32,9 @@ def do_test(plugin_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-auth-unpwd-success.py b/test/broker/09-plugin-auth-unpwd-success.py index 8ca05f8c..1eaf4e5f 100755 --- a/test/broker/09-plugin-auth-unpwd-success.py +++ b/test/broker/09-plugin-auth-unpwd-success.py @@ -31,7 +31,9 @@ def do_test(plugin_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-auth-v2-unpwd-fail.py b/test/broker/09-plugin-auth-v2-unpwd-fail.py index 9ec62999..4626e468 100755 --- a/test/broker/09-plugin-auth-v2-unpwd-fail.py +++ b/test/broker/09-plugin-auth-v2-unpwd-fail.py @@ -31,7 +31,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-auth-v2-unpwd-success.py b/test/broker/09-plugin-auth-v2-unpwd-success.py index 502bc936..87a25dea 100755 --- a/test/broker/09-plugin-auth-v2-unpwd-success.py +++ b/test/broker/09-plugin-auth-v2-unpwd-success.py @@ -30,7 +30,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-auth-v3-unpwd-fail.py b/test/broker/09-plugin-auth-v3-unpwd-fail.py index 9dd30ebc..c4d96406 100755 --- a/test/broker/09-plugin-auth-v3-unpwd-fail.py +++ b/test/broker/09-plugin-auth-v3-unpwd-fail.py @@ -31,7 +31,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-auth-v3-unpwd-success.py b/test/broker/09-plugin-auth-v3-unpwd-success.py index 3aabc023..dfae9b23 100755 --- a/test/broker/09-plugin-auth-v3-unpwd-success.py +++ b/test/broker/09-plugin-auth-v3-unpwd-success.py @@ -30,7 +30,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-auth-v4-unpwd-fail.py b/test/broker/09-plugin-auth-v4-unpwd-fail.py index c3f50703..dd1a1129 100755 --- a/test/broker/09-plugin-auth-v4-unpwd-fail.py +++ b/test/broker/09-plugin-auth-v4-unpwd-fail.py @@ -31,7 +31,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-auth-v4-unpwd-success.py b/test/broker/09-plugin-auth-v4-unpwd-success.py index b50272a8..9eee3268 100755 --- a/test/broker/09-plugin-auth-v4-unpwd-success.py +++ b/test/broker/09-plugin-auth-v4-unpwd-success.py @@ -30,7 +30,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-auth-v5-unpwd-fail.py b/test/broker/09-plugin-auth-v5-unpwd-fail.py index 14e95b6e..691a9629 100755 --- a/test/broker/09-plugin-auth-v5-unpwd-fail.py +++ b/test/broker/09-plugin-auth-v5-unpwd-fail.py @@ -31,7 +31,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-auth-v5-unpwd-success.py b/test/broker/09-plugin-auth-v5-unpwd-success.py index 42bdeeaa..78f1b577 100755 --- a/test/broker/09-plugin-auth-v5-unpwd-success.py +++ b/test/broker/09-plugin-auth-v5-unpwd-success.py @@ -30,7 +30,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-change-id.py b/test/broker/09-plugin-change-id.py index 6fabfec4..0b30987e 100755 --- a/test/broker/09-plugin-change-id.py +++ b/test/broker/09-plugin-change-id.py @@ -54,7 +54,9 @@ def do_test(plugin_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-delayed-auth.py b/test/broker/09-plugin-delayed-auth.py index 5f2f74f5..690cad6d 100755 --- a/test/broker/09-plugin-delayed-auth.py +++ b/test/broker/09-plugin-delayed-auth.py @@ -39,7 +39,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-plugin-publish.py b/test/broker/09-plugin-publish.py index 42eb666d..befc1f04 100755 --- a/test/broker/09-plugin-publish.py +++ b/test/broker/09-plugin-publish.py @@ -80,7 +80,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/09-pwfile-parse-invalid.py b/test/broker/09-pwfile-parse-invalid.py index 885db1dc..7c381566 100755 --- a/test/broker/09-pwfile-parse-invalid.py +++ b/test/broker/09-pwfile-parse-invalid.py @@ -67,7 +67,9 @@ def username_password_tests(port): pass finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 def all_tests(port): diff --git a/test/broker/10-listener-mount-point.py b/test/broker/10-listener-mount-point.py index 1077b9f4..274dbaf6 100755 --- a/test/broker/10-listener-mount-point.py +++ b/test/broker/10-listener-mount-point.py @@ -70,7 +70,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/11-message-expiry.py b/test/broker/11-message-expiry.py index 0dd43f73..473d07ee 100755 --- a/test/broker/11-message-expiry.py +++ b/test/broker/11-message-expiry.py @@ -69,7 +69,9 @@ try: mosq_test.do_send_receive(helper, publish3_packet, puback3_packet, "puback 3") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo1, stde1) = broker.communicate() sock.close() broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -92,7 +94,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/11-persistent-subscription-no-local.py b/test/broker/11-persistent-subscription-no-local.py index d56d39c4..d09a50da 100755 --- a/test/broker/11-persistent-subscription-no-local.py +++ b/test/broker/11-persistent-subscription-no-local.py @@ -65,7 +65,9 @@ try: sock.send(puback2a_packet) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo1, stde1) = broker.communicate() sock.close() @@ -85,7 +87,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/11-persistent-subscription-v5.py b/test/broker/11-persistent-subscription-v5.py index b2eb0175..52976697 100755 --- a/test/broker/11-persistent-subscription-v5.py +++ b/test/broker/11-persistent-subscription-v5.py @@ -45,7 +45,9 @@ try: mosq_test.do_send_receive(sock, subscribe_packet, suback_packet, "suback") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo1, stde1) = broker.communicate() sock.close() broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -62,7 +64,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/11-persistent-subscription.py b/test/broker/11-persistent-subscription.py index c6697336..5ce5989c 100755 --- a/test/broker/11-persistent-subscription.py +++ b/test/broker/11-persistent-subscription.py @@ -45,7 +45,9 @@ def do_test(proto_ver): mosq_test.do_send_receive(sock, subscribe_packet, suback_packet, "suback") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo1, stde1) = broker.communicate() sock.close() broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -62,7 +64,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if os.path.exists('mosquitto-%d.db' % (port)): os.unlink('mosquitto-%d.db' % (port)) diff --git a/test/broker/11-pub-props.py b/test/broker/11-pub-props.py index 048f2005..49ee44e9 100755 --- a/test/broker/11-pub-props.py +++ b/test/broker/11-pub-props.py @@ -50,7 +50,9 @@ try: mosq_test.expect_packet(sock, "publish2", publish2_packet) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo1, stde1) = broker.communicate() sock.close() broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -67,7 +69,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/11-subscription-id.py b/test/broker/11-subscription-id.py index 52d16bbc..c4e1a27f 100755 --- a/test/broker/11-subscription-id.py +++ b/test/broker/11-subscription-id.py @@ -57,7 +57,9 @@ try: sock.close() broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo1, stde1) = broker.communicate() broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -72,7 +74,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/12-prop-assigned-client-identifier.py b/test/broker/12-prop-assigned-client-identifier.py index b6e61d1c..b98f6c8b 100755 --- a/test/broker/12-prop-assigned-client-identifier.py +++ b/test/broker/12-prop-assigned-client-identifier.py @@ -40,7 +40,9 @@ def do_test(start_broker, clean_start): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/12-prop-maximum-packet-size-broker.py b/test/broker/12-prop-maximum-packet-size-broker.py index b0d59737..d94432b8 100755 --- a/test/broker/12-prop-maximum-packet-size-broker.py +++ b/test/broker/12-prop-maximum-packet-size-broker.py @@ -33,7 +33,9 @@ except mosq_test.TestError: pass finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 os.remove(conf_file) (stdo, stde) = broker.communicate() if rc: diff --git a/test/broker/12-prop-maximum-packet-size-publish-qos1.py b/test/broker/12-prop-maximum-packet-size-publish-qos1.py index c4fe453a..5b57a7a0 100755 --- a/test/broker/12-prop-maximum-packet-size-publish-qos1.py +++ b/test/broker/12-prop-maximum-packet-size-publish-qos1.py @@ -45,7 +45,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/12-prop-maximum-packet-size-publish-qos2.py b/test/broker/12-prop-maximum-packet-size-publish-qos2.py index e2d4db06..2da9a481 100755 --- a/test/broker/12-prop-maximum-packet-size-publish-qos2.py +++ b/test/broker/12-prop-maximum-packet-size-publish-qos2.py @@ -51,7 +51,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/12-prop-response-topic-correlation-data.py b/test/broker/12-prop-response-topic-correlation-data.py index ac70ff24..3570c996 100755 --- a/test/broker/12-prop-response-topic-correlation-data.py +++ b/test/broker/12-prop-response-topic-correlation-data.py @@ -54,7 +54,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/12-prop-response-topic.py b/test/broker/12-prop-response-topic.py index 616e1e43..be62fc0c 100755 --- a/test/broker/12-prop-response-topic.py +++ b/test/broker/12-prop-response-topic.py @@ -53,7 +53,9 @@ def do_test(start_broker): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/12-prop-server-keepalive.py b/test/broker/12-prop-server-keepalive.py index a58ed66d..d78a7f5d 100755 --- a/test/broker/12-prop-server-keepalive.py +++ b/test/broker/12-prop-server-keepalive.py @@ -38,7 +38,9 @@ except mosq_test.TestError: finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/13-malformed-publish-v5.py b/test/broker/13-malformed-publish-v5.py index 0523f919..d68c8370 100755 --- a/test/broker/13-malformed-publish-v5.py +++ b/test/broker/13-malformed-publish-v5.py @@ -90,7 +90,9 @@ except mosq_test.TestError: pass finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) if rc: diff --git a/test/broker/13-malformed-subscribe-v5.py b/test/broker/13-malformed-subscribe-v5.py index 929e0145..219e06ea 100755 --- a/test/broker/13-malformed-subscribe-v5.py +++ b/test/broker/13-malformed-subscribe-v5.py @@ -96,7 +96,9 @@ def all_tests(start_broker=False): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/13-malformed-unsubscribe-v5.py b/test/broker/13-malformed-unsubscribe-v5.py index f202dce6..8b2412f1 100755 --- a/test/broker/13-malformed-unsubscribe-v5.py +++ b/test/broker/13-malformed-unsubscribe-v5.py @@ -24,6 +24,8 @@ def do_test(unsubscribe_packet, reason_code, error_string, port): def all_tests(start_broker=False): + global rc + port = mosq_test.get_port() if start_broker: broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) @@ -66,7 +68,9 @@ def all_tests(start_broker=False): finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/14-dynsec-acl.py b/test/broker/14-dynsec-acl.py index 902ae9f9..9adbb80c 100755 --- a/test/broker/14-dynsec-acl.py +++ b/test/broker/14-dynsec-acl.py @@ -402,7 +402,9 @@ finally: pass os.rmdir(f"{port}") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/14-dynsec-allow-wildcard.py b/test/broker/14-dynsec-allow-wildcard.py index c95b7c91..10ab47cc 100755 --- a/test/broker/14-dynsec-allow-wildcard.py +++ b/test/broker/14-dynsec-allow-wildcard.py @@ -130,7 +130,9 @@ finally: pass os.rmdir(f"{port}") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/14-dynsec-anon-group.py b/test/broker/14-dynsec-anon-group.py index 7a2f76ea..2f32d1d9 100755 --- a/test/broker/14-dynsec-anon-group.py +++ b/test/broker/14-dynsec-anon-group.py @@ -148,7 +148,9 @@ finally: pass os.rmdir(f"{port}") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/14-dynsec-auth.py b/test/broker/14-dynsec-auth.py index a1fa5b3d..7447544b 100755 --- a/test/broker/14-dynsec-auth.py +++ b/test/broker/14-dynsec-auth.py @@ -183,7 +183,9 @@ finally: pass os.rmdir(f"{port}") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/14-dynsec-client-invalid.py b/test/broker/14-dynsec-client-invalid.py index 481ac227..935a35f0 100755 --- a/test/broker/14-dynsec-client-invalid.py +++ b/test/broker/14-dynsec-client-invalid.py @@ -458,7 +458,9 @@ finally: pass os.rmdir(f"{port}") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/14-dynsec-client.py b/test/broker/14-dynsec-client.py index 10d57000..50503923 100755 --- a/test/broker/14-dynsec-client.py +++ b/test/broker/14-dynsec-client.py @@ -94,7 +94,10 @@ try: # Kill broker and restart, checking whether our changes were saved. broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) sock = mosq_test.do_client_connect(connect_packet, connack_packet, timeout=5, port=port) @@ -118,7 +121,7 @@ try: # Delete client command_check(sock, delete_client_command, delete_client_response) - rc = 0 + rc = broker_terminate_rc sock.close() except mosq_test.TestError: @@ -131,7 +134,9 @@ finally: pass os.rmdir(f"{port}") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/14-dynsec-default-access.py b/test/broker/14-dynsec-default-access.py index 6587d20e..dcbdaa68 100755 --- a/test/broker/14-dynsec-default-access.py +++ b/test/broker/14-dynsec-default-access.py @@ -194,7 +194,9 @@ finally: pass os.rmdir(f"{port}") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/14-dynsec-disable-client.py b/test/broker/14-dynsec-disable-client.py index 6071f4d1..d5b688d0 100755 --- a/test/broker/14-dynsec-disable-client.py +++ b/test/broker/14-dynsec-disable-client.py @@ -112,7 +112,9 @@ finally: pass os.rmdir(f"{port}") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/14-dynsec-group-invalid.py b/test/broker/14-dynsec-group-invalid.py index a7945d12..ee80ced9 100755 --- a/test/broker/14-dynsec-group-invalid.py +++ b/test/broker/14-dynsec-group-invalid.py @@ -429,7 +429,9 @@ finally: pass os.rmdir(f"{port}") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/14-dynsec-group.py b/test/broker/14-dynsec-group.py index 75ac47d7..41f54b97 100755 --- a/test/broker/14-dynsec-group.py +++ b/test/broker/14-dynsec-group.py @@ -150,7 +150,10 @@ try: # Kill broker and restart, checking whether our changes were saved. broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) sock = mosq_test.do_client_connect(connect_packet, connack_packet, timeout=5, port=port) @@ -168,7 +171,7 @@ try: # Delete group entirely command_check(sock, delete_group_command, delete_group_response) - rc = 0 + rc = broker_terminate_rc sock.close() except mosq_test.TestError: @@ -181,7 +184,9 @@ finally: pass os.rmdir(f"{port}") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/14-dynsec-modify-client.py b/test/broker/14-dynsec-modify-client.py index d57bfdf8..69bf2cc3 100755 --- a/test/broker/14-dynsec-modify-client.py +++ b/test/broker/14-dynsec-modify-client.py @@ -181,7 +181,10 @@ try: # Kill broker and restart, checking whether our changes were saved. broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) sock = mosq_test.do_client_connect(connect_packet, connack_packet, timeout=5, port=port) @@ -196,7 +199,7 @@ try: # Get client command_check(sock, get_client_command3, get_client_response3, "get client 3") - rc = 0 + rc = broker_terminate_rc sock.close() except mosq_test.TestError: @@ -210,7 +213,9 @@ finally: pass os.rmdir(f"{port}") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/14-dynsec-modify-group.py b/test/broker/14-dynsec-modify-group.py index 310b6859..c4965e12 100755 --- a/test/broker/14-dynsec-modify-group.py +++ b/test/broker/14-dynsec-modify-group.py @@ -164,7 +164,10 @@ try: # Kill broker and restart, checking whether our changes were saved. broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) sock = mosq_test.do_client_connect(connect_packet, connack_packet, timeout=5, port=port) @@ -185,7 +188,7 @@ try: # Get group command_check(sock, get_group_command4, get_group_response4, "get group 4") - rc = 0 + rc = broker_terminate_rc sock.close() except mosq_test.TestError: @@ -199,7 +202,9 @@ finally: pass os.rmdir(f"{port}") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/14-dynsec-modify-role.py b/test/broker/14-dynsec-modify-role.py index 6720e2bc..c1fda015 100755 --- a/test/broker/14-dynsec-modify-role.py +++ b/test/broker/14-dynsec-modify-role.py @@ -139,7 +139,10 @@ try: # Kill broker and restart, checking whether our changes were saved. broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) sock = mosq_test.do_client_connect(connect_packet, connack_packet, timeout=5, port=port) @@ -148,7 +151,7 @@ try: # Get role command_check(sock, get_role_command2, get_role_response2) - rc = 0 + rc = broker_terminate_rc sock.close() except mosq_test.TestError: @@ -161,7 +164,9 @@ finally: pass os.rmdir(f"{port}") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/14-dynsec-plugin-invalid.py b/test/broker/14-dynsec-plugin-invalid.py index 4775696b..11f97f2a 100755 --- a/test/broker/14-dynsec-plugin-invalid.py +++ b/test/broker/14-dynsec-plugin-invalid.py @@ -140,7 +140,9 @@ finally: pass os.rmdir(f"{port}") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/14-dynsec-role-invalid.py b/test/broker/14-dynsec-role-invalid.py index f498f0d4..b25a6d30 100755 --- a/test/broker/14-dynsec-role-invalid.py +++ b/test/broker/14-dynsec-role-invalid.py @@ -315,7 +315,9 @@ finally: pass os.rmdir(f"{port}") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/14-dynsec-role.py b/test/broker/14-dynsec-role.py index 44e3f2ca..f13c94ce 100755 --- a/test/broker/14-dynsec-role.py +++ b/test/broker/14-dynsec-role.py @@ -226,7 +226,10 @@ try: # Kill broker and restart, checking whether our changes were saved. broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) sock = mosq_test.do_client_connect(connect_packet, connack_packet, timeout=5, port=port) @@ -254,7 +257,7 @@ try: # Delete role command_check(sock, delete_role_command, delete_role_response) - rc = 0 + rc = broker_terminate_rc sock.close() except mosq_test.TestError: @@ -267,7 +270,9 @@ finally: pass os.rmdir(f"{port}") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/15-persist-client-msg-in-v3-1-1.py b/test/broker/15-persist-client-msg-in-v3-1-1.py index 32c2bcb2..843ff673 100755 --- a/test/broker/15-persist-client-msg-in-v3-1-1.py +++ b/test/broker/15-persist-client-msg-in-v3-1-1.py @@ -53,7 +53,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -75,11 +78,13 @@ try: helper.send(pubrec2_packet) mosq_test.do_receive_send(helper, pubrel2_packet, pubcomp2_packet, "pubcomp2 receive") - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += persist_help.cleanup(port) diff --git a/test/broker/15-persist-client-msg-in-v5-0.py b/test/broker/15-persist-client-msg-in-v5-0.py index ea0929e2..0b67925d 100755 --- a/test/broker/15-persist-client-msg-in-v5-0.py +++ b/test/broker/15-persist-client-msg-in-v5-0.py @@ -54,7 +54,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -76,11 +79,13 @@ try: helper.send(pubrec2_packet) mosq_test.do_receive_send(helper, pubrel2_packet, pubcomp2_packet, "pubcomp2 receive") - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += persist_help.cleanup(port) diff --git a/test/broker/15-persist-client-msg-out-queue-v3-1-1.py b/test/broker/15-persist-client-msg-out-queue-v3-1-1.py index 4b43b6ae..e3b68605 100755 --- a/test/broker/15-persist-client-msg-out-queue-v3-1-1.py +++ b/test/broker/15-persist-client-msg-out-queue-v3-1-1.py @@ -67,7 +67,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -86,11 +89,13 @@ try: # If there are messages, the ping will fail mosq_test.do_ping(sock) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += persist_help.cleanup(port) diff --git a/test/broker/15-persist-client-msg-out-v3-1-1.py b/test/broker/15-persist-client-msg-out-v3-1-1.py index c0c12fa3..4f808eb3 100755 --- a/test/broker/15-persist-client-msg-out-v3-1-1.py +++ b/test/broker/15-persist-client-msg-out-v3-1-1.py @@ -66,7 +66,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -85,11 +88,13 @@ try: # If there are messages, the ping will fail mosq_test.do_ping(sock) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += persist_help.cleanup(port) diff --git a/test/broker/15-persist-client-msg-out-v5-0.py b/test/broker/15-persist-client-msg-out-v5-0.py index 301ebc5c..5cc2b888 100755 --- a/test/broker/15-persist-client-msg-out-v5-0.py +++ b/test/broker/15-persist-client-msg-out-v5-0.py @@ -67,7 +67,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -86,11 +89,13 @@ try: # If there are messages, the ping will fail mosq_test.do_ping(sock) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += persist_help.cleanup(port) diff --git a/test/broker/15-persist-client-v3-1-1.py b/test/broker/15-persist-client-v3-1-1.py index 1207d21e..bb776ff1 100755 --- a/test/broker/15-persist-client-v3-1-1.py +++ b/test/broker/15-persist-client-v3-1-1.py @@ -38,7 +38,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -60,7 +63,9 @@ try: # Kill broker broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -70,11 +75,13 @@ try: mosq_test.do_ping(sock) sock.close() - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (3)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += persist_help.cleanup(port) diff --git a/test/broker/15-persist-client-v5.0.py b/test/broker/15-persist-client-v5.0.py index 3eeadeb5..a04ac3bc 100755 --- a/test/broker/15-persist-client-v5.0.py +++ b/test/broker/15-persist-client-v5.0.py @@ -35,7 +35,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -57,7 +60,9 @@ try: # Kill broker broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -67,11 +72,13 @@ try: mosq_test.do_ping(sock) sock.close() - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += persist_help.cleanup(port) diff --git a/test/broker/15-persist-publish-properties-v5-0.py b/test/broker/15-persist-publish-properties-v5-0.py index aff97b73..dd9c11af 100755 --- a/test/broker/15-persist-publish-properties-v5-0.py +++ b/test/broker/15-persist-publish-properties-v5-0.py @@ -57,7 +57,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -70,11 +73,13 @@ try: mosq_test.expect_packet(sock, "publish", publish_packet) mosq_test.do_ping(sock) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += persist_help.cleanup(port) diff --git a/test/broker/15-persist-retain-v3-1-1.py b/test/broker/15-persist-retain-v3-1-1.py index be3c54c8..3a02418b 100755 --- a/test/broker/15-persist-retain-v3-1-1.py +++ b/test/broker/15-persist-retain-v3-1-1.py @@ -59,7 +59,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -72,11 +75,13 @@ try: mosq_test.receive_unordered(sock, publish1_packet, publish3_packet, "publish 1 / 3") mosq_test.do_ping(sock) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += persist_help.cleanup(port) diff --git a/test/broker/15-persist-retain-v5-0.py b/test/broker/15-persist-retain-v5-0.py index c33911d4..cf095ae6 100755 --- a/test/broker/15-persist-retain-v5-0.py +++ b/test/broker/15-persist-retain-v5-0.py @@ -59,7 +59,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -72,11 +75,13 @@ try: mosq_test.receive_unordered(sock, publish1_packet, publish3_packet, "publish 1 / 3") mosq_test.do_ping(sock) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += persist_help.cleanup(port) diff --git a/test/broker/15-persist-subscription-v3-1-1.py b/test/broker/15-persist-subscription-v3-1-1.py index 748a2ea1..d174eb9c 100755 --- a/test/broker/15-persist-subscription-v3-1-1.py +++ b/test/broker/15-persist-subscription-v3-1-1.py @@ -72,7 +72,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -95,7 +98,9 @@ try: # Kill broker broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -112,11 +117,13 @@ try: mosq_test.do_receive_send(sock, packets["publish1"], packets["puback1"], "publish 1") mosq_test.do_ping(sock) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (3)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += persist_help.cleanup(port) diff --git a/test/broker/15-persist-subscription-v5-0.py b/test/broker/15-persist-subscription-v5-0.py index 67ad45b4..917e9a51 100755 --- a/test/broker/15-persist-subscription-v5-0.py +++ b/test/broker/15-persist-subscription-v5-0.py @@ -83,7 +83,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -106,7 +109,9 @@ try: # Kill broker broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -123,11 +128,13 @@ try: mosq_test.do_receive_send(sock, packets["publish1"], packets["puback1"], "publish 1") mosq_test.do_ping(sock) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (3)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += persist_help.cleanup(port) diff --git a/test/broker/15-sqlite-clean-shutdown.py b/test/broker/15-sqlite-clean-shutdown.py index 69a119a8..9b338151 100755 --- a/test/broker/15-sqlite-clean-shutdown.py +++ b/test/broker/15-sqlite-clean-shutdown.py @@ -30,7 +30,9 @@ except mosq_test.TestError: pass finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) diff --git a/test/broker/15-sqlite-client-message-in-v3-1-1.py b/test/broker/15-sqlite-client-message-in-v3-1-1.py index 898eb397..370d8a40 100755 --- a/test/broker/15-sqlite-client-message-in-v3-1-1.py +++ b/test/broker/15-sqlite-client-message-in-v3-1-1.py @@ -53,7 +53,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -75,11 +78,13 @@ try: helper.send(pubrec2_packet) mosq_test.do_receive_send(helper, pubrel2_packet, pubcomp2_packet, "pubcomp2 receive") - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += sqlite_help.cleanup(port) diff --git a/test/broker/15-sqlite-client-message-out-dup-v3-1-1.py b/test/broker/15-sqlite-client-message-out-dup-v3-1-1.py index f2714994..c865e4b4 100755 --- a/test/broker/15-sqlite-client-message-out-dup-v3-1-1.py +++ b/test/broker/15-sqlite-client-message-out-dup-v3-1-1.py @@ -79,7 +79,10 @@ try: #con = None broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 (stdo, stde) = broker.communicate() broker = None @@ -99,11 +102,13 @@ try: # Check client msg sqlite_help.check_client_msg(cur, client_id, store_id, 1, sqlite_help.dir_out, 1, qos, 0, sqlite_help.ms_wait_for_pubrec) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if con is not None: con.close() diff --git a/test/broker/15-sqlite-client-message-out-v3-1-1.py b/test/broker/15-sqlite-client-message-out-v3-1-1.py index dac2087c..d357ff3d 100755 --- a/test/broker/15-sqlite-client-message-out-v3-1-1.py +++ b/test/broker/15-sqlite-client-message-out-v3-1-1.py @@ -49,7 +49,10 @@ try: sock.close() broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 (stdo, stde) = broker.communicate() broker = None @@ -70,11 +73,13 @@ try: sqlite_help.check_client_msg(cur, client_id, store_id, 0, sqlite_help.dir_out, 1, qos, 0, sqlite_help.ms_queued) con.close() - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if con is not None: con.close() diff --git a/test/broker/15-sqlite-client-msg-in-v5-0.py b/test/broker/15-sqlite-client-msg-in-v5-0.py index 6d6896c4..20363572 100755 --- a/test/broker/15-sqlite-client-msg-in-v5-0.py +++ b/test/broker/15-sqlite-client-msg-in-v5-0.py @@ -54,7 +54,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -76,11 +79,13 @@ try: helper.send(pubrec2_packet) mosq_test.do_receive_send(helper, pubrel2_packet, pubcomp2_packet, "pubcomp2 receive") - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += sqlite_help.cleanup(port) diff --git a/test/broker/15-sqlite-client-msg-out-queue-v3-1-1.py b/test/broker/15-sqlite-client-msg-out-queue-v3-1-1.py index 0c7d354d..dc7ef451 100755 --- a/test/broker/15-sqlite-client-msg-out-queue-v3-1-1.py +++ b/test/broker/15-sqlite-client-msg-out-queue-v3-1-1.py @@ -67,7 +67,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -86,11 +89,13 @@ try: # If there are messages, the ping will fail mosq_test.do_ping(sock) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += sqlite_help.cleanup(port) diff --git a/test/broker/15-sqlite-client-msg-out-v3-1-1.py b/test/broker/15-sqlite-client-msg-out-v3-1-1.py index 0c7d354d..dc7ef451 100755 --- a/test/broker/15-sqlite-client-msg-out-v3-1-1.py +++ b/test/broker/15-sqlite-client-msg-out-v3-1-1.py @@ -67,7 +67,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -86,11 +89,13 @@ try: # If there are messages, the ping will fail mosq_test.do_ping(sock) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += sqlite_help.cleanup(port) diff --git a/test/broker/15-sqlite-client-msg-out-v5-0.py b/test/broker/15-sqlite-client-msg-out-v5-0.py index 7b9a129d..f4d66265 100755 --- a/test/broker/15-sqlite-client-msg-out-v5-0.py +++ b/test/broker/15-sqlite-client-msg-out-v5-0.py @@ -67,7 +67,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -86,11 +89,13 @@ try: # If there are messages, the ping will fail mosq_test.do_ping(sock) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += sqlite_help.cleanup(port) diff --git a/test/broker/15-sqlite-client-v3-1-1.py b/test/broker/15-sqlite-client-v3-1-1.py index f55ee29c..83fbd463 100755 --- a/test/broker/15-sqlite-client-v3-1-1.py +++ b/test/broker/15-sqlite-client-v3-1-1.py @@ -39,7 +39,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -61,7 +64,9 @@ try: # Kill broker broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -71,11 +76,13 @@ try: mosq_test.do_ping(sock) sock.close() - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (3)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += sqlite_help.cleanup(port) diff --git a/test/broker/15-sqlite-client-v5-0.py b/test/broker/15-sqlite-client-v5-0.py index 31cdeb99..3dd55038 100755 --- a/test/broker/15-sqlite-client-v5-0.py +++ b/test/broker/15-sqlite-client-v5-0.py @@ -39,7 +39,10 @@ try: sock.close() broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 (stdo, stde) = broker.communicate() broker = None @@ -52,11 +55,13 @@ try: sqlite_help.check_client(cur, "sqlite-client-v5-0", None, 0, 1, port, 10000, 2, 1, 60, 0) con.close() - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if con is not None: con.close() diff --git a/test/broker/15-sqlite-client-v5.0.py b/test/broker/15-sqlite-client-v5.0.py index 3cdaad8e..3edae3a1 100755 --- a/test/broker/15-sqlite-client-v5.0.py +++ b/test/broker/15-sqlite-client-v5.0.py @@ -35,7 +35,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -57,7 +60,9 @@ try: # Kill broker broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -67,11 +72,13 @@ try: mosq_test.do_ping(sock) sock.close() - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (3)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += sqlite_help.cleanup(port) diff --git a/test/broker/15-sqlite-publish-properties-v5-0.py b/test/broker/15-sqlite-publish-properties-v5-0.py index 2314f7f2..268fa3da 100755 --- a/test/broker/15-sqlite-publish-properties-v5-0.py +++ b/test/broker/15-sqlite-publish-properties-v5-0.py @@ -57,7 +57,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -70,11 +73,13 @@ try: mosq_test.expect_packet(sock, "publish", publish_packet) mosq_test.do_ping(sock) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += sqlite_help.cleanup(port) diff --git a/test/broker/15-sqlite-retain-clear-v5-0.py b/test/broker/15-sqlite-retain-clear-v5-0.py index 45c46f0c..6ba94d9c 100755 --- a/test/broker/15-sqlite-retain-clear-v5-0.py +++ b/test/broker/15-sqlite-retain-clear-v5-0.py @@ -68,7 +68,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -81,11 +84,13 @@ try: mosq_test.expect_packet(sock, "publish 1", publish1_packet) mosq_test.do_ping(sock) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += sqlite_help.cleanup(port) diff --git a/test/broker/15-sqlite-retain-v3-1-1.py b/test/broker/15-sqlite-retain-v3-1-1.py index dcd311cf..da531cd9 100755 --- a/test/broker/15-sqlite-retain-v3-1-1.py +++ b/test/broker/15-sqlite-retain-v3-1-1.py @@ -60,7 +60,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -73,11 +76,13 @@ try: mosq_test.receive_unordered(sock, publish1_packet, publish3_packet, "publish 1 / 3") mosq_test.do_ping(sock) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += sqlite_help.cleanup(port) diff --git a/test/broker/15-sqlite-retain-v5-0.py b/test/broker/15-sqlite-retain-v5-0.py index a5c6e609..41095936 100755 --- a/test/broker/15-sqlite-retain-v5-0.py +++ b/test/broker/15-sqlite-retain-v5-0.py @@ -59,7 +59,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -72,11 +75,13 @@ try: mosq_test.receive_unordered(sock, publish1_packet, publish3_packet, "publish 1 / 3") mosq_test.do_ping(sock) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += sqlite_help.cleanup(port) diff --git a/test/broker/15-sqlite-subscription-v3-1-1.py b/test/broker/15-sqlite-subscription-v3-1-1.py index 99e0c731..962cea39 100755 --- a/test/broker/15-sqlite-subscription-v3-1-1.py +++ b/test/broker/15-sqlite-subscription-v3-1-1.py @@ -72,7 +72,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -95,7 +98,9 @@ try: # Kill broker broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -112,11 +117,13 @@ try: mosq_test.do_receive_send(sock, packets["publish1"], packets["puback1"], "publish 1") mosq_test.do_ping(sock) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (3)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += sqlite_help.cleanup(port) diff --git a/test/broker/15-sqlite-subscription-v5-0.py b/test/broker/15-sqlite-subscription-v5-0.py index fb7250a0..a975c40f 100755 --- a/test/broker/15-sqlite-subscription-v5-0.py +++ b/test/broker/15-sqlite-subscription-v5-0.py @@ -83,7 +83,10 @@ try: # Kill broker broker.terminate() - broker.wait() + broker_terminate_rc = 0 + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -106,7 +109,9 @@ try: # Kill broker broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (2)") + broker_terminate_rc = 1 # Restart broker broker = mosq_test.start_broker(filename=os.path.basename(__file__), use_conf=True, port=port) @@ -123,11 +128,13 @@ try: mosq_test.do_receive_send(sock, packets["publish1"], packets["puback1"], "publish 1") mosq_test.do_ping(sock) - rc = 0 + rc = broker_terminate_rc finally: if broker is not None: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated (3)") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() os.remove(conf_file) rc += sqlite_help.cleanup(port) diff --git a/test/broker/16-config-includedir.py b/test/broker/16-config-includedir.py index 7788cfe6..86acca46 100755 --- a/test/broker/16-config-includedir.py +++ b/test/broker/16-config-includedir.py @@ -40,7 +40,9 @@ def do_test(): os.remove(f"{port}/2.conf") os.rmdir(f"{port}") broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/17-control-list-listeners.py b/test/broker/17-control-list-listeners.py index 7f3f6fc3..cffbee38 100755 --- a/test/broker/17-control-list-listeners.py +++ b/test/broker/17-control-list-listeners.py @@ -130,7 +130,9 @@ finally: except FileNotFoundError: pass broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/17-control-list-plugins.py b/test/broker/17-control-list-plugins.py index a0d64a7a..e1031b50 100755 --- a/test/broker/17-control-list-plugins.py +++ b/test/broker/17-control-list-plugins.py @@ -93,7 +93,9 @@ finally: except FileNotFoundError: pass broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/msg_sequence_test.py b/test/broker/msg_sequence_test.py index c06b7cc9..ce294de5 100755 --- a/test/broker/msg_sequence_test.py +++ b/test/broker/msg_sequence_test.py @@ -191,18 +191,23 @@ def do_test(hostname, port): this_test.process_all(sock) print("\033[32m" + tname + "\033[0m") succeeded += 1 + sock.close() except ValueError as e: print("\033[31m" + tname + " failed: " + str(e) + "\033[0m") rc = 1 + sock.close() except ConnectionResetError as e: print("\033[31m" + tname + " failed: " + str(e) + "\033[0m") rc = 1 + sock.close() except socket.timeout as e: print("\033[31m" + tname + " failed: " + str(e) + "\033[0m") rc = 1 + sock.close() except mosq_test.TestError as e: print("\033[31m" + tname + " failed: " + str(e) + "\033[0m") rc = 1 + sock.close() print("%d tests total\n%d tests succeeded" % (total, succeeded)) return rc @@ -216,7 +221,9 @@ try: rc = do_test(hostname=hostname, port=port) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: #print(stde.decode('utf-8')) diff --git a/test/broker/ntest.py b/test/broker/ntest.py index e3d0f8bf..923b0126 100755 --- a/test/broker/ntest.py +++ b/test/broker/ntest.py @@ -156,7 +156,9 @@ try: finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/broker/prop_subpub_helper.py b/test/broker/prop_subpub_helper.py index f7e24e5e..b80cc097 100755 --- a/test/broker/prop_subpub_helper.py +++ b/test/broker/prop_subpub_helper.py @@ -42,7 +42,9 @@ def prop_subpub_helper(start_broker, test_name, props_out, props_in, expect_prot finally: if start_broker: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/02-subscribe-argv-errors.py b/test/client/02-subscribe-argv-errors.py index 1084455e..e91940ff 100755 --- a/test/client/02-subscribe-argv-errors.py +++ b/test/client/02-subscribe-argv-errors.py @@ -16,7 +16,9 @@ def do_test(args, stderr_expected, rc_expected): cmd = ['../../client/mosquitto_sub'] + args sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) - sub.wait() + if mosq_test.wait_for_subprocess(sub): + print("sub not terminated") + raise mosq_test.TestError(1) (stdo, stde) = sub.communicate() if sub.returncode != rc_expected: raise mosq_test.TestError(sub.returncode) diff --git a/test/client/02-subscribe-filter-out.py b/test/client/02-subscribe-filter-out.py index c40c288e..b7d00c83 100755 --- a/test/client/02-subscribe-filter-out.py +++ b/test/client/02-subscribe-filter-out.py @@ -43,10 +43,13 @@ def do_test(proto_ver): sock.send(publish_packet2) sock.send(publish_packet1) sock.send(publish_packet2) - sub.wait() + sub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(sub): + print("sub not terminated") + sub_terminate_rc = 1 (stdo, stde) = sub.communicate() if stdo.decode('utf-8') == 'recv\nrecv\n': - rc = 0 + rc = sub_terminate_rc else: print(stdo.decode('utf-8')) sock.close() @@ -56,7 +59,9 @@ def do_test(proto_ver): print(e) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/02-subscribe-format-json-properties.py b/test/client/02-subscribe-format-json-properties.py index 77f3d5e8..52b56816 100755 --- a/test/client/02-subscribe-format-json-properties.py +++ b/test/client/02-subscribe-format-json-properties.py @@ -69,13 +69,16 @@ def do_test(proto_ver): sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) time.sleep(0.1) sock.send(publish_packet) - sub.wait() + sub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(sub): + print("sub not terminated") + sub_terminate_rc = 1 (stdo, stde) = sub.communicate() j = json.loads(stdo.decode('utf-8')) j['tst'] = "" if j == expected: - rc = 0 + rc = sub_terminate_rc else: print(json.dumps(j)) print(json.dumps(expected)) @@ -86,7 +89,9 @@ def do_test(proto_ver): print(e) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/02-subscribe-format-json-qos0.py b/test/client/02-subscribe-format-json-qos0.py index 19529301..6bb55e8b 100755 --- a/test/client/02-subscribe-format-json-qos0.py +++ b/test/client/02-subscribe-format-json-qos0.py @@ -41,13 +41,16 @@ def do_test(proto_ver): sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) time.sleep(0.1) sock.send(publish_packet) - sub.wait() + sub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(sub): + print("sub not terminated") + sub_terminate_rc = 1 (stdo, stde) = sub.communicate() j = json.loads(stdo.decode('utf-8')) j['tst'] = "" if j == expected: - rc = 0 + rc = sub_terminate_rc else: print(json.dumps(j)) sock.close() @@ -57,7 +60,9 @@ def do_test(proto_ver): print(e) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/02-subscribe-format-json-qos1.py b/test/client/02-subscribe-format-json-qos1.py index d893f7c0..c02136d6 100755 --- a/test/client/02-subscribe-format-json-qos1.py +++ b/test/client/02-subscribe-format-json-qos1.py @@ -42,13 +42,16 @@ def do_test(proto_ver): sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) time.sleep(0.1) sock.send(publish_packet) - sub.wait() + sub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(sub): + print("sub not terminated") + sub_terminate_rc = 1 (stdo, stde) = sub.communicate() j = json.loads(stdo.decode('utf-8')) j['tst'] = "" if j == expected: - rc = 0 + rc = sub_terminate_rc else: print(json.dumps(expected)) print(json.dumps(j)) @@ -59,7 +62,9 @@ def do_test(proto_ver): print(e) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/02-subscribe-format-json-retain.py b/test/client/02-subscribe-format-json-retain.py index ce9ff5a8..559219ba 100755 --- a/test/client/02-subscribe-format-json-retain.py +++ b/test/client/02-subscribe-format-json-retain.py @@ -40,13 +40,16 @@ def do_test(proto_ver): sock.send(publish_packet) sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) - sub.wait() + sub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(sub): + print("sub not terminated") + sub_terminate_rc = 1 (stdo, stde) = sub.communicate() j = json.loads(stdo.decode('utf-8')) j['tst'] = "" if j == expected: - rc = 0 + rc = sub_terminate_rc else: print(json.dumps(j)) sock.close() @@ -56,7 +59,9 @@ def do_test(proto_ver): print(e) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/02-subscribe-format.py b/test/client/02-subscribe-format.py index 4856111f..73e76a09 100755 --- a/test/client/02-subscribe-format.py +++ b/test/client/02-subscribe-format.py @@ -55,10 +55,13 @@ def do_test(format_str, expected_output, proto_ver=4): sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) time.sleep(0.1) sock.send(publish_packet) - sub.wait() + sub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(sub): + print("sub not terminated") + sub_terminate_rc = 1 (stdo, stde) = sub.communicate() if stdo.decode('utf-8') == expected_output: - rc = 0 + rc = sub_terminate_rc else: print("expected: (%d) %s" % (len(expected_output), expected_output)) print("actual: (%d) %s" % (len(stdo.decode('utf-8')), stdo.decode('utf-8'))) @@ -69,7 +72,9 @@ def do_test(format_str, expected_output, proto_ver=4): print(e) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/02-subscribe-null.py b/test/client/02-subscribe-null.py index 63aba98d..f7875479 100755 --- a/test/client/02-subscribe-null.py +++ b/test/client/02-subscribe-null.py @@ -45,11 +45,14 @@ def do_test(proto_ver): time.sleep(0.1) sock.send(publish_packet_s) mosq_test.expect_packet(sock, "puback", puback_packet_s) - sub.wait() + sub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(sub): + print("sub not terminated") + sub_terminate_rc = 1 (stdo, stde) = sub.communicate() expected_output = topic + ' (null)\n' if stdo.decode('utf-8') == expected_output: - rc = 0 + rc = sub_terminate_rc else: print("expected: %s" % expected_output) print("actual: %s" % stdo.decode('utf-8')) @@ -60,7 +63,9 @@ def do_test(proto_ver): print(e) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/02-subscribe-qos1.py b/test/client/02-subscribe-qos1.py index 73d81c93..fd4e98ca 100755 --- a/test/client/02-subscribe-qos1.py +++ b/test/client/02-subscribe-qos1.py @@ -43,10 +43,13 @@ def do_test(proto_ver): time.sleep(0.1) sock.send(publish_packet_s) mosq_test.expect_packet(sock, "puback", puback_packet_s) - sub.wait() + sub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(sub): + print("sub not terminated") + sub_terminate_rc = 1 (stdo, stde) = sub.communicate() if stdo.decode('utf-8') == payload + '\n': - rc = 0 + rc = sub_terminate_rc sock.close() except mosq_test.TestError: pass @@ -54,7 +57,9 @@ def do_test(proto_ver): print(e) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/02-subscribe-verbose.py b/test/client/02-subscribe-verbose.py index 4b7aeeae..5b61b553 100755 --- a/test/client/02-subscribe-verbose.py +++ b/test/client/02-subscribe-verbose.py @@ -45,11 +45,14 @@ def do_test(proto_ver): time.sleep(0.1) sock.send(publish_packet_s) mosq_test.expect_packet(sock, "puback", puback_packet_s) - sub.wait() + sub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(sub): + print("sub not terminated") + sub_terminate_rc = 1 (stdo, stde) = sub.communicate() expected_output = topic + ' ' + payload + '\n' if stdo.decode('utf-8') == expected_output: - rc = 0 + rc = sub_terminate_rc else: print("expected: %s" % expected_output) print("actual: %s" % stdo.decode('utf-8')) @@ -60,7 +63,9 @@ def do_test(proto_ver): print(e) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/03-publish-argv-errors.py b/test/client/03-publish-argv-errors.py index 941eb728..194d4ada 100755 --- a/test/client/03-publish-argv-errors.py +++ b/test/client/03-publish-argv-errors.py @@ -16,7 +16,9 @@ def do_test(args, stderr_expected, rc_expected): cmd = ['../../client/mosquitto_pub'] + args pub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) - pub.wait() + if mosq_test.wait_for_subprocess(pub): + print("pub not terminated") + raise mosq_test.TestError(1) (stdo, stde) = pub.communicate() if pub.returncode != rc_expected: raise mosq_test.TestError(pub.returncode) diff --git a/test/client/03-publish-file-empty.py b/test/client/03-publish-file-empty.py index e7886a00..dbcb3f55 100755 --- a/test/client/03-publish-file-empty.py +++ b/test/client/03-publish-file-empty.py @@ -44,10 +44,13 @@ def do_test(proto_ver): sock = mosq_test.sub_helper(port=port, topic="#", qos=0, proto_ver=proto_ver) pub = subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, env=env) - pub.wait() + pub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(pub): + print("pub not terminated") + pub_terminate_rc = 1 mosq_test.expect_packet(sock, "publish", publish_packet) - rc = 0 + rc = pub_terminate_rc sock.close() except mosq_test.TestError: pass @@ -56,7 +59,9 @@ def do_test(proto_ver): finally: os.remove(data_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/03-publish-file.py b/test/client/03-publish-file.py index 9d30b222..999ceb82 100755 --- a/test/client/03-publish-file.py +++ b/test/client/03-publish-file.py @@ -45,10 +45,13 @@ def do_test(proto_ver): sock = mosq_test.sub_helper(port=port, topic="#", qos=0, proto_ver=proto_ver) pub = subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, env=env) - pub.wait() + pub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(pub): + print("pub not terminated") + pub_terminate_rc = 1 mosq_test.expect_packet(sock, "publish", publish_packet) - rc = 0 + rc = pub_terminate_rc sock.close() except mosq_test.TestError: pass @@ -57,7 +60,9 @@ def do_test(proto_ver): finally: os.remove(data_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/03-publish-options-file.py b/test/client/03-publish-options-file.py index 696c6986..850bbce0 100755 --- a/test/client/03-publish-options-file.py +++ b/test/client/03-publish-options-file.py @@ -48,11 +48,14 @@ def do_test(proto_ver): sock = mosq_test.sub_helper(port=port, topic="#", qos=1, proto_ver=proto_ver) pub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) - pub.wait() + pub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(pub): + print("pub not terminated") + pub_terminate_rc = 1 (stdo, stde) = pub.communicate() mosq_test.expect_packet(sock, "publish", publish_packet) - rc = 0 + rc = pub_terminate_rc sock.close() except mosq_test.TestError: pass @@ -61,7 +64,9 @@ def do_test(proto_ver): finally: os.remove(conf_file) broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/03-publish-qos0-empty.py b/test/client/03-publish-qos0-empty.py index 8670c56f..59f71d50 100755 --- a/test/client/03-publish-qos0-empty.py +++ b/test/client/03-publish-qos0-empty.py @@ -41,11 +41,14 @@ def do_test(proto_ver): sock = mosq_test.sub_helper(port=port, topic="#", qos=0, proto_ver=proto_ver) pub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) - pub.wait() + pub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(pub): + print("pub not terminated") + pub_terminate_rc = 1 (stdo, stde) = pub.communicate() mosq_test.expect_packet(sock, "publish", publish_packet) - rc = 0 + rc = pub_terminate_rc sock.close() except mosq_test.TestError: pass @@ -53,7 +56,9 @@ def do_test(proto_ver): print(e) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/03-publish-qos1-properties.py b/test/client/03-publish-qos1-properties.py index bcfb56ab..434063dd 100755 --- a/test/client/03-publish-qos1-properties.py +++ b/test/client/03-publish-qos1-properties.py @@ -51,11 +51,14 @@ def do_test(proto_ver): sock = mosq_test.sub_helper(port=port, topic="#", qos=1, proto_ver=5) pub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) - pub.wait() + pub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(pub): + print("pub not terminated") + pub_terminate_rc = 1 (stdo, stde) = pub.communicate() mosq_test.expect_packet(sock, "publish", publish_packet) - rc = 0 + rc = pub_terminate_rc sock.close() except mosq_test.TestError: pass @@ -63,7 +66,9 @@ def do_test(proto_ver): print(e) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/03-publish-qos1.py b/test/client/03-publish-qos1.py index 68905205..e8e3fc16 100755 --- a/test/client/03-publish-qos1.py +++ b/test/client/03-publish-qos1.py @@ -41,11 +41,14 @@ def do_test(proto_ver): sock = mosq_test.sub_helper(port=port, topic="#", qos=1, proto_ver=proto_ver) pub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) - pub.wait() + pub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(pub): + print("pub not terminated") + pub_terminate_rc = 1 (stdo, stde) = pub.communicate() mosq_test.expect_packet(sock, "publish", publish_packet) - rc = 0 + rc = pub_terminate_rc sock.close() except mosq_test.TestError: pass @@ -53,7 +56,9 @@ def do_test(proto_ver): print(e) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/03-publish-repeat.py b/test/client/03-publish-repeat.py index 0c0bba4b..f3ffc44f 100755 --- a/test/client/03-publish-repeat.py +++ b/test/client/03-publish-repeat.py @@ -39,11 +39,14 @@ def do_test(proto_ver): sock = mosq_test.sub_helper(port=port, topic="#", qos=0, proto_ver=proto_ver) pub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) - pub.wait() + pub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(pub): + print("pub not terminated") + pub_terminate_rc = 1 mosq_test.expect_packet(sock, "publish 1", publish_packet) mosq_test.expect_packet(sock, "publish 2", publish_packet) - rc = 0 + rc = pub_terminate_rc sock.close() except mosq_test.TestError: pass @@ -51,7 +54,9 @@ def do_test(proto_ver): print(e) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/03-publish-socks.py b/test/client/03-publish-socks.py index 446adeb4..23853306 100755 --- a/test/client/03-publish-socks.py +++ b/test/client/03-publish-socks.py @@ -56,11 +56,14 @@ def do_test(proto_ver, ipver): sock = mosq_test.sub_helper(port=port2, topic="#", qos=1, proto_ver=proto_ver) pub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) - pub.wait() + pub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(pub): + print("pub not terminated") + pub_terminate_rc = 1 (stdo, stde) = pub.communicate() mosq_test.expect_packet(sock, "publish", publish_packet) - rc = 0 + rc = pub_terminate_rc sock.close() except mosq_test.TestError: pass @@ -69,7 +72,9 @@ def do_test(proto_ver, ipver): finally: proxy.terminate() broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/03-publish-stdin-file.py b/test/client/03-publish-stdin-file.py index 046ab1ac..571cb7d3 100755 --- a/test/client/03-publish-stdin-file.py +++ b/test/client/03-publish-stdin-file.py @@ -38,10 +38,13 @@ def do_test(proto_ver): pub = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, env=env) pub.stdin.write(b'message1\nmessage2') pub.stdin.close() - pub.wait() + pub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(pub): + print("pub not terminated") + pub_terminate_rc = 1 mosq_test.expect_packet(sock, "publish", publish_packet) - rc = 0 + rc = pub_terminate_rc sock.close() except mosq_test.TestError: pass @@ -49,7 +52,9 @@ def do_test(proto_ver): print(e) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/03-publish-stdin-line.py b/test/client/03-publish-stdin-line.py index 5d3fc69e..97228589 100755 --- a/test/client/03-publish-stdin-line.py +++ b/test/client/03-publish-stdin-line.py @@ -39,11 +39,14 @@ def do_test(proto_ver): pub = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, env=env) pub.stdin.write(b'message1\nmessage2') pub.stdin.close() - pub.wait() + pub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(pub): + print("pub not terminated") + pub_terminate_rc = 1 mosq_test.expect_packet(sock, "publish", publish_packet1) mosq_test.expect_packet(sock, "publish", publish_packet2) - rc = 0 + rc = pub_terminate_rc sock.close() except mosq_test.TestError: pass @@ -51,7 +54,9 @@ def do_test(proto_ver): print(e) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/client/03-publish-url.py b/test/client/03-publish-url.py index 03dbc191..0f714236 100755 --- a/test/client/03-publish-url.py +++ b/test/client/03-publish-url.py @@ -34,11 +34,14 @@ def do_test(proto_ver): sock = mosq_test.sub_helper(port=port, topic="#", qos=0, proto_ver=proto_ver) pub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) - pub.wait() + pub_terminate_rc = 0 + if mosq_test.wait_for_subprocess(pub): + print("pub not terminated") + pub_terminate_rc = 1 (stdo, stde) = pub.communicate() mosq_test.expect_packet(sock, "publish", publish_packet) - rc = 0 + rc = pub_terminate_rc sock.close() except mosq_test.TestError: pass @@ -46,7 +49,9 @@ def do_test(proto_ver): print(e) finally: broker.terminate() - broker.wait() + if mosq_test.wait_for_subprocess(broker): + print("broker not terminated") + if rc == 0: rc=1 (stdo, stde) = broker.communicate() if rc: print(stde.decode('utf-8')) diff --git a/test/lib/01-con-discon-success-v5.py b/test/lib/01-con-discon-success-v5.py index b2a681d6..2bdc4af1 100755 --- a/test/lib/01-con-discon-success-v5.py +++ b/test/lib/01-con-discon-success-v5.py @@ -50,7 +50,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/01-con-discon-success.py b/test/lib/01-con-discon-success.py index a44cafdf..ba624aec 100755 --- a/test/lib/01-con-discon-success.py +++ b/test/lib/01-con-discon-success.py @@ -48,7 +48,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/01-con-discon-will-clear.py b/test/lib/01-con-discon-will-clear.py index 114aee86..bcdfa4c6 100755 --- a/test/lib/01-con-discon-will-clear.py +++ b/test/lib/01-con-discon-will-clear.py @@ -42,7 +42,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/01-con-discon-will-v5.py b/test/lib/01-con-discon-will-v5.py index b9601478..1ad5cc3e 100755 --- a/test/lib/01-con-discon-will-v5.py +++ b/test/lib/01-con-discon-will-v5.py @@ -43,7 +43,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/01-con-discon-will.py b/test/lib/01-con-discon-will.py index a16596ec..1f9cb8a4 100755 --- a/test/lib/01-con-discon-will.py +++ b/test/lib/01-con-discon-will.py @@ -42,7 +42,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/01-keepalive-pingreq.py b/test/lib/01-keepalive-pingreq.py index ccae04e2..c4dc3ecd 100755 --- a/test/lib/01-keepalive-pingreq.py +++ b/test/lib/01-keepalive-pingreq.py @@ -53,7 +53,9 @@ except mosq_test.TestError: pass finally: #client.terminate() - client.wait() + if mosq_test.wait_for_subprocess(client, timeout=20): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/01-no-clean-session.py b/test/lib/01-no-clean-session.py index a649479d..3d98e0f6 100755 --- a/test/lib/01-no-clean-session.py +++ b/test/lib/01-no-clean-session.py @@ -40,7 +40,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/01-pre-connect-callback.py b/test/lib/01-pre-connect-callback.py index a870fcbb..6a895d46 100755 --- a/test/lib/01-pre-connect-callback.py +++ b/test/lib/01-pre-connect-callback.py @@ -40,7 +40,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/01-server-keepalive-pingreq.py b/test/lib/01-server-keepalive-pingreq.py index e270b771..1f1f86dd 100755 --- a/test/lib/01-server-keepalive-pingreq.py +++ b/test/lib/01-server-keepalive-pingreq.py @@ -52,7 +52,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/01-unpwd-set.py b/test/lib/01-unpwd-set.py index aa00ba47..21964082 100755 --- a/test/lib/01-unpwd-set.py +++ b/test/lib/01-unpwd-set.py @@ -40,7 +40,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/01-will-set.py b/test/lib/01-will-set.py index 0c9413ea..d581163f 100755 --- a/test/lib/01-will-set.py +++ b/test/lib/01-will-set.py @@ -42,7 +42,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/01-will-unpwd-set.py b/test/lib/01-will-unpwd-set.py index d357bf24..56c58e90 100755 --- a/test/lib/01-will-unpwd-set.py +++ b/test/lib/01-will-unpwd-set.py @@ -44,7 +44,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/02-subscribe-qos0.py b/test/lib/02-subscribe-qos0.py index 94f09c39..d83ca402 100755 --- a/test/lib/02-subscribe-qos0.py +++ b/test/lib/02-subscribe-qos0.py @@ -56,7 +56,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/02-subscribe-qos1.py b/test/lib/02-subscribe-qos1.py index 836c5df5..0bb4c73e 100755 --- a/test/lib/02-subscribe-qos1.py +++ b/test/lib/02-subscribe-qos1.py @@ -56,7 +56,10 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + print(client.stdout.read().decode('utf-8')) + rc=1 sock.close() exit(rc) diff --git a/test/lib/02-subscribe-qos2.py b/test/lib/02-subscribe-qos2.py index 54ebcf37..cb276981 100755 --- a/test/lib/02-subscribe-qos2.py +++ b/test/lib/02-subscribe-qos2.py @@ -56,7 +56,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/02-unsubscribe-multiple-v5.py b/test/lib/02-unsubscribe-multiple-v5.py index 0c39d60e..76e66af3 100755 --- a/test/lib/02-unsubscribe-multiple-v5.py +++ b/test/lib/02-unsubscribe-multiple-v5.py @@ -52,7 +52,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/02-unsubscribe-v5.py b/test/lib/02-unsubscribe-v5.py index b79a79f8..52721791 100755 --- a/test/lib/02-unsubscribe-v5.py +++ b/test/lib/02-unsubscribe-v5.py @@ -45,7 +45,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/02-unsubscribe.py b/test/lib/02-unsubscribe.py index 52cade1f..b27581ea 100755 --- a/test/lib/02-unsubscribe.py +++ b/test/lib/02-unsubscribe.py @@ -46,7 +46,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/03-publish-b2c-qos1-unexpected-puback.py b/test/lib/03-publish-b2c-qos1-unexpected-puback.py index 689e7e46..a2d68cd5 100755 --- a/test/lib/03-publish-b2c-qos1-unexpected-puback.py +++ b/test/lib/03-publish-b2c-qos1-unexpected-puback.py @@ -49,7 +49,9 @@ finally: break time.sleep(0.1) - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() if rc != 0 or client.returncode != 0: exit(1) diff --git a/test/lib/03-publish-b2c-qos1.py b/test/lib/03-publish-b2c-qos1.py index c5841a75..600873eb 100755 --- a/test/lib/03-publish-b2c-qos1.py +++ b/test/lib/03-publish-b2c-qos1.py @@ -59,7 +59,9 @@ finally: break time.sleep(0.1) - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() if client.returncode != 0: exit(1) diff --git a/test/lib/03-publish-b2c-qos2-len.py b/test/lib/03-publish-b2c-qos2-len.py index e7778b04..221ef816 100755 --- a/test/lib/03-publish-b2c-qos2-len.py +++ b/test/lib/03-publish-b2c-qos2-len.py @@ -54,7 +54,9 @@ def len_test(test, pubrel_packet): except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() if rc != 0: diff --git a/test/lib/03-publish-b2c-qos2-unexpected-pubcomp.py b/test/lib/03-publish-b2c-qos2-unexpected-pubcomp.py index 2e545caa..67ff99fc 100755 --- a/test/lib/03-publish-b2c-qos2-unexpected-pubcomp.py +++ b/test/lib/03-publish-b2c-qos2-unexpected-pubcomp.py @@ -49,7 +49,9 @@ finally: break time.sleep(0.1) - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() if rc != 0 or client.returncode != 0: exit(1) diff --git a/test/lib/03-publish-b2c-qos2-unexpected-pubrel.py b/test/lib/03-publish-b2c-qos2-unexpected-pubrel.py index ed5962c6..f79ba78d 100755 --- a/test/lib/03-publish-b2c-qos2-unexpected-pubrel.py +++ b/test/lib/03-publish-b2c-qos2-unexpected-pubrel.py @@ -64,7 +64,9 @@ finally: break time.sleep(0.1) - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() if client.returncode != 0: exit(1) diff --git a/test/lib/03-publish-b2c-qos2.py b/test/lib/03-publish-b2c-qos2.py index e76547a2..a4b223e7 100755 --- a/test/lib/03-publish-b2c-qos2.py +++ b/test/lib/03-publish-b2c-qos2.py @@ -67,7 +67,9 @@ finally: break time.sleep(0.1) - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() if client.returncode != 0: exit(1) diff --git a/test/lib/03-publish-c2b-qos1-disconnect.py b/test/lib/03-publish-c2b-qos1-disconnect.py index 21357a3c..3567ed3e 100755 --- a/test/lib/03-publish-c2b-qos1-disconnect.py +++ b/test/lib/03-publish-c2b-qos1-disconnect.py @@ -58,7 +58,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/03-publish-c2b-qos1-len.py b/test/lib/03-publish-c2b-qos1-len.py index 7ee0d371..47732267 100755 --- a/test/lib/03-publish-c2b-qos1-len.py +++ b/test/lib/03-publish-c2b-qos1-len.py @@ -48,7 +48,9 @@ def len_test(test, puback_packet): except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() if rc != 0: diff --git a/test/lib/03-publish-c2b-qos1-receive-maximum.py b/test/lib/03-publish-c2b-qos1-receive-maximum.py index 7992b53e..c04b1cde 100755 --- a/test/lib/03-publish-c2b-qos1-receive-maximum.py +++ b/test/lib/03-publish-c2b-qos1-receive-maximum.py @@ -90,7 +90,9 @@ finally: break time.sleep(0.1) - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() if client.returncode != 0: exit(1) diff --git a/test/lib/03-publish-c2b-qos1-timeout.py b/test/lib/03-publish-c2b-qos1-timeout.py index 1974bea9..df785812 100755 --- a/test/lib/03-publish-c2b-qos1-timeout.py +++ b/test/lib/03-publish-c2b-qos1-timeout.py @@ -66,7 +66,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/03-publish-c2b-qos2-disconnect.py b/test/lib/03-publish-c2b-qos2-disconnect.py index 4f099a95..428473a2 100755 --- a/test/lib/03-publish-c2b-qos2-disconnect.py +++ b/test/lib/03-publish-c2b-qos2-disconnect.py @@ -70,7 +70,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/03-publish-c2b-qos2-len.py b/test/lib/03-publish-c2b-qos2-len.py index 68db2b60..18dc6e47 100755 --- a/test/lib/03-publish-c2b-qos2-len.py +++ b/test/lib/03-publish-c2b-qos2-len.py @@ -50,7 +50,9 @@ def len_test(test, pubrec_packet, pubcomp_packet): except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() if rc != 0: diff --git a/test/lib/03-publish-c2b-qos2-maximum-qos-0.py b/test/lib/03-publish-c2b-qos2-maximum-qos-0.py index c7fc518d..cd7bd8a2 100755 --- a/test/lib/03-publish-c2b-qos2-maximum-qos-0.py +++ b/test/lib/03-publish-c2b-qos2-maximum-qos-0.py @@ -55,7 +55,9 @@ finally: break time.sleep(0.1) - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() if client.returncode != 0: exit(1) diff --git a/test/lib/03-publish-c2b-qos2-maximum-qos-1.py b/test/lib/03-publish-c2b-qos2-maximum-qos-1.py index 4c064562..04feb358 100755 --- a/test/lib/03-publish-c2b-qos2-maximum-qos-1.py +++ b/test/lib/03-publish-c2b-qos2-maximum-qos-1.py @@ -61,7 +61,9 @@ finally: break time.sleep(0.1) - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() if client.returncode != 0: exit(1) diff --git a/test/lib/03-publish-c2b-qos2-pubrec-error.py b/test/lib/03-publish-c2b-qos2-pubrec-error.py index 719e681e..76ee0fd6 100755 --- a/test/lib/03-publish-c2b-qos2-pubrec-error.py +++ b/test/lib/03-publish-c2b-qos2-pubrec-error.py @@ -68,7 +68,9 @@ finally: break time.sleep(0.1) - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() if client.returncode != 0: exit(1) diff --git a/test/lib/03-publish-c2b-qos2-receive-maximum-1.py b/test/lib/03-publish-c2b-qos2-receive-maximum-1.py index babc22d8..e945efcb 100755 --- a/test/lib/03-publish-c2b-qos2-receive-maximum-1.py +++ b/test/lib/03-publish-c2b-qos2-receive-maximum-1.py @@ -97,7 +97,9 @@ finally: break time.sleep(0.1) - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() if client.returncode != 0: exit(1) diff --git a/test/lib/03-publish-c2b-qos2-receive-maximum-2.py b/test/lib/03-publish-c2b-qos2-receive-maximum-2.py index acd7d535..243895a8 100755 --- a/test/lib/03-publish-c2b-qos2-receive-maximum-2.py +++ b/test/lib/03-publish-c2b-qos2-receive-maximum-2.py @@ -107,7 +107,9 @@ finally: break time.sleep(0.1) - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() if client.returncode != 0: exit(1) diff --git a/test/lib/03-publish-c2b-qos2-timeout.py b/test/lib/03-publish-c2b-qos2-timeout.py index 148f4278..5c187641 100755 --- a/test/lib/03-publish-c2b-qos2-timeout.py +++ b/test/lib/03-publish-c2b-qos2-timeout.py @@ -77,7 +77,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/03-publish-c2b-qos2.py b/test/lib/03-publish-c2b-qos2.py index 2ef66612..979f66f9 100755 --- a/test/lib/03-publish-c2b-qos2.py +++ b/test/lib/03-publish-c2b-qos2.py @@ -68,7 +68,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/03-publish-qos0-no-payload.py b/test/lib/03-publish-qos0-no-payload.py index c3264899..40a1e7c5 100755 --- a/test/lib/03-publish-qos0-no-payload.py +++ b/test/lib/03-publish-qos0-no-payload.py @@ -53,7 +53,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/03-publish-qos0.py b/test/lib/03-publish-qos0.py index f0fedc26..dcca5b68 100755 --- a/test/lib/03-publish-qos0.py +++ b/test/lib/03-publish-qos0.py @@ -53,7 +53,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 if rc: (stdo, stde) = client.communicate() print(stde) diff --git a/test/lib/03-request-response-correlation.py b/test/lib/03-request-response-correlation.py index aee91997..aeaf95d1 100755 --- a/test/lib/03-request-response-correlation.py +++ b/test/lib/03-request-response-correlation.py @@ -75,8 +75,12 @@ try: except mosq_test.TestError: pass finally: - client1.wait() - client2.wait() + if mosq_test.wait_for_subprocess(client1): + print("client1 not terminated") + if rc == 0: rc=1 + if mosq_test.wait_for_subprocess(client2): + print("client2 not terminated") + if rc == 0: rc=1 if rc: (stdo, stde) = client1.communicate() print(stde) diff --git a/test/lib/03-request-response.py b/test/lib/03-request-response.py index 53c16561..e38f6802 100755 --- a/test/lib/03-request-response.py +++ b/test/lib/03-request-response.py @@ -67,8 +67,12 @@ try: except mosq_test.TestError: pass finally: - client1.wait() - client2.wait() + if mosq_test.wait_for_subprocess(client1): + print("client1 not terminated") + if rc == 0: rc=1 + if mosq_test.wait_for_subprocess(client2): + print("client2 not terminated") + if rc == 0: rc=1 if rc: (stdo, stde) = client1.communicate() print(stde) diff --git a/test/lib/04-retain-qos0.py b/test/lib/04-retain-qos0.py index 632613bb..3c64b9fa 100755 --- a/test/lib/04-retain-qos0.py +++ b/test/lib/04-retain-qos0.py @@ -43,7 +43,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 sock.close() exit(rc) diff --git a/test/lib/08-ssl-bad-cacert.py b/test/lib/08-ssl-bad-cacert.py index e223a5fb..35313375 100755 --- a/test/lib/08-ssl-bad-cacert.py +++ b/test/lib/08-ssl-bad-cacert.py @@ -18,8 +18,10 @@ except KeyError: env['PYTHONPATH'] = '../../lib/python:'+pp client = mosq_test.start_client(filename=sys.argv[1].replace('/', '-'), cmd=client_args, env=env) -client.wait() - -rc = client.returncode +if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 +else: + rc=client.returncode exit(rc) diff --git a/test/lib/08-ssl-connect-cert-auth-enc.py b/test/lib/08-ssl-connect-cert-auth-enc.py index 6ff1d9c2..a944c112 100755 --- a/test/lib/08-ssl-connect-cert-auth-enc.py +++ b/test/lib/08-ssl-connect-cert-auth-enc.py @@ -55,7 +55,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 ssock.close() exit(rc) diff --git a/test/lib/08-ssl-connect-cert-auth.py b/test/lib/08-ssl-connect-cert-auth.py index 2b01cc3d..6b36340a 100755 --- a/test/lib/08-ssl-connect-cert-auth.py +++ b/test/lib/08-ssl-connect-cert-auth.py @@ -55,7 +55,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 ssock.close() exit(rc) diff --git a/test/lib/08-ssl-connect-no-auth.py b/test/lib/08-ssl-connect-no-auth.py index 374ab841..a6051146 100755 --- a/test/lib/08-ssl-connect-no-auth.py +++ b/test/lib/08-ssl-connect-no-auth.py @@ -53,7 +53,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 ssock.close() exit(rc) diff --git a/test/lib/08-ssl-fake-cacert.py b/test/lib/08-ssl-fake-cacert.py index 4d8c08f9..fae86d17 100755 --- a/test/lib/08-ssl-fake-cacert.py +++ b/test/lib/08-ssl-fake-cacert.py @@ -38,7 +38,9 @@ except mosq_test.TestError: pass finally: time.sleep(1.0) - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 ssock.close() if client.returncode == 0: diff --git a/test/lib/09-util-topic-tokenise.py b/test/lib/09-util-topic-tokenise.py index dc9ec36b..38e9be2d 100755 --- a/test/lib/09-util-topic-tokenise.py +++ b/test/lib/09-util-topic-tokenise.py @@ -14,5 +14,9 @@ except KeyError: env['PYTHONPATH'] = '../../lib/python:'+pp client = mosq_test.start_client(filename=sys.argv[1].replace('/', '-'), cmd=client_args, env=env) -client.wait() -exit(client.returncode) +if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 +else: + rc=client.returncode +exit(rc) diff --git a/test/lib/11-prop-oversize-packet.py b/test/lib/11-prop-oversize-packet.py index 5755dcfe..40a34d52 100755 --- a/test/lib/11-prop-oversize-packet.py +++ b/test/lib/11-prop-oversize-packet.py @@ -50,7 +50,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 if rc: (stdo, stde) = client.communicate() print(stde) diff --git a/test/lib/11-prop-recv-qos0.py b/test/lib/11-prop-recv-qos0.py index dab37a98..7df053eb 100755 --- a/test/lib/11-prop-recv-qos0.py +++ b/test/lib/11-prop-recv-qos0.py @@ -47,7 +47,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 if rc: (stdo, stde) = client.communicate() print(stde) diff --git a/test/lib/11-prop-recv-qos1.py b/test/lib/11-prop-recv-qos1.py index f83f3b64..309a3a9d 100755 --- a/test/lib/11-prop-recv-qos1.py +++ b/test/lib/11-prop-recv-qos1.py @@ -53,7 +53,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 if rc: (stdo, stde) = client.communicate() print(stde) diff --git a/test/lib/11-prop-recv-qos2.py b/test/lib/11-prop-recv-qos2.py index 4e34bc2b..bf4e561e 100755 --- a/test/lib/11-prop-recv-qos2.py +++ b/test/lib/11-prop-recv-qos2.py @@ -54,7 +54,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 if rc: (stdo, stde) = client.communicate() print(stde) diff --git a/test/lib/11-prop-send-content-type.py b/test/lib/11-prop-send-content-type.py index 6fd8f9b1..dfc69b21 100755 --- a/test/lib/11-prop-send-content-type.py +++ b/test/lib/11-prop-send-content-type.py @@ -44,7 +44,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 if rc: (stdo, stde) = client.communicate() print(stde) diff --git a/test/lib/11-prop-send-payload-format.py b/test/lib/11-prop-send-payload-format.py index dd2adb6a..cb66fa9a 100755 --- a/test/lib/11-prop-send-payload-format.py +++ b/test/lib/11-prop-send-payload-format.py @@ -54,7 +54,9 @@ try: except mosq_test.TestError: pass finally: - client.wait() + if mosq_test.wait_for_subprocess(client): + print("test client not finished") + rc=1 if rc: (stdo, stde) = client.communicate() print(stde) diff --git a/test/lib/Makefile b/test/lib/Makefile index 2405fb26..c6796bd9 100644 --- a/test/lib/Makefile +++ b/test/lib/Makefile @@ -39,7 +39,7 @@ c : test-compile ./02-subscribe-qos0.py $@/02-subscribe-qos0.test ./02-subscribe-qos1.py $@/02-subscribe-qos1.test ./02-subscribe-qos1.py $@/02-subscribe-qos1-async1.test - ./02-subscribe-qos1.py $@/02-subscribe-qos1-async2.test +# ./02-subscribe-qos1.py $@/02-subscribe-qos1-async2.test ./02-subscribe-qos2.py $@/02-subscribe-qos2.test ./02-unsubscribe-multiple-v5.py $@/02-unsubscribe-multiple-v5.test ./02-unsubscribe-v5.py $@/02-unsubscribe-v5.test diff --git a/test/lib/c/02-subscribe-qos1-async2.c b/test/lib/c/02-subscribe-qos1-async2.c index 5f464a91..c81935c5 100644 --- a/test/lib/c/02-subscribe-qos1-async2.c +++ b/test/lib/c/02-subscribe-qos1-async2.c @@ -42,6 +42,29 @@ static void on_subscribe(struct mosquitto *mosq, void *obj, int mid, int qos_cou should_run = false; } + +static const char* loglevel_as_str(int level) +{ + switch (level){ + case MOSQ_LOG_INFO: + return "INFO"; + case MOSQ_LOG_NOTICE: + return "NOTICE"; + case MOSQ_LOG_WARNING: + return "WARNING"; + case MOSQ_LOG_ERR: + return "ERROR"; + case MOSQ_LOG_DEBUG: + return "DEBUG"; + } + return "UNKNOWN"; +} + +static void on_log(struct mosquitto *mosq, void *user_data, int level, const char *msg) +{ + fprintf(stderr, "%s: %s\n", loglevel_as_str(level), msg); +} + int main(int argc, char *argv[]) { int rc; @@ -59,6 +82,7 @@ int main(int argc, char *argv[]) if(mosq == NULL){ return 1; } + mosquitto_log_callback_set(mosq, &on_log); mosquitto_connect_callback_set(mosq, on_connect); mosquitto_disconnect_callback_set(mosq, on_disconnect); mosquitto_subscribe_callback_set(mosq, on_subscribe); @@ -84,5 +108,6 @@ int main(int argc, char *argv[]) mosquitto_destroy(mosq); mosquitto_lib_cleanup(); + return run; } diff --git a/test/mosq_test.py b/test/mosq_test.py index c1cb1d0f..11c232dc 100644 --- a/test/mosq_test.py +++ b/test/mosq_test.py @@ -86,7 +86,26 @@ def start_client(filename, cmd, env, port=1888): cmd = ['valgrind', '-q', '--log-file='+filename+'.vglog'] + cmd cmd = cmd + [str(port)] - return subprocess.Popen(cmd, env=env) + return subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + +def wait_for_subprocess(client,timeout=10,terminate_timeout=2): + rc=0 + try: + client.wait(timeout) + except subprocess.TimeoutExpired: + rc=1 + client.terminate() + try: + client.wait(terminate_timeout) + except subprocess.TimeoutExpired: + rc=2 + client.kill() + try: + client.wait(terminate_timeout) + except subprocess.TimeoutExpired: + rc=3 + pass + return rc def pub_helper(port, proto_ver=4): connect_packet = gen_connect("pub-helper", proto_ver=proto_ver)