Skip to content

Commit

Permalink
Merge bitcoin#9098: [qa] Handle zombies and cluttered tmpdirs
Browse files Browse the repository at this point in the history
fab0f07 [qa] rpc-tests: Apply random offset to portseed (MarcoFalke)
fae19aa [qa] test_framework: Exit when tmpdir exists (MarcoFalke)
  • Loading branch information
laanwj authored and codablock committed Jan 15, 2018
1 parent 705057f commit 1121f2f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 5 additions & 1 deletion qa/pull-tester/rpc-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,18 @@ def __init__(self, num_tests_parallel, test_list=None, flags=None):
self.test_list = test_list
self.flags = flags
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 = []

def get_next(self):
while self.num_running < self.num_jobs and self.test_list:
# Add tests
self.num_running += 1
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_stderr = tempfile.SpooledTemporaryFile(max_size=2**16)
self.jobs.append((t,
Expand Down
7 changes: 1 addition & 6 deletions qa/rpc-tests/test_framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,11 @@ def main(self):

success = False
try:
if not os.path.isdir(self.options.tmpdir):
os.makedirs(self.options.tmpdir)
os.makedirs(self.options.tmpdir, exist_ok=False)
self.setup_chain()

self.setup_network()

self.run_test()

success = True

except JSONRPCException as e:
print("JSONRPC error: "+e.error['message'])
traceback.print_tb(sys.exc_info()[2])
Expand Down

0 comments on commit 1121f2f

Please sign in to comment.