mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Merge #8750: [qa] Refactor RPCTestHandler to prevent TimeoutExpired
dddd04f
[qa] Refactor RPCTestHandler to prevent TimeoutExpired (MarcoFalke)
This commit is contained in:
parent
5496e468a6
commit
a0481f1ed0
@ -258,21 +258,27 @@ class RPCTestHandler:
|
|||||||
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=%s" % len(self.test_list)]
|
||||||
|
log_stdout = tempfile.SpooledTemporaryFile(max_size=2**16)
|
||||||
|
log_stderr = tempfile.SpooledTemporaryFile(max_size=2**16)
|
||||||
self.jobs.append((t,
|
self.jobs.append((t,
|
||||||
time.time(),
|
time.time(),
|
||||||
subprocess.Popen((RPC_TESTS_DIR + t).split() + self.flags + port_seed,
|
subprocess.Popen((RPC_TESTS_DIR + t).split() + self.flags + port_seed,
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
stdout=subprocess.PIPE,
|
stdout=log_stdout,
|
||||||
stderr=subprocess.PIPE)))
|
stderr=log_stderr),
|
||||||
|
log_stdout,
|
||||||
|
log_stderr))
|
||||||
if not self.jobs:
|
if not self.jobs:
|
||||||
raise IndexError('%s from empty list' % __name__)
|
raise IndexError('%s from empty list' % __name__)
|
||||||
while True:
|
while True:
|
||||||
# Return first proc that finishes
|
# Return first proc that finishes
|
||||||
time.sleep(.5)
|
time.sleep(.5)
|
||||||
for j in self.jobs:
|
for j in self.jobs:
|
||||||
(name, time0, proc) = j
|
(name, time0, proc, log_out, log_err) = j
|
||||||
if proc.poll() is not None:
|
if proc.poll() is not None:
|
||||||
(stdout, stderr) = proc.communicate(timeout=3)
|
log_out.seek(0), log_err.seek(0)
|
||||||
|
[stdout, stderr] = [l.read().decode('utf-8') for l in (log_out, log_err)]
|
||||||
|
log_out.close(), log_err.close()
|
||||||
passed = stderr == "" and proc.returncode == 0
|
passed = stderr == "" and proc.returncode == 0
|
||||||
self.num_running -= 1
|
self.num_running -= 1
|
||||||
self.jobs.remove(j)
|
self.jobs.remove(j)
|
||||||
|
Loading…
Reference in New Issue
Block a user