mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
Merge #10097: Move zmq test skipping logic into individual test case.
6803e09
Move zmq test skipping logic into individual test case. (John Newbery)
Tree-SHA512: 9d166b53e9acf386c4dafc860b38e2901b331a7505bba9714a2f4e3bdef68b0316c8b76fddbfb620835ddee549cf32fffb3a96a19b0799ad94f2553f55f19a35
s/bitcoind/dashd/
Signed-off-by: Pasta <pasta@dashboost.org>
This commit is contained in:
parent
14cbf547cc
commit
83d0637f2d
@ -64,6 +64,7 @@ BASE_SCRIPTS= [
|
|||||||
'rawtransactions.py',
|
'rawtransactions.py',
|
||||||
'reindex.py',
|
'reindex.py',
|
||||||
# vv Tests less than 30s vv
|
# vv Tests less than 30s vv
|
||||||
|
"zmq_test.py",
|
||||||
'mempool_resurrect_test.py',
|
'mempool_resurrect_test.py',
|
||||||
'txn_doublespend.py --mineblock',
|
'txn_doublespend.py --mineblock',
|
||||||
'txn_clone.py',
|
'txn_clone.py',
|
||||||
@ -103,11 +104,6 @@ BASE_SCRIPTS= [
|
|||||||
'p2p-fingerprint.py',
|
'p2p-fingerprint.py',
|
||||||
]
|
]
|
||||||
|
|
||||||
ZMQ_SCRIPTS = [
|
|
||||||
# ZMQ test can only be run if Dash Core was built with zmq-enabled.
|
|
||||||
# call test_runner.py with -nozmq to explicitly exclude these tests.
|
|
||||||
'zmq_test.py']
|
|
||||||
|
|
||||||
EXTENDED_SCRIPTS = [
|
EXTENDED_SCRIPTS = [
|
||||||
# These tests are not run by the travis build process.
|
# These tests are not run by the travis build process.
|
||||||
# Longest test should go first, to favor running tests in parallel
|
# Longest test should go first, to favor running tests in parallel
|
||||||
@ -140,7 +136,7 @@ EXTENDED_SCRIPTS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Place EXTENDED_SCRIPTS first since it has the 3 longest running tests
|
# Place EXTENDED_SCRIPTS first since it has the 3 longest running tests
|
||||||
ALL_SCRIPTS = EXTENDED_SCRIPTS + BASE_SCRIPTS + ZMQ_SCRIPTS
|
ALL_SCRIPTS = EXTENDED_SCRIPTS + BASE_SCRIPTS
|
||||||
|
|
||||||
NON_SCRIPTS = [
|
NON_SCRIPTS = [
|
||||||
# These are python files that live in the functional tests directory, but are not test scripts.
|
# These are python files that live in the functional tests directory, but are not test scripts.
|
||||||
@ -163,7 +159,6 @@ def main():
|
|||||||
parser.add_argument('--force', '-f', action='store_true', help='run tests even on platforms where they are disabled by default (e.g. windows).')
|
parser.add_argument('--force', '-f', action='store_true', help='run tests even on platforms where they are disabled by default (e.g. windows).')
|
||||||
parser.add_argument('--help', '-h', '-?', action='store_true', help='print help text and exit')
|
parser.add_argument('--help', '-h', '-?', action='store_true', help='print help text and exit')
|
||||||
parser.add_argument('--jobs', '-j', type=int, default=4, help='how many test scripts to run in parallel. Default=4.')
|
parser.add_argument('--jobs', '-j', type=int, default=4, help='how many test scripts to run in parallel. Default=4.')
|
||||||
parser.add_argument('--nozmq', action='store_true', help='do not run the zmq tests')
|
|
||||||
args, unknown_args = parser.parse_known_args()
|
args, unknown_args = parser.parse_known_args()
|
||||||
|
|
||||||
# Create a set to store arguments and create the passon string
|
# Create a set to store arguments and create the passon string
|
||||||
@ -177,7 +172,6 @@ def main():
|
|||||||
enable_wallet = config["components"].getboolean("ENABLE_WALLET")
|
enable_wallet = config["components"].getboolean("ENABLE_WALLET")
|
||||||
enable_utils = config["components"].getboolean("ENABLE_UTILS")
|
enable_utils = config["components"].getboolean("ENABLE_UTILS")
|
||||||
enable_bitcoind = config["components"].getboolean("ENABLE_BITCOIND")
|
enable_bitcoind = config["components"].getboolean("ENABLE_BITCOIND")
|
||||||
enable_zmq = config["components"].getboolean("ENABLE_ZMQ") and not args.nozmq
|
|
||||||
|
|
||||||
if config["environment"]["EXEEXT"] == ".exe" and not args.force:
|
if config["environment"]["EXEEXT"] == ".exe" and not args.force:
|
||||||
# https://github.com/bitcoin/bitcoin/commit/d52802551752140cf41f0d9a225a43e84404d3e9
|
# https://github.com/bitcoin/bitcoin/commit/d52802551752140cf41f0d9a225a43e84404d3e9
|
||||||
@ -190,15 +184,6 @@ def main():
|
|||||||
print("Rerun `configure` with -enable-wallet, -with-utils and -with-daemon and rerun make")
|
print("Rerun `configure` with -enable-wallet, -with-utils and -with-daemon and rerun make")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# python3-zmq may not be installed. Handle this gracefully and with some helpful info
|
|
||||||
if enable_zmq:
|
|
||||||
try:
|
|
||||||
import zmq
|
|
||||||
except ImportError:
|
|
||||||
print("ERROR: \"import zmq\" failed. Use -nozmq to run without the ZMQ tests."
|
|
||||||
"To run zmq tests, see dependency info in /test/README.md.")
|
|
||||||
raise
|
|
||||||
|
|
||||||
# Build list of tests
|
# Build list of tests
|
||||||
if tests:
|
if tests:
|
||||||
# Individual tests have been specified. Run specified tests that exist
|
# Individual tests have been specified. Run specified tests that exist
|
||||||
@ -206,11 +191,9 @@ def main():
|
|||||||
test_list = [t for t in ALL_SCRIPTS if
|
test_list = [t for t in ALL_SCRIPTS if
|
||||||
(t in tests or re.sub(".py$", "", t) in tests)]
|
(t in tests or re.sub(".py$", "", t) in tests)]
|
||||||
else:
|
else:
|
||||||
# No individual tests have been specified. Run base tests, and
|
# No individual tests have been specified.
|
||||||
# optionally ZMQ tests and extended tests.
|
# Run all base tests, and optionally run extended tests.
|
||||||
test_list = BASE_SCRIPTS
|
test_list = BASE_SCRIPTS
|
||||||
if enable_zmq:
|
|
||||||
test_list += ZMQ_SCRIPTS
|
|
||||||
if args.extended:
|
if args.extended:
|
||||||
# place the EXTENDED_SCRIPTS first since the three longest ones
|
# place the EXTENDED_SCRIPTS first since the three longest ones
|
||||||
# are there and the list is shorter
|
# are there and the list is shorter
|
||||||
|
@ -3,11 +3,13 @@
|
|||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
"""Test the ZMQ API."""
|
"""Test the ZMQ API."""
|
||||||
|
import configparser
|
||||||
|
import os
|
||||||
|
import struct
|
||||||
|
import sys
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import *
|
from test_framework.util import *
|
||||||
import zmq
|
|
||||||
import struct
|
|
||||||
|
|
||||||
class ZMQTest (BitcoinTestFramework):
|
class ZMQTest (BitcoinTestFramework):
|
||||||
|
|
||||||
@ -18,6 +20,21 @@ class ZMQTest (BitcoinTestFramework):
|
|||||||
port = 28332
|
port = 28332
|
||||||
|
|
||||||
def setup_nodes(self):
|
def setup_nodes(self):
|
||||||
|
# Try to import python3-zmq. Skip this test if the import fails.
|
||||||
|
try:
|
||||||
|
import zmq
|
||||||
|
except ImportError:
|
||||||
|
self.log.warning("python3-zmq module not available. Skipping zmq tests!")
|
||||||
|
sys.exit(self.TEST_EXIT_SKIPPED)
|
||||||
|
|
||||||
|
# Check that bitcoin has been built with ZMQ enabled
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
config.read_file(open(os.path.dirname(__file__) + "/config.ini"))
|
||||||
|
|
||||||
|
if not config["components"].getboolean("ENABLE_ZMQ"):
|
||||||
|
self.log.warning("dashd has not been built with zmq enabled. Skipping zmq tests!")
|
||||||
|
sys.exit(self.TEST_EXIT_SKIPPED)
|
||||||
|
|
||||||
self.zmqContext = zmq.Context()
|
self.zmqContext = zmq.Context()
|
||||||
self.zmqSubSocket = self.zmqContext.socket(zmq.SUB)
|
self.zmqSubSocket = self.zmqContext.socket(zmq.SUB)
|
||||||
self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashblock")
|
self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashblock")
|
||||||
|
Loading…
Reference in New Issue
Block a user