提交 77f0d98f 编写于 作者: S Suqin Huang

Add rng driver load test

1. repeat load/unload 10 times
2. unload during random read
Signed-off-by: NSuqin Huang <shuang@redhat.com>
上级 9dfab3f1
- rng_driver_load:
only Linux
no no_virtio_rng
start_vm = yes
login_timeout = 240
image_snapshot = yes
variants:
- load_in_loop:
type = driver_load
driver_id_pattern = virtio_rng
driver_id_cmd = lsmod | grep virtio_rng
driver_unload_cmd = modprobe -r virtio_rng
driver_load_cmd = modprobe virtio_rng
repeats = 10
- driver_in_use:
type = rng_driver_negative
driver_unload_cmd = modprobe -r virtio_rng
read_rng_cmd = "dd if=/dev/random of=/dev/null & echo $!"
import logging
import aexpect
from virttest import error_context
from avocado.core import exceptions
@error_context.context_aware
def run(test, params, env):
"""
KVM driver load test:
1) Log into a guest
2) Read from virtio-rng device
3) Unload the device driver
4) Check no crash
5) Load the device driver
:param test: QEMU test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment.
"""
vm = env.get_vm(params["main_vm"])
vm.verify_alive()
login_timeout = int(params.get("login_timeout", 360))
session = vm.wait_for_login(timeout=login_timeout)
driver_unload_cmd = params["driver_unload_cmd"]
error_context.context("Read virtio-rng device in background",
logging.info)
read_rng_cmd = params["read_rng_cmd"]
pid = session.cmd_output(read_rng_cmd)
pid = pid.split("\n")[1]
logging.info("Check if random read process exist")
status = session.cmd_status("ps -p %s" % pid)
if status != 0:
raise exceptions.TestFail("random read is not running background")
error_context.context("Unload the driver during random read",
logging.info)
try:
session.cmd(driver_unload_cmd)
except aexpect.ShellTimeoutError:
pass
error_context.context("Check if there is call trace in guest",
logging.info)
try:
vm.verify_kernel_crash()
finally:
try:
session.cmd("kill -9 %s" % pid)
session.close()
except Exception:
pass
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册