diff --git a/qemu/tests/cfg/timerdevice.cfg b/qemu/tests/cfg/timerdevice.cfg index f9a6053130a2ba4cd0d53a61c9b014abf44092a7..b0a4d439b78755c30f1d3820b4a946048dacf6f9 100644 --- a/qemu/tests/cfg/timerdevice.cfg +++ b/qemu/tests/cfg/timerdevice.cfg @@ -50,6 +50,7 @@ - boot_test: no RHEL.3 RHEL.4 RHEL.5 RHEL.6 type = timerdevice_boot + start_vm = no i386, x86_64: rtc_drift = slew timerdevice_drift_threshold = 3 @@ -86,22 +87,35 @@ only RHEL only ppc64 ppc64le timerdevice_clksource = "timebase" + variants: + - without_host_load: + - with_host_load: + login_timeout = 600 + only clock_host + no clksource_tsc + reboot_immediately: + only Linux + with_boot: + repeat_nums = 6 + sleep_time = 600 + Linux: + timerdevice_host_load_cmd = "for (( I=0; I<%s; I++ ));" + timerdevice_host_load_cmd += " 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'" + Windows: + stress_install_from_repo = "no" + download_url_stress = 'stress/stress-1.0.4.tar.gz' + timerdevice_host_load_cmd = "--cpu %s --io 4 --vm 2 --vm-bytes 256M" + timerdevice_host_load_stop_cmd = "pkill -9 stress" variants: - with_boot: - with_reboot: timerdevice_reboot_test = yes - variants: - - without_host_load: - - with_host_load: - only Linux - login_timeout = 600 - 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: + only with_host_load timerdevice_sleep_time = 3600 - tscsync: only Linux diff --git a/qemu/tests/timerdevice_boot.py b/qemu/tests/timerdevice_boot.py index ef1ca7076763a06d204e2429d8df9d1a313d8b34..049456984883145bec6c7dad4b4945af2971f5e8 100644 --- a/qemu/tests/timerdevice_boot.py +++ b/qemu/tests/timerdevice_boot.py @@ -5,6 +5,7 @@ import re from avocado.utils import process from virttest import utils_test from virttest import utils_time +from virttest import env_process from virttest import funcatexit from virttest import error_context @@ -134,13 +135,25 @@ def run(test, params, env): timerdevice_host_load_cmd = params.get("timerdevice_host_load_cmd") if timerdevice_host_load_cmd: error_context.context("Add some load on host", logging.info) - process.system(timerdevice_host_load_cmd, shell=True, - ignore_bg_processes=True) + host_cpu_cnt_cmd = params["host_cpu_cnt_cmd"] + host_cpu_cnt = int(process.system_output(host_cpu_cnt_cmd, shell=True).strip()) + if params["os_type"] == "linux": + timerdevice_host_load_cmd = timerdevice_host_load_cmd % host_cpu_cnt + process.system(timerdevice_host_load_cmd, shell=True, + ignore_bg_processes=True) + else: + timerdevice_host_load_cmd = timerdevice_host_load_cmd % int(host_cpu_cnt/2) + stress_bg = utils_test.HostStress("stress", params, + stress_args=timerdevice_host_load_cmd) + stress_bg.load_stress_tool() host_load_stop_cmd = params.get("timerdevice_host_load_stop_cmd", "pkill -f 'do X=1'") funcatexit.register(env, params["type"], _system, host_load_stop_cmd) + 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() @@ -169,6 +182,15 @@ def run(test, params, env): if params["os_type"] == "linux": verify_timedrift(session, is_hardware=True) + repeat_nums = params.get_numeric("repeat_nums") + if repeat_nums: + sleep_time = params["sleep_time"] + for index in range(repeat_nums): + time.sleep(int(sleep_time)) + verify_timedrift(session) + if params["os_type"] == "linux": + verify_timedrift(session, is_hardware=True) + if params.get("timerdevice_reboot_test") == "yes": sleep_time = params.get("timerdevice_sleep_time") if sleep_time: