提交 f2561514 编写于 作者: Y Yu Wang

pvpanic.py: add trigger crash cases for pvpanic

Add ps2_keyboard, usb_keyboard and notmyfault_app method to trigger
a crash.
Signed-off-by: NYu Wang <wyu@redhat.com>
上级 2aef0871
...@@ -8,12 +8,39 @@ ...@@ -8,12 +8,39 @@
backup_image_before_testing = yes backup_image_before_testing = yes
restore_image_after_testing = yes restore_image_after_testing = yes
set_kdump_cmd = "systemctl disable kdump.service && systemctl stop kdump.service" set_kdump_cmd = "systemctl disable kdump.service && systemctl stop kdump.service"
set_panic_cmd = "echo 1 > /proc/sys/kernel/unknown_nmi_panic"
RHEL.6: RHEL.6:
set_kdump_cmd = "chkconfig kdump off && service kdump stop" set_kdump_cmd = "chkconfig kdump off && service kdump stop"
Windows: Windows:
no Host_RHEL.m6 no Host_RHEL.m6
set_panic_cmd = 'wmic class stdregprov call SetDwordValue hDefKey="&h80000002" sSubKeyName="SYSTEM\CurrentControlSet\Control\CrashControl" sValueName="NMICrashDump" uValue=1' crash_key1 = "ctrl_r"
crash_key2 = "scroll_lock"
variants: variants:
- nmi: - nmi:
crash_method = nmi crash_method = nmi
Linux:
set_panic_cmd = "echo 1 > /proc/sys/kernel/unknown_nmi_panic"
Windows:
set_panic_cmd = 'wmic class stdregprov call SetDwordValue hDefKey="&h80000002" sSubKeyName="SYSTEM\CurrentControlSet\Control\CrashControl" sValueName="NMICrashDump" uValue=1'
- usb_keyboard:
only Windows
crash_method = usb_keyboard
usb_devices += " kb1"
usb_type_kb1 = "usb-kbd"
set_panic_cmd = 'wmic class stdregprov call SetDwordValue hDefKey="&h80000002" sSubKeyName="SYSTEM\CurrentControlSet\Services\kbdhid\Parameters" sValueName="CrashOnCtrlScroll" uValue=1'
# There is no inbox usb3.0 driver on Win2008, Win2008R2 and Win7, so run with usb2.0 instead.
Win7, Win2008:
usb_type = ich9-usb-ehci1
usb_type_usb1 = ich9-usb-ehci1
usb_controller = ehci
- ps2_keyboard:
only Windows
del usb_devices
crash_method = ps2_keyboard
set_panic_cmd = 'wmic class stdregprov call SetDwordValue hDefKey="&h80000002" sSubKeyName="SYSTEM\CurrentControlSet\Services\i8042prt\Parameters" sValueName="CrashOnCtrlScroll" uValue=1'
- notmyfault_app:
only Windows
crash_method = notmyfault_app
i386:
notmyfault_cmd = "WIN_UTILS:\notmyfault.exe /bugcheck %#04x /accepteula"
x86_64:
notmyfault_cmd = "WIN_UTILS:\notmyfault64.exe /bugcheck %#04x /accepteula"
import logging import logging
import time import time
import random
import aexpect
from virttest import error_context from virttest import error_context
from virttest import utils_test from virttest import utils_test
from virttest import utils_misc
def setup_test_environment(test, params, vm, session): def setup_test_environment(test, params, vm, session):
...@@ -62,13 +66,31 @@ def trigger_crash(test, vm, params): ...@@ -62,13 +66,31 @@ def trigger_crash(test, vm, params):
:param vm: target vm :param vm: target vm
:parma params: test params :parma params: test params
""" """
# to do: will add other crash method crash_method = params["crash_method"]
crash_method = params.get("crash_method")
if crash_method == "nmi": if crash_method == "nmi":
vm.monitor.nmi() vm.monitor.nmi()
elif crash_method in ("usb_keyboard", "ps2_keyboard"):
crash_key1 = params["crash_key1"]
crash_key2 = params["crash_key2"]
vm.monitor.press_release_key(crash_key1)
vm.send_key(crash_key2)
vm.send_key(crash_key2)
elif crash_method == "notmyfault_app":
timeout = int(params.get("timeout", 360))
session = vm.wait_for_login(timeout=timeout)
cmd = params["notmyfault_cmd"] % random.randint(1, 8)
notmyfault_cmd = utils_misc.set_winutils_letter(session, cmd)
try:
status, output = session.cmd_status_output(cmd=notmyfault_cmd,
timeout=timeout)
if status:
test.error("Command '%s' failed, status: %s, output: %s" %
(cmd, status, output))
except (aexpect.ExpectTimeoutError, aexpect.ExpectProcessTerminatedError):
pass
else: else:
test.cancel("Crash trigger method %s not supported, " test.cancel("Crash trigger method %s not supported, "
"please check cfg file for mistake.", crash_method) "please check cfg file for mistake." % crash_method)
@error_context.context_aware @error_context.context_aware
...@@ -80,7 +102,7 @@ def run(test, params, env): ...@@ -80,7 +102,7 @@ def run(test, params, env):
2) Check if the driver is installed and verified (only for win) 2) Check if the driver is installed and verified (only for win)
3) Stop kdump service and modify unknown_nmi_panic(for linux) 3) Stop kdump service and modify unknown_nmi_panic(for linux)
or modify register value(for win) or modify register value(for win)
4) Trigger a crash by nmi 4) Trigger a crash by nmi, keyboard or notmyfault app
5) Check the event in qmp 5) Check the event in qmp
:param test: kvm test object :param test: kvm test object
...@@ -102,8 +124,10 @@ def run(test, params, env): ...@@ -102,8 +124,10 @@ def run(test, params, env):
test, driver_name, test, driver_name,
timeout) timeout)
if params["crash_method"] != "notmyfault_app":
error_context.context("Setup crash evironment for test", logging.info) error_context.context("Setup crash evironment for test", logging.info)
setup_test_environment(test, params, vm, session) setup_test_environment(test, params, vm, session)
error_context.context("Trigger crash", logging.info) error_context.context("Trigger crash", logging.info)
trigger_crash(test, vm, params) trigger_crash(test, vm, params)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册