tests: Add some virt-install autoconsole tests

This commit is contained in:
Cole Robinson 2016-06-17 08:57:30 -04:00
parent 59edd87e9f
commit 0e8d4007cf
2 changed files with 13 additions and 3 deletions

View File

@ -793,6 +793,10 @@ c.add_valid("--file %(EXISTIMG1)s") # Existing file, no opts
c.add_valid("--file %(EXISTIMG1)s --file %(EXISTIMG1)s") # Multiple existing files
c.add_valid("--file %(NEWIMG1)s --file-size .00001 --nonsparse") # Nonexistent file
c = vinst.add_category("console-tests", "--pxe --nodisks")
c.add_valid("--nographics") # mock virsh console waiting
c.add_valid("--graphics vnc --noreboot") # mock virt-viewer waiting, with noreboot magic
c.add_valid("--nographics --wait 1")

View File

@ -410,8 +410,14 @@ def validate_disk(dev, warn_overwrite=False):
check_path_search(dev)
def _run_console(args):
def _run_console(guest, args):
logging.debug("Running: %s", " ".join(args))
if "VIRTINST_TEST_SUITE" in os.environ:
# Add this destroy() in here to trigger more virt-install code
# for the test suite
guest.domain.destroy()
return None
child = os.fork()
if child:
return child
@ -432,7 +438,7 @@ def _gfx_console(guest):
logging.debug("Launching virt-viewer for graphics type '%s'",
guest.get_devices("graphics")[0].type)
return _run_console(args)
return _run_console(guest, args)
def _txt_console(guest):
@ -441,7 +447,7 @@ def _txt_console(guest):
"console", guest.name]
logging.debug("Connecting to text console")
return _run_console(args)
return _run_console(guest, args)
def connect_console(guest, consolecb, wait):