From d634ab835d429aa0478ecc206df5f38b0d3e4a7f Mon Sep 17 00:00:00 2001 From: Qingtang Zhou Date: Tue, 6 Aug 2013 15:28:47 +0800 Subject: [PATCH] qemu.tests: Add test for timerdevice with load on host Signed-off-by: Qingtang Zhou --- qemu/tests/cfg/timerdevice.cfg | 7 +++++++ qemu/tests/timerdevice_boot.py | 28 +++++++++++++++++++--------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/qemu/tests/cfg/timerdevice.cfg b/qemu/tests/cfg/timerdevice.cfg index f97e9849..cb0ac5ce 100644 --- a/qemu/tests/cfg/timerdevice.cfg +++ b/qemu/tests/cfg/timerdevice.cfg @@ -61,6 +61,13 @@ - with_boot: - with_reboot: timerdevice_reboot_test = yes + variants: + - without_host_load: + - with_host_load: + timerdevice_host_load_cmd = "for (( I=0; I<`grep processor /proc/cpuinfo" + timerdevice_host_load_cmd += " | wc -l`; I++ )); do taskset -c $I /bin/bash -c" + timerdevice_host_load_cmd += " 'for ((;;)); do X=1; done &'; done" + timerdevice_host_load_stop_cmd = "pkill -f 'do X=1'" variants: - reboot_immediately: - reboot_after_sleep: diff --git a/qemu/tests/timerdevice_boot.py b/qemu/tests/timerdevice_boot.py index bb83762e..0a22ad86 100644 --- a/qemu/tests/timerdevice_boot.py +++ b/qemu/tests/timerdevice_boot.py @@ -2,6 +2,7 @@ import logging, re, time from autotest.client.shared import error from autotest.client import utils from virttest import data_dir, storage, utils_disk, utils_test, env_process +from virttest import funcatexit @error.context_aware def run_timerdevice_boot(test, params, env): @@ -9,15 +10,16 @@ def run_timerdevice_boot(test, params, env): Timer device boot guest: 1) Sync the host system time with ntp server - 2) Boot the guest with specific clock source - 3) Check the clock source currently used on guest - 4) Do some file operation on guest (Optional) - 5) Check the system time on guest and host (Optional) - 6) Check the hardware time on guest and host (Optional) - 7) Sleep period of time before reboot (Optional) - 8) Reboot guest (Optional) - 9) Check the system time on guest and host (Optional) - 10) Check the hardware time on guest and host (Optional) + 2) Add some load on host (Optional) + 3) Boot the guest with specific clock source + 4) Check the clock source currently used on guest + 5) Do some file operation on guest (Optional) + 6) Check the system time on guest and host (Optional) + 7) Check the hardware time on guest and host (Optional) + 8) Sleep period of time before reboot (Optional) + 9) Reboot guest (Optional) + 10) Check the system time on guest and host (Optional) + 11) Check the hardware time on guest and host (Optional) @param test: QEMU test object. @param params: Dictionary with test parameters. @@ -34,6 +36,14 @@ def run_timerdevice_boot(test, params, env): error.context("Sync the host system time with ntp server", logging.info) utils.system("ntpdate clock.redhat.com") + timerdevice_host_load_cmd = params.get("timerdevice_host_load_cmd") + if timerdevice_host_load_cmd: + error.context("Add some load on host", logging.info) + utils.system(timerdevice_host_load_cmd) + host_load_stop_cmd = params["timerdevice_host_load_stop_cmd"] + funcatexit.register(env, params["type"], utils.system, + host_load_stop_cmd) + error.context("Boot a guest with kvm-clock", logging.info) vm = env.get_vm(params["main_vm"]) vm.verify_alive() -- GitLab