diff --git a/qemu/tests/cfg/rng_read_longtime.cfg b/qemu/tests/cfg/rng_read_longtime.cfg new file mode 100644 index 0000000000000000000000000000000000000000..7ecdd5826a1d2ac9c0791392eaa5764ccc1d843a --- /dev/null +++ b/qemu/tests/cfg/rng_read_longtime.cfg @@ -0,0 +1,27 @@ +- rng_read_longtime: + type = rng_bat + kill_vm = yes + virt_test_type = qemu + read_rng_timeout = 3600 + no no_virtio_rng + test_duration = 36000 + Windows: + # Please update path of rng_dll_register_cmd to right path which included you driver + #rng_dll_register_cmd = if not exist "C:\Windows\system32\viorngum.dll" copy PATH:\INCLUDEDRIVER\viorngum.dll C:\Windows\system32\ /y &&" + session_cmd_timeout = 240 + read_rng_cmd = for /l %i in (1, 1, 30) do "WIN_UTILS:\random_%PROCESSOR_ARCHITECTURE%.exe" + driver_name = "viorng" + rng_data_rex = "0x\w" + driver_id_pattern = "(.*?):.*?VirtIO RNG Device" + i386: + driver_id_cmd = 'WIN_UTILS:\devcon\wxp_x86\devcon.exe find * | find "VirtIO"' + driver_check_cmd = "WIN_UTILS:\devcon\wxp_x86\devcon.exe status @DRIVER_ID" + x86_64: + driver_id_cmd = 'WIN_UTILS:\devcon\wnet_amd64\devcon.exe find * | find "VirtIO"' + driver_check_cmd = "WIN_UTILS:\devcon\wnet_amd64\devcon.exe status @DRIVER_ID" + Linux: + session_cmd_timeout = 360 + read_rng_cmd = "dd if=/dev/random bs=4 count=100 2>/dev/null|hexdump" + driver_verifier_cmd = "cat /sys/devices/virtual/misc/hw_random/rng_current" + driver_name = virtio + rng_data_rex = "\w+" diff --git a/qemu/tests/rng_bat.py b/qemu/tests/rng_bat.py index 5edf969290b281f3789c3e0c75597cb494cda970..7cdf9a3efae852462a0f5869cc92a9b021302982 100644 --- a/qemu/tests/rng_bat.py +++ b/qemu/tests/rng_bat.py @@ -1,6 +1,7 @@ import re import logging import aexpect +import time from virttest import utils_misc from virttest import error_context @@ -119,8 +120,17 @@ def run(test, params, env): logging.info("register 'viorngum.dll' into system") session.cmd(rng_dll_register_cmd, timeout=120) - output = session.cmd_output(read_rng_cmd, timeout=read_rng_timeout) - if len(re.findall(rng_data_rex, output, re.M)) < 2: - raise exceptions.TestFail("Unable to read random numbers from" - "guest: %s" % output) + if params.get("test_duration"): + start_time = time.time() + while (time.time() - start_time) < float(params.get("test_duration")): + output = session.cmd_output(read_rng_cmd, + timeout=read_rng_timeout) + if len(re.findall(rng_data_rex, output, re.M)) < 2: + raise exceptions.TestFail("Unable to read random numbers from" + "guest: %s" % output) + else: + output = session.cmd_output(read_rng_cmd, timeout=read_rng_timeout) + if len(re.findall(rng_data_rex, output, re.M)) < 2: + raise exceptions.TestFail("Unable to read random numbers from" + "guest: %s" % output) session.close()