Skip to content

Commit a6a3e58

Browse files
committed
Various review markups for rpc-tests.py improvements
1 parent 3de3ccd commit a6a3e58

File tree

2 files changed

+21
-26
lines changed

2 files changed

+21
-26
lines changed

qa/pull-tester/rpc-tests.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
This module calls down into individual test cases via subprocess. It will
99
forward all unrecognized arguments onto the individual test scripts.
1010
11+
RPC tests are disabled on Windows by default. Use --force to run them anyway.
12+
1113
For a description of arguments recognized by test scripts, see
1214
`qa/pull-tester/test_framework/test_framework.py:BitcoinTestFramework.main`.
1315
@@ -24,8 +26,8 @@
2426
import re
2527

2628
BASE_SCRIPTS= [
27-
# Scripts that are run by the travis build process
28-
# longest test should go first, to favor running tests in parallel
29+
# Scripts that are run by the travis build process.
30+
# Longest test should go first, to favor running tests in parallel
2931
'wallet-hd.py',
3032
'walletbackup.py',
3133
# vv Tests less than 5m vv
@@ -130,11 +132,11 @@ def main():
130132
formatter_class=argparse.RawTextHelpFormatter)
131133
parser.add_argument('--coverage', action='store_true', help='generate a basic coverage report for the RPC interface')
132134
parser.add_argument('--extended', action='store_true', help='run the extended test suite in addition to the basic tests')
135+
parser.add_argument('--force', '-f', action='store_true', help='run tests even on platforms where they are disabled by default (e.g. windows).')
133136
parser.add_argument('--help', '-h', '-?', action='store_true', help='print help text and exit')
134-
parser.add_argument('--nozmq', action='store_true', help='do not run the zmq tests')
135137
parser.add_argument('--jobs', '-j', type=int, default=4, help='how many test scripts to run in parallel. Default=4.')
136-
parser.add_argument('--win', action='store_true', help='signal that this is running in a Windows environment and that we should run the tests')
137-
(args, unknown_args) = parser.parse_known_args()
138+
parser.add_argument('--nozmq', action='store_true', help='do not run the zmq tests')
139+
args, unknown_args = parser.parse_known_args()
138140

139141
# Create a set to store arguments and create the passon string
140142
tests = set(arg for arg in unknown_args if arg[:2] != "--")
@@ -144,15 +146,15 @@ def main():
144146
config = configparser.ConfigParser()
145147
config.read_file(open(os.path.dirname(__file__) + "/tests_config.ini"))
146148

147-
enable_wallet = config["components"]["ENABLE_WALLET"] == "True"
148-
enable_utils = config["components"]["ENABLE_UTILS"] == "True"
149-
enable_bitcoind = config["components"]["ENABLE_BITCOIND"] == "True"
150-
enable_zmq = config["components"]["ENABLE_ZMQ"] == "True" and not args.nozmq
149+
enable_wallet = config["components"].getboolean("ENABLE_WALLET")
150+
enable_utils = config["components"].getboolean("ENABLE_UTILS")
151+
enable_bitcoind = config["components"].getboolean("ENABLE_BITCOIND")
152+
enable_zmq = config["components"].getboolean("ENABLE_ZMQ") and not args.nozmq
151153

152-
if config["environment"]["EXEEXT"] == ".exe" and not args.win:
154+
if config["environment"]["EXEEXT"] == ".exe" and not args.force:
153155
# https://github.com/bitcoin/bitcoin/commit/d52802551752140cf41f0d9a225a43e84404d3e9
154156
# https://github.com/bitcoin/bitcoin/pull/5677#issuecomment-136646964
155-
print("Win tests currently disabled by default. Use --win option to enable")
157+
print("Tests currently disabled on Windows by default. Use --force option to enable")
156158
sys.exit(0)
157159

158160
if not (enable_wallet and enable_utils and enable_bitcoind):
@@ -170,12 +172,12 @@ def main():
170172
raise
171173

172174
# Build list of tests
173-
if len(tests) != 0:
175+
if tests:
174176
# Individual tests have been specified. Run specified tests that exist
175177
# in the ALL_SCRIPTS list. Accept the name with or without .py extension.
176178
test_list = [t for t in ALL_SCRIPTS if
177179
(t in tests or re.sub(".py$", "", t) in tests)]
178-
if len(test_list) == 0:
180+
if not test_list:
179181
print("No valid test scripts specified. Check that your test is in one "
180182
"of the test lists in rpc-tests.py or run rpc-tests.py with no arguments to run all tests")
181183
print("Scripts not found:")
@@ -200,9 +202,9 @@ def main():
200202
subprocess.check_call((config["environment"]["SRCDIR"] + '/qa/rpc-tests/' + test_list[0]).split() + ['-h'])
201203
sys.exit(0)
202204

203-
runtests(test_list, config["environment"]["SRCDIR"], config["environment"]["BUILDDIR"], config["environment"]["EXEEXT"], args.jobs, args.coverage, passon_args)
205+
run_tests(test_list, config["environment"]["SRCDIR"], config["environment"]["BUILDDIR"], config["environment"]["EXEEXT"], args.jobs, args.coverage, passon_args)
204206

205-
def runtests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=False, args=[]):
207+
def run_tests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=False, args=[]):
206208
BOLD = ("","")
207209
if os.name == 'posix':
208210
# primitive formatting on supported

qa/pull-tester/tests_config.ini.in

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,14 @@
55
# These environment variables are set by the build process and read by
66
# rpc-tests.py
77

8-
[DEFAULT]
9-
# Provides default values for whether different components are enabled
10-
ENABLE_WALLET=False
11-
ENABLE_UTILS=False
12-
ENABLE_BITCOIND=False
13-
ENABLE_ZMQ=False
14-
158
[environment]
169
SRCDIR=@abs_top_srcdir@
1710
BUILDDIR=@abs_top_builddir@
1811
EXEEXT=@EXEEXT@
1912

2013
[components]
2114
# Which components are enabled. These are commented out by `configure` if they were disabled when running config.
22-
@ENABLE_WALLET_TRUE@ENABLE_WALLET=True
23-
@BUILD_BITCOIN_UTILS_TRUE@ENABLE_UTILS=True
24-
@BUILD_BITCOIND_TRUE@ENABLE_BITCOIND=True
25-
@ENABLE_ZMQ_TRUE@ENABLE_ZMQ=True
15+
@ENABLE_WALLET_TRUE@ENABLE_WALLET=true
16+
@BUILD_BITCOIN_UTILS_TRUE@ENABLE_UTILS=true
17+
@BUILD_BITCOIND_TRUE@ENABLE_BITCOIND=true
18+
@ENABLE_ZMQ_TRUE@ENABLE_ZMQ=true

0 commit comments

Comments
 (0)