未验证 提交 7b5b3265 编写于 作者: Q Qianqian Zhu 提交者: GitHub

Merge pull request #1488 from ybduan/seabios_reboot_timeout

seabios_reboot_timeout: Add seabios new case
- seabios_reboot_timeout:
virt_test_type = qemu
type = seabios_reboot_timeout
boot_menu = on
images += ' stg'
image_name_stg = 'images/stg'
image_size_stg = 200M
force_create_image_stg = yes
remove_image_stg = yes
bootindex_stg = 0
bootindex_image1 = 1
variants:
- time0:
boot_reboot_timeout = 0
- time1000:
boot_reboot_timeout = 1000
- time10000:
boot_reboot_timeout = 10000
- time30000:
boot_reboot_timeout = 30000
- time60000:
boot_reboot_timeout = 60000
- time65535:
boot_reboot_timeout = 65535
- time65536:
boot_reboot_timeout = 65536
import re
import logging
from virttest import error_context
from virttest import utils_misc
@error_context.context_aware
def run(test, params, env):
"""
KVM seabios test:
1) Start VM
2) Check if reboot-timeout option works as expected
:param test: QEMU test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment.
"""
def get_output(session_obj):
"""
Use the function to short the lines in the scripts
"""
return session_obj.get_stripped_output()
def reboot_timeout_check():
"""
reboot-timeout check
"""
return re.search(pattern, get_output(seabios_session), re.S)
error_context.context("Start VM", logging.info)
vm = env.get_vm(params["main_vm"])
vm.verify_alive()
timeout = float(params.get("login_timeout", 360))
seabios_session = vm.logsessions['seabios']
rb_timeout = int(params["boot_reboot_timeout"])
if rb_timeout < 0:
test.cancel("Do not support rb_timeout = %s" % rb_timeout)
elif rb_timeout > 65535:
rb_timeout = 65535
rb_timeout = rb_timeout//1000
pattern = "No bootable device.*Retrying in %d seconds" % rb_timeout
error_context.context("Check reboot-timeout option", logging.info)
if not utils_misc.wait_for(reboot_timeout_check, timeout, 1):
err = "Guest doesn't reboot in %d seconds" % rb_timeout
test.fail(err)
logging.info(pattern)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册