From 7448f0cab83a10bafb653e94a93a2710d58f8538 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 3 Mar 2019 22:04:22 +0000 Subject: [PATCH] Update merged tests. --- test/broker/02-subpub-qos1-bad-pubcomp.py | 9 +-------- test/broker/02-subpub-qos1-bad-pubrec.py | 9 +-------- test/broker/02-subpub-qos2-bad-puback-1.py | 9 +-------- test/broker/02-subpub-qos2-bad-puback-2.py | 9 +-------- test/broker/02-subpub-qos2-bad-pubcomp.py | 9 +-------- test/broker/04-retain-check-source-persist-diff-port.py | 8 +------- test/broker/04-retain-check-source-persist.py | 8 +------- test/broker/04-retain-check-source.py | 8 +------- test/broker/09-acl-empty-file.py | 8 +------- test/broker/09-plugin-auth-acl-sub-denied.py | 8 +------- test/broker/09-pwfile-parse-invalid.py | 8 +------- 11 files changed, 11 insertions(+), 82 deletions(-) diff --git a/test/broker/02-subpub-qos1-bad-pubcomp.py b/test/broker/02-subpub-qos1-bad-pubcomp.py index 6c38d9b6..dd4a5cd3 100755 --- a/test/broker/02-subpub-qos1-bad-pubcomp.py +++ b/test/broker/02-subpub-qos1-bad-pubcomp.py @@ -2,14 +2,7 @@ # Test what the broker does if receiving a PUBCOMP in response to a QoS 1 PUBLISH. -import inspect, os, sys -# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder -cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],".."))) -if cmd_subfolder not in sys.path: - sys.path.insert(0, cmd_subfolder) - -import mosq_test -import time +from mosq_test_helper import * rc = 1 keepalive = 60 diff --git a/test/broker/02-subpub-qos1-bad-pubrec.py b/test/broker/02-subpub-qos1-bad-pubrec.py index 9f926fd0..65a0de68 100755 --- a/test/broker/02-subpub-qos1-bad-pubrec.py +++ b/test/broker/02-subpub-qos1-bad-pubrec.py @@ -2,14 +2,7 @@ # Test what the broker does if receiving a PUBREC in response to a QoS 1 PUBLISH. -import inspect, os, sys -# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder -cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],".."))) -if cmd_subfolder not in sys.path: - sys.path.insert(0, cmd_subfolder) - -import mosq_test -import time +from mosq_test_helper import * rc = 1 keepalive = 60 diff --git a/test/broker/02-subpub-qos2-bad-puback-1.py b/test/broker/02-subpub-qos2-bad-puback-1.py index e228c3d5..cf90dbf4 100755 --- a/test/broker/02-subpub-qos2-bad-puback-1.py +++ b/test/broker/02-subpub-qos2-bad-puback-1.py @@ -2,14 +2,7 @@ # Test what the broker does if receiving a PUBACK in response to a QoS 2 PUBLISH. -import inspect, os, sys -# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder -cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],".."))) -if cmd_subfolder not in sys.path: - sys.path.insert(0, cmd_subfolder) - -import mosq_test -import time +from mosq_test_helper import * rc = 1 keepalive = 60 diff --git a/test/broker/02-subpub-qos2-bad-puback-2.py b/test/broker/02-subpub-qos2-bad-puback-2.py index 67189990..20d643de 100755 --- a/test/broker/02-subpub-qos2-bad-puback-2.py +++ b/test/broker/02-subpub-qos2-bad-puback-2.py @@ -2,14 +2,7 @@ # Test what the broker does if receiving a PUBACK in response to a QoS 2 PUBREL. -import inspect, os, sys -# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder -cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],".."))) -if cmd_subfolder not in sys.path: - sys.path.insert(0, cmd_subfolder) - -import mosq_test -import time +from mosq_test_helper import * rc = 1 keepalive = 60 diff --git a/test/broker/02-subpub-qos2-bad-pubcomp.py b/test/broker/02-subpub-qos2-bad-pubcomp.py index acaac552..4fd6b59b 100755 --- a/test/broker/02-subpub-qos2-bad-pubcomp.py +++ b/test/broker/02-subpub-qos2-bad-pubcomp.py @@ -2,14 +2,7 @@ # Test what the broker does if receiving a PUBCOMP in response to a QoS 2 PUBLISH. -import inspect, os, sys -# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder -cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],".."))) -if cmd_subfolder not in sys.path: - sys.path.insert(0, cmd_subfolder) - -import mosq_test -import time +from mosq_test_helper import * rc = 1 keepalive = 60 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 c26ebe5f..10ff6426 100755 --- a/test/broker/04-retain-check-source-persist-diff-port.py +++ b/test/broker/04-retain-check-source-persist-diff-port.py @@ -2,13 +2,7 @@ # Test for CVE-2018-12546, with the broker being stopped to write the persistence file, plus subscriber on different port. -import inspect, os, sys -# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder -cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],".."))) -if cmd_subfolder not in sys.path: - sys.path.insert(0, cmd_subfolder) - -import mosq_test +from mosq_test_helper import * import signal def write_config(filename, port1, port2, per_listener): diff --git a/test/broker/04-retain-check-source-persist.py b/test/broker/04-retain-check-source-persist.py index d383908e..c06fddf7 100755 --- a/test/broker/04-retain-check-source-persist.py +++ b/test/broker/04-retain-check-source-persist.py @@ -2,13 +2,7 @@ # Test for CVE-2018-12546, with the broker being stopped to write the persistence file. -import inspect, os, sys -# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder -cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],".."))) -if cmd_subfolder not in sys.path: - sys.path.insert(0, cmd_subfolder) - -import mosq_test +from mosq_test_helper import * import signal def write_config(filename, port, per_listener): diff --git a/test/broker/04-retain-check-source.py b/test/broker/04-retain-check-source.py index 4ef51275..17adcb21 100755 --- a/test/broker/04-retain-check-source.py +++ b/test/broker/04-retain-check-source.py @@ -2,13 +2,7 @@ # Test for CVE-2018-12546 -import inspect, os, sys -# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder -cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],".."))) -if cmd_subfolder not in sys.path: - sys.path.insert(0, cmd_subfolder) - -import mosq_test +from mosq_test_helper import * import signal def write_config(filename, port, per_listener): diff --git a/test/broker/09-acl-empty-file.py b/test/broker/09-acl-empty-file.py index a6d71cf6..e43b5e26 100755 --- a/test/broker/09-acl-empty-file.py +++ b/test/broker/09-acl-empty-file.py @@ -2,13 +2,7 @@ # Test for CVE-2018-xxxxx -import inspect, os, sys -# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder -cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],".."))) -if cmd_subfolder not in sys.path: - sys.path.insert(0, cmd_subfolder) - -import mosq_test +from mosq_test_helper import * import signal def write_config(filename, port, per_listener): diff --git a/test/broker/09-plugin-auth-acl-sub-denied.py b/test/broker/09-plugin-auth-acl-sub-denied.py index 83726653..67051129 100755 --- a/test/broker/09-plugin-auth-acl-sub-denied.py +++ b/test/broker/09-plugin-auth-acl-sub-denied.py @@ -4,13 +4,7 @@ # produces the correct response, and check the client isn't disconnected (ref: # issue #1016). -import inspect, os, sys -# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder -cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],".."))) -if cmd_subfolder not in sys.path: - sys.path.insert(0, cmd_subfolder) - -import mosq_test +from mosq_test_helper import * def write_config(filename, port): with open(filename, 'w') as f: diff --git a/test/broker/09-pwfile-parse-invalid.py b/test/broker/09-pwfile-parse-invalid.py index e1781075..d2f3616a 100755 --- a/test/broker/09-pwfile-parse-invalid.py +++ b/test/broker/09-pwfile-parse-invalid.py @@ -2,13 +2,7 @@ # Test for CVE-2018-xxxxx. -import inspect, os, sys -# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder -cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],".."))) -if cmd_subfolder not in sys.path: - sys.path.insert(0, cmd_subfolder) - -import mosq_test +from mosq_test_helper import * import signal def write_config(filename, port, per_listener):