提交 c0419cb9 编写于 作者: S Shuping Cui 提交者: Lucas Meneghel Rodrigues

qemu.tests: Add check SGABIOS info case for seabios.py

This patch add the restart vm function.

Changes from v2:
update some parameter name.
Signed-off-by: NShuping Cui <scui@redhat.com>
Signed-off-by: NYiqiao Pu <ypu@redhat.com>
Acked-by: NFeng Yang <fyang@redhat.com>
上级 5176c3c9
- seabios: install setup image_copy unattended_install.cdrom
no Host_RHEL.5
type = seabios
start_vm = no
restart_vm = no
kill_vm = yes
boot_menu = on
enable_sga = yes
image_verify_bootable = no
boot_menu_key = "f12"
boot_menu_hint = "Press F12 for boot menu"
# Specify the boot device name which you want to test here.
boot_device = "iPXE"
# SGA Bios info message, using sep as ";"
# Please update this message to suit for your own system.
restart_key = "ctrl-alt-delete"
Host_RHEL:
sgabios_info = "Google, Inc.;"
sgabios_info += "Serial Graphics Adapter 11/05/12;"
sgabios_info += "SGABIOS $Id: sgabios.S 8 2010-04-22 00:03:40Z nlaredo $ (mockbuild@) Mon Nov 5 10:34:43 UTC 2012;"
sgabios_info += "4 0"
......@@ -8,11 +8,13 @@ def run_seabios(test, params, env):
"""
KVM Seabios test:
1) Start guest with sga bios
2) Display and check the boot menu order
3) Start guest from the specified boot entry
4) Log into the guest to verify it's up
2) Check the sgb bios messages(optional)
3) Restart the vm, verify it's reset(optional)
4) Display and check the boot menu order
5) Start guest from the specified boot entry
6) Log into the guest to verify it's up
@param test: kvm test object
@param test: QEMU test object
@param params: Dictionary with the test parameters
@param env: Dictionary with test environment.
"""
......@@ -25,20 +27,54 @@ def run_seabios(test, params, env):
timeout = float(params.get("login_timeout", 240))
boot_menu_key = params.get("boot_menu_key", 'f12')
restart_key = params.get("restart_key")
boot_menu_hint = params.get("boot_menu_hint")
boot_device = params.get("boot_device", "")
sgabios_info = params.get("sgabios_info")
error.context("Display and check the boot menu order")
seabios_session = vm.logsessions['seabios']
f = lambda: re.search(boot_menu_hint, vm.serial_console.get_output())
if not (boot_menu_hint and utils_misc.wait_for(f, timeout, 1)):
if sgabios_info:
info_list = sgabios_info.split(';')
error.context("Display and check the SGABIOS info", logging.info)
info_check = lambda: (len(info_list) ==
len([x for x in info_list
if x in vm.serial_console.get_output()]))
if not utils_misc.wait_for(info_check, timeout, 1):
raise error.TestFail("Cound not get sgabios message. The output"
" is %s" % vm.serial_console.get_output())
if restart_key:
error.context("Restart vm and check it's ok", logging.info)
boot_menu = lambda: re.search(boot_menu_hint,
seabios_session.get_output())
if not (boot_menu_hint and utils_misc.wait_for(boot_menu, timeout, 1)):
raise error.TestFail("Could not get boot menu message.")
seabios_text = seabios_session.get_output()
headline = seabios_text.split("\n")[0] + "\n"
headline_count = seabios_text.count(headline)
vm.send_key(restart_key)
reboot_check = lambda: (seabios_session.get_output().count(headline)
> headline_count)
if not utils_misc.wait_for(reboot_check, timeout, 1):
raise error.TestFail("Could not restart the vm")
error.context("Display and check the boot menu order", logging.info)
boot_menu = lambda: re.search(boot_menu_hint,
seabios_session.get_output())
if not (boot_menu_hint and utils_misc.wait_for(boot_menu, timeout, 1)):
raise error.TestFail("Could not get boot menu message.")
# Send boot menu key in monitor.
vm.send_key(boot_menu_key)
_ = vm.serial_console.get_output()
boot_list = re.findall("^\d+\. (.*)\s", _, re.M)
get_list = lambda: re.findall("^\d+\. (.*)\s",
seabios_session.get_output(), re.M)
boot_list = utils_misc.wait_for(get_list, timeout, 1)
if not boot_list:
raise error.TestFail("Could not get boot entries list.")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册