From c0eaea9721010445cc233a0daebae385e993cf49 Mon Sep 17 00:00:00 2001 From: Yunping Zheng Date: Thu, 5 Sep 2013 13:57:38 +0800 Subject: [PATCH] virt.qemu.test.systemtap_tracing : make the test more robust This patch make the systemtap_tracing test more robust. Signed-off-by: Yunping Zheng --- qemu/tests/cfg/systemtap_tracing.cfg | 11 +++++++---- qemu/tests/systemtap_tracing.py | 20 ++++++++++++++++---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/qemu/tests/cfg/systemtap_tracing.cfg b/qemu/tests/cfg/systemtap_tracing.cfg index 9b564177..69872af7 100644 --- a/qemu/tests/cfg/systemtap_tracing.cfg +++ b/qemu/tests/cfg/systemtap_tracing.cfg @@ -11,6 +11,7 @@ # cmds_exec = ls /root, monitor:info status; stop, ls;ls type = systemtap_tracing profilers = systemtap + kill_vm = yes variants: - balloon_event: extra_params = -device virtio-balloon-pci,id=ballooning @@ -36,9 +37,10 @@ probe_var_key = bs sector_num nb_sectors opaque stap_script_file = bdrv_aio_writev.stp - bdrv_lock_medium: + start_vm = no probe_var_key = bs locked stap_script_file = bdrv_lock_medium.stp - cdrom_cd1 = isos/linux/RHEL3.9-i386-DVD.iso + boot_with_cdrom = yes - @cpu: variants: - cpu_get_apic_base: @@ -68,7 +70,8 @@ probe_var_key = size stap_script_file = qemu_vmalloc.stp - @virtio_scsi: - cdrom_cd1 = isos/linux/RHEL3.9-i386-DVD.iso + start_vm = no + boot_with_cdrom = yes cd_format = scsi-cd variants: - scsi_req_alloc: @@ -185,12 +188,12 @@ index_enable = yes probe_var_key = bus port stap_script_file = usb_port_release.stp - cmds_exec = "monitor:device_del id=usb-disk1" + cmds_exec = "monitor:device_del id=stg" - usb_port_detach: index_enable = yes probe_var_key = bus port stap_script_file = usb_port_detach.stp - cmds_exec = "monitor:device_del id=usb-disk1" + cmds_exec = "monitor:device_del id=stg" - @set: variants: diff --git a/qemu/tests/systemtap_tracing.py b/qemu/tests/systemtap_tracing.py index 076dff51..77eb0bcf 100644 --- a/qemu/tests/systemtap_tracing.py +++ b/qemu/tests/systemtap_tracing.py @@ -2,8 +2,9 @@ import logging import re import os import time +from autotest.client import utils from autotest.client.shared import error -from virttest import utils_misc, env_process +from virttest import utils_misc, env_process, data_dir @error.context_aware @@ -21,8 +22,8 @@ def run_systemtap_tracing(test, params, env): def create_patterns_reg(trace_key): """ - create a regular exp using the tracing key, the purpose is checking - the systemtap output is accord with expected. + Create a regular exp using the tracing key, the purpose is checking + the systemtap output is accord with expected. """ pattern_reg = "" for tracing_key in trace_key.split(): @@ -41,8 +42,19 @@ def run_systemtap_tracing(test, params, env): if params.get("extra_params"): params["extra_params"] = params.get("extra_params") - env_process.preprocess_vm(test, params, env, params.get("main_vm")) + if params.get("boot_with_cdrom") == 'yes': + iso_path = "%s/test.iso" % data_dir.get_tmp_dir() + create_cmd = "dd if=/dev/zero of=%s bs=1M count=10" % iso_path + if utils.system(create_cmd, ignore_status=True) != 0: + raise error.TestNAError("Create test iso failed") + params["cdrom_cd1"] = iso_path + + if params.get("start_vm", "yes") == "no": + params["start_vm"] = "yes" + env_process.preprocess_vm(test, params, env, params.get("main_vm")) + vm = env.get_vm(params["main_vm"]) + vm.verify_alive() if params.get("cmds_exec"): for cmd in params.get("cmds_exec").split(","): -- GitLab