Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/util.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2014-2019 The Bitcoin Core developers | # Copyright (c) 2014-2019 The Bitcoin Core developers | ||||
# 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. | ||||
"""Helpful routines for regression testing.""" | """Helpful routines for regression testing.""" | ||||
from base64 import b64encode | from base64 import b64encode | ||||
from binascii import unhexlify | from binascii import unhexlify | ||||
from decimal import Decimal, ROUND_DOWN | from decimal import Decimal, ROUND_DOWN | ||||
from subprocess import CalledProcessError | |||||
import hashlib | import hashlib | ||||
import inspect | import inspect | ||||
import json | import json | ||||
import logging | import logging | ||||
import os | import os | ||||
import random | import random | ||||
import re | import re | ||||
from subprocess import CalledProcessError | |||||
import time | import time | ||||
from . import coverage | from . import coverage | ||||
from .authproxy import AuthServiceProxy, JSONRPCException | from .authproxy import AuthServiceProxy, JSONRPCException | ||||
logger = logging.getLogger("TestFramework.utils") | logger = logging.getLogger("TestFramework.utils") | ||||
# Assert functions | # Assert functions | ||||
▲ Show 20 Lines • Show All 242 Lines • ▼ Show 20 Lines | |||||
# RPC/P2P connection constants and functions | # RPC/P2P connection constants and functions | ||||
############################################ | ############################################ | ||||
# The maximum number of nodes a single test can spawn | # The maximum number of nodes a single test can spawn | ||||
MAX_NODES = 12 | MAX_NODES = 12 | ||||
# Don't assign rpc or p2p ports lower than this | # Don't assign rpc or p2p ports lower than this | ||||
PORT_MIN = 11000 | PORT_MIN = int(os.getenv('TEST_RUNNER_PORT_MIN', default=11000)) | ||||
# The number of ports to "reserve" for p2p and rpc, each | # The number of ports to "reserve" for p2p and rpc, each | ||||
PORT_RANGE = 5000 | PORT_RANGE = 5000 | ||||
class PortSeed: | class PortSeed: | ||||
# Must be initialized with a unique integer for each process | # Must be initialized with a unique integer for each process | ||||
n = None | n = None | ||||
▲ Show 20 Lines • Show All 317 Lines • Show Last 20 Lines |