Merge bitcoin/bitcoin#34168: qa: Require --exclude for each excluded test

c5825d4b7f qa: Require `--exclude` for each excluded test (Hennadii Stepanov)

Pull request description:

  This PR allows a long `--exclude ...` argument in the `test/functional/test_runner.py` invocation to be split across multiple lines, with optional per-line explanatory comments. I found this useful for the CI scripts in https://github.com/hebasto/bitcoin-core-nightly.

ACKs for top commit:
  l0rinc:
    tested ACK c5825d4b7f
  maflcko:
    review ACK c5825d4b7f 🛄
  achow101:
    ACK c5825d4b7f
  rkrux:
    ACK c5825d4b7f

Tree-SHA512: bcf42848516197978b65df8a8bc68e036a62c9afc6158274eac74a325dc01991eb063a042f940c53ea15a7feb18d4bdfc45d8c71f0ef20c76140b12e07ba3ac5
This commit is contained in:
Ava Chow
2026-01-13 14:40:43 -08:00
4 changed files with 19 additions and 10 deletions

View File

@@ -411,7 +411,7 @@ def main():
parser.add_argument('--combinedlogslen', '-c', type=int, default=0, metavar='n', help='On failure, print a log (of length n lines) to the console, combined from the test framework and all test nodes.')
parser.add_argument('--coverage', action='store_true', help='generate a basic coverage report for the RPC interface')
parser.add_argument('--ci', action='store_true', help='Run checks and code that are usually only enabled in a continuous integration environment')
parser.add_argument('--exclude', '-x', help='specify a comma-separated-list of scripts to exclude.')
parser.add_argument('--exclude', '-x', action='append', help='specify a script to exclude. Can be specified multiple times. The .py extension is optional.')
parser.add_argument('--extended', action='store_true', help='run the extended test suite in addition to the basic tests')
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.')
@@ -506,7 +506,7 @@ def main():
if args.exclude:
def print_warning_missing_test(test_name):
print("{}WARNING!{} Test '{}' not found in current test list. Check the --exclude list.".format(BOLD[1], BOLD[0], test_name))
print("{}WARNING!{} Test '{}' not found in current test list. Check the --exclude options.".format(BOLD[1], BOLD[0], test_name))
if fail_on_warn:
sys.exit(1)
@@ -514,10 +514,16 @@ def main():
if not exclude_list:
print_warning_missing_test(exclude_test)
for exclude_item in exclude_list:
print("Excluding %s" % exclude_item)
test_list.remove(exclude_item)
exclude_tests = [test.strip() for test in args.exclude.split(",")]
for exclude_test in exclude_tests:
for exclude_test in args.exclude:
if ',' in exclude_test:
print("{}WARNING!{} --exclude '{}' contains a comma. Use --exclude for each test.".format(BOLD[1], BOLD[0], exclude_test))
if fail_on_warn:
sys.exit(1)
for exclude_test in args.exclude:
# A space in the name indicates it has arguments such as "rpc_bind.py --ipv4"
if ' ' in exclude_test:
remove_tests([test for test in test_list if test.replace('.py', '') == exclude_test.replace('.py', '')])