Browse Source

Merge #9098: [qa] Handle zombies and cluttered tmpdirs

fab0f07 [qa] rpc-tests: Apply random offset to portseed (MarcoFalke)
fae19aa [qa] test_framework: Exit when tmpdir exists (MarcoFalke)
0.14
Wladimir J. van der Laan 8 years ago
parent
commit
71ab476b04
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 6
      qa/pull-tester/rpc-tests.py
  2. 7
      qa/rpc-tests/test_framework/test_framework.py

6
qa/pull-tester/rpc-tests.py

@ -246,6 +246,10 @@ class RPCTestHandler:
self.test_list = test_list self.test_list = test_list
self.flags = flags self.flags = flags
self.num_running = 0 self.num_running = 0
# In case there is a graveyard of zombie bitcoinds, we can apply a
# pseudorandom offset to hopefully jump over them.
# (625 is PORT_RANGE/MAX_NODES)
self.portseed_offset = int(time.time() * 1000) % 625
self.jobs = [] self.jobs = []
def get_next(self): def get_next(self):
@ -253,7 +257,7 @@ class RPCTestHandler:
# Add tests # Add tests
self.num_running += 1 self.num_running += 1
t = self.test_list.pop(0) t = self.test_list.pop(0)
port_seed = ["--portseed=%s" % len(self.test_list)] port_seed = ["--portseed={}".format(len(self.test_list) + self.portseed_offset)]
log_stdout = tempfile.SpooledTemporaryFile(max_size=2**16) log_stdout = tempfile.SpooledTemporaryFile(max_size=2**16)
log_stderr = tempfile.SpooledTemporaryFile(max_size=2**16) log_stderr = tempfile.SpooledTemporaryFile(max_size=2**16)
self.jobs.append((t, self.jobs.append((t,

7
qa/rpc-tests/test_framework/test_framework.py

@ -139,16 +139,11 @@ class BitcoinTestFramework(object):
success = False success = False
try: try:
if not os.path.isdir(self.options.tmpdir): os.makedirs(self.options.tmpdir, exist_ok=False)
os.makedirs(self.options.tmpdir)
self.setup_chain() self.setup_chain()
self.setup_network() self.setup_network()
self.run_test() self.run_test()
success = True success = True
except JSONRPCException as e: except JSONRPCException as e:
print("JSONRPC error: "+e.error['message']) print("JSONRPC error: "+e.error['message'])
traceback.print_tb(sys.exc_info()[2]) traceback.print_tb(sys.exc_info()[2])

Loading…
Cancel
Save