|
40 | 40 | ENABLE_UTILS=0
|
41 | 41 | if 'ENABLE_ZMQ' not in vars():
|
42 | 42 | ENABLE_ZMQ=0
|
43 |
| - |
44 |
| -# python-zmq may not be installed. Handle this gracefully and with some helpful info |
45 |
| -if ENABLE_ZMQ: |
46 |
| - try: |
47 |
| - import zmq |
48 |
| - except ImportError as e: |
49 |
| - print("WARNING: \"import zmq\" failed. Set ENABLE_ZMQ=0 or " \ |
50 |
| - "to run zmq tests, see dependency info in /qa/README.md.") |
51 |
| - raise e |
52 | 43 |
|
53 | 44 | ENABLE_COVERAGE=0
|
54 | 45 |
|
|
76 | 67 | if "BITCOINCLI" not in os.environ:
|
77 | 68 | os.environ["BITCOINCLI"] = buildDir + '/src/bitcoin-cli' + EXEEXT
|
78 | 69 |
|
79 |
| -#Disable Windows tests by default |
80 | 70 | if EXEEXT == ".exe" and "-win" not in opts:
|
81 |
| - print "Win tests currently disabled. Use -win option to enable" |
| 71 | + # https://github.com/bitcoin/bitcoin/commit/d52802551752140cf41f0d9a225a43e84404d3e9 |
| 72 | + print "Win tests currently disabled by default. Use -win option to enable" |
| 73 | + sys.exit(0) |
| 74 | + |
| 75 | +if not (ENABLE_WALLET == 1 and ENABLE_UTILS == 1 and ENABLE_BITCOIND == 1): |
| 76 | + print "No rpc tests to run. Wallet, utils, and bitcoind must all be enabled" |
82 | 77 | sys.exit(0)
|
83 | 78 |
|
| 79 | +# python-zmq may not be installed. Handle this gracefully and with some helpful info |
| 80 | +if ENABLE_ZMQ: |
| 81 | + try: |
| 82 | + import zmq |
| 83 | + except ImportError as e: |
| 84 | + print("WARNING: \"import zmq\" failed. Set ENABLE_ZMQ=0 or " \ |
| 85 | + "to run zmq tests, see dependency info in /qa/README.md.") |
| 86 | + raise e |
| 87 | + |
84 | 88 | #Tests
|
85 | 89 | testScripts = [
|
86 | 90 | 'bip68-112-113-p2p.py',
|
|
119 | 123 | 'p2p-versionbits-warning.py',
|
120 | 124 | 'importprunedfunds.py',
|
121 | 125 | ]
|
| 126 | +if ENABLE_ZMQ: |
| 127 | + testScripts.append('zmq_test.py') |
| 128 | + |
122 | 129 | testScriptsExt = [
|
123 | 130 | 'bip9-softforks.py',
|
124 | 131 | 'bip65-cltv.py',
|
|
143 | 150 | 'pruning.py', # leave pruning last as it takes a REALLY long time
|
144 | 151 | ]
|
145 | 152 |
|
146 |
| -#Enable ZMQ tests |
147 |
| -if ENABLE_ZMQ == 1: |
148 |
| - testScripts.append('zmq_test.py') |
149 |
| - |
150 |
| - |
151 | 153 | def runtests():
|
152 | 154 | coverage = None
|
153 | 155 |
|
154 | 156 | if ENABLE_COVERAGE:
|
155 | 157 | coverage = RPCCoverage()
|
156 | 158 | print("Initializing coverage directory at %s\n" % coverage.dir)
|
157 | 159 |
|
158 |
| - if(ENABLE_WALLET == 1 and ENABLE_UTILS == 1 and ENABLE_BITCOIND == 1): |
159 |
| - rpcTestDir = buildDir + '/qa/rpc-tests/' |
160 |
| - run_extended = '-extended' in opts |
161 |
| - cov_flag = coverage.flag if coverage else '' |
162 |
| - flags = " --srcdir %s/src %s %s" % (buildDir, cov_flag, passOn) |
163 |
| - |
164 |
| - #Run Tests |
165 |
| - for i in range(len(testScripts)): |
166 |
| - if (len(opts) == 0 |
167 |
| - or (len(opts) == 1 and "-win" in opts ) |
168 |
| - or run_extended |
169 |
| - or testScripts[i] in opts |
170 |
| - or re.sub(".py$", "", testScripts[i]) in opts ): |
171 |
| - |
172 |
| - print("Running testscript %s%s%s ..." % (bold[1], testScripts[i], bold[0])) |
173 |
| - time0 = time.time() |
174 |
| - subprocess.check_call( |
175 |
| - rpcTestDir + testScripts[i] + flags, shell=True) |
176 |
| - print("Duration: %s s\n" % (int(time.time() - time0))) |
177 |
| - |
178 |
| - # exit if help is called so we print just one set of |
179 |
| - # instructions |
180 |
| - p = re.compile(" -h| --help") |
181 |
| - if p.match(passOn): |
182 |
| - sys.exit(0) |
183 |
| - |
184 |
| - # Run Extended Tests |
185 |
| - for i in range(len(testScriptsExt)): |
186 |
| - if (run_extended or testScriptsExt[i] in opts |
187 |
| - or re.sub(".py$", "", testScriptsExt[i]) in opts): |
188 |
| - |
189 |
| - print( |
190 |
| - "Running 2nd level testscript " |
191 |
| - + "%s%s%s ..." % (bold[1], testScriptsExt[i], bold[0])) |
192 |
| - time0 = time.time() |
193 |
| - subprocess.check_call( |
194 |
| - rpcTestDir + testScriptsExt[i] + flags, shell=True) |
195 |
| - print("Duration: %s s\n" % (int(time.time() - time0))) |
196 |
| - |
197 |
| - if coverage: |
198 |
| - coverage.report_rpc_coverage() |
199 |
| - |
200 |
| - print("Cleaning up coverage data") |
201 |
| - coverage.cleanup() |
202 |
| - |
203 |
| - else: |
204 |
| - print "No rpc tests to run. Wallet, utils, and bitcoind must all be enabled" |
| 160 | + rpcTestDir = buildDir + '/qa/rpc-tests/' |
| 161 | + run_extended = '-extended' in opts |
| 162 | + cov_flag = coverage.flag if coverage else '' |
| 163 | + flags = " --srcdir %s/src %s %s" % (buildDir, cov_flag, passOn) |
| 164 | + |
| 165 | + #Run Tests |
| 166 | + for i in range(len(testScripts)): |
| 167 | + if (len(opts) == 0 |
| 168 | + or (len(opts) == 1 and "-win" in opts ) |
| 169 | + or run_extended |
| 170 | + or testScripts[i] in opts |
| 171 | + or re.sub(".py$", "", testScripts[i]) in opts ): |
| 172 | + |
| 173 | + print("Running testscript %s%s%s ..." % (bold[1], testScripts[i], bold[0])) |
| 174 | + time0 = time.time() |
| 175 | + subprocess.check_call( |
| 176 | + rpcTestDir + testScripts[i] + flags, shell=True) |
| 177 | + print("Duration: %s s\n" % (int(time.time() - time0))) |
| 178 | + |
| 179 | + # exit if help is called so we print just one set of |
| 180 | + # instructions |
| 181 | + p = re.compile(" -h| --help") |
| 182 | + if p.match(passOn): |
| 183 | + sys.exit(0) |
| 184 | + |
| 185 | + # Run Extended Tests |
| 186 | + for i in range(len(testScriptsExt)): |
| 187 | + if (run_extended or testScriptsExt[i] in opts |
| 188 | + or re.sub(".py$", "", testScriptsExt[i]) in opts): |
| 189 | + |
| 190 | + print( |
| 191 | + "Running 2nd level testscript " |
| 192 | + + "%s%s%s ..." % (bold[1], testScriptsExt[i], bold[0])) |
| 193 | + time0 = time.time() |
| 194 | + subprocess.check_call( |
| 195 | + rpcTestDir + testScriptsExt[i] + flags, shell=True) |
| 196 | + print("Duration: %s s\n" % (int(time.time() - time0))) |
| 197 | + |
| 198 | + if coverage: |
| 199 | + coverage.report_rpc_coverage() |
| 200 | + |
| 201 | + print("Cleaning up coverage data") |
| 202 | + coverage.cleanup() |
205 | 203 |
|
206 | 204 |
|
207 | 205 | class RPCCoverage(object):
|
|
0 commit comments