diff options
author | MarcoFalke <falke.marco@gmail.com> | 2016-09-17 11:47:51 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2016-09-19 17:11:18 +0200 |
commit | d6ebe1369fca30a914e72cbe9da7367de80d8f8a (patch) | |
tree | a1f7c446445bf7ba521cd95ba12e10b3b5b657a2 | |
parent | ae8c7df7a5725e812586f2c2d653578b8fd55a37 (diff) |
[qa] Refactor RPCTestHandler to prevent TimeoutExpired
Github-Pull: #8750
Rebased-From: dddd04f979392a8c69cc11f5c54d817702eeed3e
-rwxr-xr-x | qa/pull-tester/rpc-tests.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/qa/pull-tester/rpc-tests.py b/qa/pull-tester/rpc-tests.py index 11b83bac14..a99149e52a 100755 --- a/qa/pull-tester/rpc-tests.py +++ b/qa/pull-tester/rpc-tests.py @@ -248,21 +248,27 @@ class RPCTestHandler: self.num_running += 1 t = self.test_list.pop(0) 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, time.time(), subprocess.Popen((RPC_TESTS_DIR + t).split() + self.flags + port_seed, universal_newlines=True, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE))) + stdout=log_stdout, + stderr=log_stderr), + log_stdout, + log_stderr)) if not self.jobs: raise IndexError('pop from empty list') while True: # Return first proc that finishes time.sleep(.5) for j in self.jobs: - (name, time0, proc) = j + (name, time0, proc, log_out, log_err) = j 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 self.num_running -= 1 self.jobs.remove(j) |