mirror of
https://github.com/wownero/wownero.git
synced 2026-10-28 11:58:34 +01:00
functional_tests: remove unreachable code,
kill process after timeout Co-authored-by: selsta <selsta@sent.at>
This commit is contained in:
@@ -161,24 +161,14 @@ for test in tests:
|
|||||||
print('Stopping servers...')
|
print('Stopping servers...')
|
||||||
kill()
|
kill()
|
||||||
|
|
||||||
# wait for exit, the poll method does not work (https://bugs.python.org/issue2475) so we wait, possibly forever if the process hangs
|
# Wait up to 10 seconds for each process, then force termination.
|
||||||
if True:
|
for p in processes:
|
||||||
for p in processes:
|
try:
|
||||||
|
p.wait(timeout=10)
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
print('Failed to stop process ' + str(p.pid) + ', killing it')
|
||||||
|
p.kill()
|
||||||
p.wait()
|
p.wait()
|
||||||
else:
|
|
||||||
for i in range(10):
|
|
||||||
n_returncode = 0
|
|
||||||
for p in processes:
|
|
||||||
p.poll()
|
|
||||||
if p.returncode:
|
|
||||||
n_returncode += 1
|
|
||||||
if n_returncode == len(processes):
|
|
||||||
print('All done: ' + string.join([x.returncode for x in processes], ', '))
|
|
||||||
break
|
|
||||||
time.sleep(1)
|
|
||||||
for p in processes:
|
|
||||||
if not p.returncode:
|
|
||||||
print('Failed to stop process')
|
|
||||||
|
|
||||||
if len(FAIL) == 0:
|
if len(FAIL) == 0:
|
||||||
print('Done, ' + str(len(PASS)) + '/' + str(len(tests)) + ' tests passed')
|
print('Done, ' + str(len(PASS)) + '/' + str(len(tests)) + ' tests passed')
|
||||||
|
|||||||
Reference in New Issue
Block a user