qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

tests/vm: allow wait_ssh() to specify command

This allows for waiting for completion of arbitrary commands.

Signed-off-by: Robert Foley <robert.foley@linaro.org>
Reviewed-by: Peter Puhov <peter.puhov@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200529203458.1038-7-robert.foley@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

authored by

Robert Foley and committed by
Philippe Mathieu-Daudé
6ee982c9 e56c4504

+7 -7
+7 -7
tests/vm/basevm.py
··· 320 320 def print_step(self, text): 321 321 sys.stderr.write("### %s ...\n" % text) 322 322 323 - def wait_ssh(self, wait_root=False, seconds=300): 323 + def wait_ssh(self, wait_root=False, seconds=300, cmd="exit 0"): 324 324 # Allow more time for VM to boot under TCG. 325 325 if not kvm_available(self.arch): 326 326 seconds *= self.tcg_ssh_timeout_multiplier 327 327 starttime = datetime.datetime.now() 328 328 endtime = starttime + datetime.timedelta(seconds=seconds) 329 - guest_up = False 329 + cmd_success = False 330 330 while datetime.datetime.now() < endtime: 331 - if wait_root and self.ssh_root("exit 0") == 0: 332 - guest_up = True 331 + if wait_root and self.ssh_root(cmd) == 0: 332 + cmd_success = True 333 333 break 334 - elif self.ssh("exit 0") == 0: 335 - guest_up = True 334 + elif self.ssh(cmd) == 0: 335 + cmd_success = True 336 336 break 337 337 seconds = (endtime - datetime.datetime.now()).total_seconds() 338 338 logging.debug("%ds before timeout", seconds) 339 339 time.sleep(1) 340 - if not guest_up: 340 + if not cmd_success: 341 341 raise Exception("Timeout while waiting for guest ssh") 342 342 343 343 def shutdown(self):