|
21 | 21 |
|
22 | 22 | """ |
23 | 23 |
|
| 24 | +import configparser |
24 | 25 | import os |
25 | 26 | import time |
26 | 27 | import shutil |
|
29 | 30 | import tempfile |
30 | 31 | import re |
31 | 32 |
|
32 | | -sys.path.append("qa/pull-tester/") |
33 | | -from tests_config import * |
34 | | - |
35 | 33 | BOLD = ("","") |
36 | 34 | if os.name == 'posix': |
37 | 35 | # primitive formatting on supported |
38 | 36 | # terminal via ANSI escape sequences: |
39 | 37 | BOLD = ('\033[0m', '\033[1m') |
40 | 38 |
|
41 | | -RPC_TESTS_DIR = SRCDIR + '/qa/rpc-tests/' |
| 39 | +# Read config generated by configure. |
| 40 | +config = configparser.ConfigParser() |
| 41 | +config.read_file(open(os.path.dirname(__file__) + "/tests_config.ini")) |
| 42 | + |
| 43 | +ENABLE_WALLET = config["components"]["ENABLE_WALLET"] == "True" |
| 44 | +ENABLE_UTILS = config["components"]["ENABLE_UTILS"] == "True" |
| 45 | +ENABLE_BITCOIND = config["components"]["ENABLE_BITCOIND"] == "True" |
| 46 | +ENABLE_ZMQ = config["components"]["ENABLE_ZMQ"] == "True" |
42 | 47 |
|
43 | | -#If imported values are not defined then set to zero (or disabled) |
44 | | -if 'ENABLE_WALLET' not in vars(): |
45 | | - ENABLE_WALLET=0 |
46 | | -if 'ENABLE_BITCOIND' not in vars(): |
47 | | - ENABLE_BITCOIND=0 |
48 | | -if 'ENABLE_UTILS' not in vars(): |
49 | | - ENABLE_UTILS=0 |
50 | | -if 'ENABLE_ZMQ' not in vars(): |
51 | | - ENABLE_ZMQ=0 |
| 48 | +RPC_TESTS_DIR = config["environment"]["SRCDIR"] + '/qa/rpc-tests/' |
52 | 49 |
|
53 | 50 | ENABLE_COVERAGE=0 |
54 | 51 |
|
|
76 | 73 |
|
77 | 74 | #Set env vars |
78 | 75 | if "BITCOIND" not in os.environ: |
79 | | - os.environ["BITCOIND"] = BUILDDIR + '/src/bitcoind' + EXEEXT |
| 76 | + os.environ["BITCOIND"] = config["environment"]["BUILDDIR"] + '/src/bitcoind' + config["environment"]["EXEEXT"] |
80 | 77 |
|
81 | | -if EXEEXT == ".exe" and "-win" not in opts: |
| 78 | +if config["environment"]["EXEEXT"] == ".exe" and "-win" not in opts: |
82 | 79 | # https://github.com/bitcoin/bitcoin/commit/d52802551752140cf41f0d9a225a43e84404d3e9 |
83 | 80 | # https://github.com/bitcoin/bitcoin/pull/5677#issuecomment-136646964 |
84 | 81 | print("Win tests currently disabled by default. Use -win option to enable") |
85 | 82 | sys.exit(0) |
86 | 83 |
|
87 | | -if not (ENABLE_WALLET == 1 and ENABLE_UTILS == 1 and ENABLE_BITCOIND == 1): |
| 84 | +if not (ENABLE_WALLET and ENABLE_UTILS and ENABLE_BITCOIND): |
88 | 85 | print("No rpc tests to run. Wallet, utils, and bitcoind must all be enabled") |
89 | 86 | sys.exit(0) |
90 | 87 |
|
@@ -209,8 +206,8 @@ def runtests(): |
209 | 206 | if ENABLE_COVERAGE: |
210 | 207 | coverage = RPCCoverage() |
211 | 208 | print("Initializing coverage directory at %s\n" % coverage.dir) |
212 | | - flags = ["--srcdir=%s/src" % BUILDDIR] + passon_args |
213 | | - flags.append("--cachedir=%s/qa/cache" % BUILDDIR) |
| 209 | + flags = ["--srcdir=%s/src" % config["environment"]["BUILDDIR"]] + passon_args |
| 210 | + flags.append("--cachedir=%s/qa/cache" % config["environment"]["BUILDDIR"]) |
214 | 211 | if coverage: |
215 | 212 | flags.append(coverage.flag) |
216 | 213 |
|
|
0 commit comments