Browse Source

Various review markups for rpc-tests.py improvements

0.15
John Newbery 8 years ago
parent
commit
a6a3e58c48
  1. 32
      qa/pull-tester/rpc-tests.py
  2. 15
      qa/pull-tester/tests_config.ini.in

32
qa/pull-tester/rpc-tests.py

@ -8,6 +8,8 @@ rpc-tests.py - run regression test suite
This module calls down into individual test cases via subprocess. It will This module calls down into individual test cases via subprocess. It will
forward all unrecognized arguments onto the individual test scripts. forward all unrecognized arguments onto the individual test scripts.
RPC tests are disabled on Windows by default. Use --force to run them anyway.
For a description of arguments recognized by test scripts, see For a description of arguments recognized by test scripts, see
`qa/pull-tester/test_framework/test_framework.py:BitcoinTestFramework.main`. `qa/pull-tester/test_framework/test_framework.py:BitcoinTestFramework.main`.
@ -24,8 +26,8 @@ import tempfile
import re import re
BASE_SCRIPTS= [ BASE_SCRIPTS= [
# Scripts that are run by the travis build process # Scripts that are 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
'wallet-hd.py', 'wallet-hd.py',
'walletbackup.py', 'walletbackup.py',
# vv Tests less than 5m vv # vv Tests less than 5m vv
@ -130,11 +132,11 @@ def main():
formatter_class=argparse.RawTextHelpFormatter) formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('--coverage', action='store_true', help='generate a basic coverage report for the RPC interface') parser.add_argument('--coverage', action='store_true', help='generate a basic coverage report for the RPC interface')
parser.add_argument('--extended', action='store_true', help='run the extended test suite in addition to the basic tests') parser.add_argument('--extended', action='store_true', help='run the extended test suite in addition to the basic tests')
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('--nozmq', action='store_true', help='do not run the zmq tests')
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('--win', action='store_true', help='signal that this is running in a Windows environment and that we should run the tests') 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
tests = set(arg for arg in unknown_args if arg[:2] != "--") tests = set(arg for arg in unknown_args if arg[:2] != "--")
@ -144,15 +146,15 @@ def main():
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read_file(open(os.path.dirname(__file__) + "/tests_config.ini")) config.read_file(open(os.path.dirname(__file__) + "/tests_config.ini"))
enable_wallet = config["components"]["ENABLE_WALLET"] == "True" enable_wallet = config["components"].getboolean("ENABLE_WALLET")
enable_utils = config["components"]["ENABLE_UTILS"] == "True" enable_utils = config["components"].getboolean("ENABLE_UTILS")
enable_bitcoind = config["components"]["ENABLE_BITCOIND"] == "True" enable_bitcoind = config["components"].getboolean("ENABLE_BITCOIND")
enable_zmq = config["components"]["ENABLE_ZMQ"] == "True" and not args.nozmq enable_zmq = config["components"].getboolean("ENABLE_ZMQ") and not args.nozmq
if config["environment"]["EXEEXT"] == ".exe" and not args.win: if config["environment"]["EXEEXT"] == ".exe" and not args.force:
# https://github.com/bitcoin/bitcoin/commit/d52802551752140cf41f0d9a225a43e84404d3e9 # https://github.com/bitcoin/bitcoin/commit/d52802551752140cf41f0d9a225a43e84404d3e9
# https://github.com/bitcoin/bitcoin/pull/5677#issuecomment-136646964 # https://github.com/bitcoin/bitcoin/pull/5677#issuecomment-136646964
print("Win tests currently disabled by default. Use --win option to enable") print("Tests currently disabled on Windows by default. Use --force option to enable")
sys.exit(0) sys.exit(0)
if not (enable_wallet and enable_utils and enable_bitcoind): if not (enable_wallet and enable_utils and enable_bitcoind):
@ -170,12 +172,12 @@ def main():
raise raise
# Build list of tests # Build list of tests
if len(tests) != 0: if tests:
# Individual tests have been specified. Run specified tests that exist # Individual tests have been specified. Run specified tests that exist
# in the ALL_SCRIPTS list. Accept the name with or without .py extension. # in the ALL_SCRIPTS list. Accept the name with or without .py extension.
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)]
if len(test_list) == 0: if not test_list:
print("No valid test scripts specified. Check that your test is in one " print("No valid test scripts specified. Check that your test is in one "
"of the test lists in rpc-tests.py or run rpc-tests.py with no arguments to run all tests") "of the test lists in rpc-tests.py or run rpc-tests.py with no arguments to run all tests")
print("Scripts not found:") print("Scripts not found:")
@ -200,9 +202,9 @@ def main():
subprocess.check_call((config["environment"]["SRCDIR"] + '/qa/rpc-tests/' + test_list[0]).split() + ['-h']) subprocess.check_call((config["environment"]["SRCDIR"] + '/qa/rpc-tests/' + test_list[0]).split() + ['-h'])
sys.exit(0) sys.exit(0)
runtests(test_list, config["environment"]["SRCDIR"], config["environment"]["BUILDDIR"], config["environment"]["EXEEXT"], args.jobs, args.coverage, passon_args) run_tests(test_list, config["environment"]["SRCDIR"], config["environment"]["BUILDDIR"], config["environment"]["EXEEXT"], args.jobs, args.coverage, passon_args)
def runtests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=False, args=[]): def run_tests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=False, args=[]):
BOLD = ("","") BOLD = ("","")
if os.name == 'posix': if os.name == 'posix':
# primitive formatting on supported # primitive formatting on supported

15
qa/pull-tester/tests_config.ini.in

@ -5,13 +5,6 @@
# These environment variables are set by the build process and read by # These environment variables are set by the build process and read by
# rpc-tests.py # rpc-tests.py
[DEFAULT]
# Provides default values for whether different components are enabled
ENABLE_WALLET=False
ENABLE_UTILS=False
ENABLE_BITCOIND=False
ENABLE_ZMQ=False
[environment] [environment]
SRCDIR=@abs_top_srcdir@ SRCDIR=@abs_top_srcdir@
BUILDDIR=@abs_top_builddir@ BUILDDIR=@abs_top_builddir@
@ -19,7 +12,7 @@ EXEEXT=@EXEEXT@
[components] [components]
# Which components are enabled. These are commented out by `configure` if they were disabled when running config. # Which components are enabled. These are commented out by `configure` if they were disabled when running config.
@ENABLE_WALLET_TRUE@ENABLE_WALLET=True @ENABLE_WALLET_TRUE@ENABLE_WALLET=true
@BUILD_BITCOIN_UTILS_TRUE@ENABLE_UTILS=True @BUILD_BITCOIN_UTILS_TRUE@ENABLE_UTILS=true
@BUILD_BITCOIND_TRUE@ENABLE_BITCOIND=True @BUILD_BITCOIND_TRUE@ENABLE_BITCOIND=true
@ENABLE_ZMQ_TRUE@ENABLE_ZMQ=True @ENABLE_ZMQ_TRUE@ENABLE_ZMQ=true

Loading…
Cancel
Save