tests: wait for DispVM's qubes.VMShell exit

It isn't enough to wait for window to disappear, the service may still
be running. And if it is, test cleanup logic will complain about FD
leak.
To avoid deadlock on some test failure, do it with a timeout.
This commit is contained in:
Marek Marczykowski-Górecki 2018-09-15 03:53:30 +02:00
parent 240b1dd75e
commit c4a84b3298
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -23,6 +23,7 @@ import subprocess
import tempfile
import time
import unittest
from contextlib import suppress
from distutils import spawn
@ -162,8 +163,15 @@ class TC_20_DispVMMixin(object):
self.enter_keys_in_window(window_title, ['Return'])
# Wait for window to close
self.wait_for_window(window_title, show=False)
finally:
p.stdin.close()
self.loop.run_until_complete(
asyncio.wait_for(p.wait(), 30))
except:
with suppress(ProcessLookupError):
p.terminate()
self.loop.run_until_complete(p.wait())
raise
finally:
del p
finally:
self.loop.run_until_complete(dispvm.cleanup())