Skip to content

Commit ef0801b

Browse files
committed
Merge #8830: [test] Add option to run bitcoin-util-test.py manually
b82f493 Add option to run bitcoin-util-test.py manually (jnewbery)
2 parents 90adfab + b82f493 commit ef0801b

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

src/test/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,11 @@ example, to run just the getarg_tests verbosely:
3030

3131
Run `test_bitcoin --help` for the full list.
3232

33+
### bitcoin-util-test.py
34+
35+
The test directory also contains the bitcoin-util-test.py tool, which tests bitcoin utils (currently just bitcoin-tx). This test gets run automatically during the `make check` build process. It is also possible to run the test manually from the src directory:
36+
37+
```
38+
test/bitcoin-util-test.py --srcdir=[current directory]
39+
40+
```

src/test/bitcoin-util-test.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,24 @@
66
import os
77
import bctest
88
import buildenv
9+
import argparse
910

10-
if __name__ == '__main__':
11-
bctest.bctester(os.environ["srcdir"] + "/test/data",
12-
"bitcoin-util-test.json",buildenv)
11+
help_text="""Test framework for bitcoin utils.
12+
13+
Runs automatically during `make check`.
14+
15+
Can also be run manually from the src directory by specifiying the source directory:
1316
17+
test/bitcoin-util-test.py --src=[srcdir]
18+
"""
19+
20+
21+
if __name__ == '__main__':
22+
try:
23+
srcdir = os.environ["srcdir"]
24+
except:
25+
parser = argparse.ArgumentParser(description=help_text)
26+
parser.add_argument('-s', '--srcdir')
27+
args = parser.parse_args()
28+
srcdir = args.srcdir
29+
bctest.bctester(srcdir + "/test/data", "bitcoin-util-test.json", buildenv)

0 commit comments

Comments
 (0)