Преглед на файлове

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.
Marek Marczykowski-Górecki преди 5 години
родител
ревизия
c4a84b3298
променени са 1 файла, в които са добавени 9 реда и са изтрити 1 реда
  1. 9 1
      qubes/tests/integ/dispvm.py

+ 9 - 1
qubes/tests/integ/dispvm.py

@@ -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())