aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2019-07-11 20:36:02 +0200
committerJon Atack <jon@atack.com>2019-07-15 10:13:39 +0200
commit6a7a70b8cf05a82737c72020fd2b0eebc97cb5e4 (patch)
tree3f7b1d1af375f2302c0b5bc96520fa292f24ed05
parent4fcccdac785e09ad5627b3bf4811dfba353693e8 (diff)
downloadbitcoin-6a7a70b8cf05a82737c72020fd2b0eebc97cb5e4.tar.xz
test: enable passing wildcards with path to test runner
Currently, passing wildcard testname args to the test runner from outside the `test/functional/` directory does not work. See this recent IRC discussion for more background: http://www.erisian.com.au/bitcoin-core-dev/log-2019-07-10.html#l-262 (lines 262 to 323). This small change enables passing multiple wildcards with paths, as long as the paths are coherent. Examples: - test/functional/test_runner.py test/functional/wallet* - functional/test_runner.py functional/wallet* - test/functional/test_runner.py ./test/functional/tool* test/functional/mempool* A current limitation that this PR does not change: 9 test files with arguments in their name are not picked up by wildcard search. - Squashed commit: non-mutating version - Squashed commit: minor code optimisation
-rwxr-xr-xtest/functional/test_runner.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py
index 462547f44f..6092d734ec 100755
--- a/test/functional/test_runner.py
+++ b/test/functional/test_runner.py
@@ -269,11 +269,22 @@ def main():
test_list = []
if tests:
# Individual tests have been specified. Run specified tests that exist
- # in the ALL_SCRIPTS list. Accept the name with or without .py extension.
- tests = [test + ".py" if ".py" not in test else test for test in tests]
+ # in the ALL_SCRIPTS list. Accept names with or without a .py extension.
+ # Specified tests can contain wildcards, but in that case the supplied
+ # paths should be coherent, e.g. the same path as that provided to call
+ # test_runner.py. Examples:
+ # `test/functional/test_runner.py test/functional/wallet*`
+ # `test/functional/test_runner.py ./test/functional/wallet*`
+ # `test_runner.py wallet*`
+ # but not:
+ # `test/functional/test_runner.py wallet*`
+ # Multiple wildcards can be passed:
+ # `test_runner.py tool* mempool*`
for test in tests:
- if test in ALL_SCRIPTS:
- test_list.append(test)
+ script = test.split("/")[-1]
+ script = script + ".py" if ".py" not in script else script
+ if script in ALL_SCRIPTS:
+ test_list.append(script)
else:
print("{}WARNING!{} Test '{}' not found in full test list.".format(BOLD[1], BOLD[0], test))
elif args.extended: