Iometer is an I/O subsystem measurement and characterization
tool for single and clustered systems. We use it to test block I/O
performance of virtual machine.

Need to add some util files to winutils.iso/Iometer:
 http://kongove.fedorapeople.org/autotest/Iometer.tar.gz

This patch just added the testcase, I will change this case to generate
RHS format result, then we can use regression.py to compare the results.

Signed-off-by: Amos Kong <[email protected]>
---
 shared/cfg/guest-os/Windows/Win2003/32.cfg |    2 +
 tests/cfg/iometer_windows.cfg              |   39 ++++++++++++
 tests/iometer_windows.py                   |   91 ++++++++++++++++++++++++++++
 3 files changed, 132 insertions(+), 0 deletions(-)
 create mode 100644 tests/cfg/iometer_windows.cfg
 create mode 100644 tests/iometer_windows.py

diff --git a/shared/cfg/guest-os/Windows/Win2003/32.cfg 
b/shared/cfg/guest-os/Windows/Win2003/32.cfg
index c1f4f30..632141b 100644
--- a/shared/cfg/guest-os/Windows/Win2003/32.cfg
+++ b/shared/cfg/guest-os/Windows/Win2003/32.cfg
@@ -35,3 +35,5 @@
             dd_data_whqlqual = Basic
         device.net:
             image_name_supportvm = win2003-32-supportvm
+    iometer_windows:
+        create_partition_cmd = "echo select disk 1 > imDiskpart.script && echo 
convert dynamic >> imDiskpart.script && echo create volume simple >> 
imDiskpart.script && echo assign letter=E >> imDiskpart.script && echo exit >> 
imDiskpart.script && diskpart /s imDiskpart.script
\ No newline at end of file
diff --git a/tests/cfg/iometer_windows.cfg b/tests/cfg/iometer_windows.cfg
new file mode 100644
index 0000000..9ccea14
--- /dev/null
+++ b/tests/cfg/iometer_windows.cfg
@@ -0,0 +1,39 @@
+
+- iometer_windows:
+    only Windows
+    type = iometer_windows
+    images += " disk1"
+    drive_index_disk1 = 2
+    boot_drive_disk1 = yes
+    image_name_disk1 = storage
+    image_size_disk1 = 1G
+    force_create_image_disk1 = yes
+    writefile_cmd = echo
+    kill_vm = yes
+    cmd_timeout = 1200
+
+    create_partition_cmd = "echo select disk 1 > imDiskpart.script && echo 
create partition primary >> imDiskpart.script && echo assign letter=E >> 
imDiskpart.script && echo exit >> imDiskpart.script && diskpart /s 
imDiskpart.script"
+    format_cmd = format E: /FS:NTFS /V:local /Q /y
+    cdrom_cd1 = isos/windows/winutils.iso
+    iometer_installation_cmd = "cmd /c WIN_UTILS:\autoit3.exe 
WIN_UTILS:\Iometer\iometer.au3"
+    iometer_reg = "cmd /c WIN_UTILS:\autoit3.exe 
WIN_UTILS:\Iometer\iometer-reg.au3"
+    iometer_run = "cmd /c C:\Iometer\Iometer.exe /c 
WIN_UTILS:\Iometer\iometer.icf /r C:\autotest_iometer_result.csv"
+    guest_path = "C:\autotest_iometer_result.csv"
+
+    variants:
+        - @default:
+            iometer_timeout = 1000
+            variants:
+                - aio_native:
+                    image_aio = native
+                - aio_threads:
+                    image_aio = threads
+        - performance:
+            iometer_run = "cmd /c C:\Iometer\Iometer.exe /c 
WIN_UTILS:\Iometer\iometer-block-2-256-queue-1-128-E.icf /r 
C:\autotest_iometer_result.csv"
+            iometer_timeout = 23400
+            variants:
+                - msi_on:
+                    cpu_family = "0xf"
+                - msi_off:
+                    cpu_family = "0xe"
+
diff --git a/tests/iometer_windows.py b/tests/iometer_windows.py
new file mode 100644
index 0000000..aa9b5d8
--- /dev/null
+++ b/tests/iometer_windows.py
@@ -0,0 +1,91 @@
+"""
+@author: Golita Yue <[email protected]>
+@author: Amos Kong <[email protected]>
+"""
+import logging, time, re
+from autotest.client.shared import error
+
+
[email protected]_aware
+def run_iometer_windows(test, params, env):
+    """
+    Run Iometer for Windows on a Windows guest:
+
+    1) Boot guest with additional disk
+    2) Install Iometer
+    3) Execute the Iometer test contained in the winutils.iso
+    4) Copy result to host
+
+    @param test: kvm test object
+    @param params: Dictionary with the test parameters
+    @param env: Dictionary with test environment.
+    """
+    def check_cdrom(timeout):
+        cdrom_chk_cmd = "echo list volume > cmd && echo exit >>"
+        cdrom_chk_cmd += " cmd && diskpart /s cmd"
+        vols = []
+        start_time = time.time()
+
+        while time.time() - start_time < timeout:
+            vols_str = session.cmd(cdrom_chk_cmd)
+            logging.info("vols_str is %s" % vols_str)
+
+            if len(re.findall("CDFS.*CD-ROM", vols_str)) >= 1:
+                vols = re.findall(".*CDFS.*?CD-ROM.*\n", vols_str)
+                logging.info("vols is %s" % vols)
+                break
+        return vols
+
+
+    vm = env.get_vm(params["main_vm"])
+    vm.verify_alive()
+    timeout = int(params.get("login_timeout", 360))
+    session = vm.wait_for_login(timeout=timeout)
+    cmd_timeout = int(params.get("cmd_timeout",1200))
+
+    logging.info("Sleep 120 seconds, and create a partition on second disk")
+    time.sleep(120)
+
+    error.context("Creating partition")
+    create_partition_cmd = params.get("create_partition_cmd")
+    session.cmd_output(cmd=create_partition_cmd,
+                                               timeout=cmd_timeout)
+
+    # Format the disk
+    format_cmd = params.get("format_cmd")
+    error.context("Formating second disk")
+    session.cmd_output(cmd=format_cmd, timeout=cmd_timeout)
+    logging.info("Disk is formated")
+
+    # Install Iometer
+    init_timeout = int(params.get("init_timeout", "60"))
+    volumes = check_cdrom(init_timeout)
+    vol_utils = re.findall("Volume\s+\d+\s+(\w).*?\d+\s+\w+", volumes[0])[0]
+
+    install_iometer_cmd = params.get("iometer_installation_cmd")
+    install_iometer_cmd = re.sub("WIN_UTILS", vol_utils, install_iometer_cmd)
+
+    error.context("Installing iometer")
+    session.cmd_output(cmd=install_iometer_cmd, timeout=cmd_timeout)
+    logging.info("Iometer is installed")
+
+    # Run Iometer
+    cmd_reg = params.get("iometer_reg")
+    cmd_run = params.get("iometer_run")
+    t = int(params.get("iometer_timeout", 1000))
+    cmd_reg = re.sub("WIN_UTILS", vol_utils, cmd_reg)
+    cmd_run = re.sub("WIN_UTILS", vol_utils, cmd_run)
+
+    error.context("Registering Iometer on guest, timeout %ss" % cmd_timeout)
+    session.cmd_output(cmd=cmd_reg, timeout=cmd_timeout)
+    logging.info("Iometer is registered")
+
+    error.context("Running Iometer command on guest, timeout %ss" % 
cmd_timeout)
+    session.cmd_output(cmd=cmd_run, timeout=t)
+    logging.info("Iometer testing completed")
+
+    guest_path = params.get("guest_path")
+    error.context("Copying result '%s' to host" % guest_path)
+    vm.copy_files_from(guest_path, test.resultsdir)
+
+    session.close()
-- 
1.7.1

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to