Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions qubes/tests/integ/dispvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,15 +436,17 @@ def wait_for_dispvm_destroy(self, dispvm_names):
self.fail("didn't destroy dispvm(s) in time")
logger.info("end")

async def run_preload_proc(self):
async def run_preload_proc(self, timeout=60):
logger.info("start")
proc = await asyncio.create_subprocess_exec(
*self.preload_cmd,
stdout=asyncio.subprocess.PIPE,
stdin=asyncio.subprocess.DEVNULL,
)
try:
stdout, _ = await asyncio.wait_for(proc.communicate(), timeout=60)
stdout, _ = await asyncio.wait_for(
proc.communicate(), timeout=timeout
)
return stdout.decode()
except asyncio.TimeoutError:
proc.terminate()
Expand All @@ -464,7 +466,7 @@ async def run_preload(self, assert_stdout: bool = True):
self._test_event_handler_remove(appvm, "domain-preload-dispvm-start")
self._test_event_handler_remove(dispvm, "domain-unpaused")

stdout = await self.run_preload_proc()
stdout = await self.run_preload_proc(timeout=appvm.qrexec_timeout)
if assert_stdout:
self.assertEqual(stdout, dispvm_name)
test_cases = [
Expand Down Expand Up @@ -1165,7 +1167,10 @@ async def _test_015_preload_race_more(self):
self.disp_base.features["preload-dispvm-max"] = str(preload_max)
await self.wait_preload(preload_max)
old_preload = self.disp_base.get_feat_preload()
tasks = [self.run_preload_proc() for _ in range(preload_max)]
tasks = [
self.run_preload_proc(timeout=self.disp_base.qrexec_timeout)
for _ in range(preload_max)
]
targets = await asyncio.gather(*tasks)
await self.wait_preload(preload_max)
preload_dispvm = self.disp_base.get_feat_preload()
Expand All @@ -1183,7 +1188,10 @@ async def _test_016_preload_race_less(self):
preload_max = 1
self.disp_base.features["preload-dispvm-max"] = str(preload_max)
await self.wait_preload(preload_max, wait_completion=False)
tasks = [self.run_preload_proc(), self.no_preload()]
tasks = [
self.run_preload_proc(timeout=self.disp_base.qrexec_timeout),
self.no_preload(),
]
target = await asyncio.gather(*tasks)
target_dispvm = target[0]
self.assertTrue(target_dispvm.startswith("disp"))
Expand Down