[KVM-Autotest][PATCH 2/2] kvm test: Adds new subtest to cpuflags test.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adds new subtest which tests warning of
<qemu-kvm> -cpu started with parameter "check".

Signed-off-by: Jiří Župka <jzupka@xxxxxxxxxx>
---
 client/tests/kvm/tests/cpuflags.py |   35 +++++++++++++++++++++++++++++++++++
 client/virt/subtests.cfg.sample    |    2 ++
 client/virt/virt_utils.py          |    1 +
 3 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/tests/cpuflags.py b/client/tests/kvm/tests/cpuflags.py
index 97dcbaa..1b8306d 100644
--- a/client/tests/kvm/tests/cpuflags.py
+++ b/client/tests/kvm/tests/cpuflags.py
@@ -429,6 +429,41 @@ def run_cpuflags(test, params, env):
                                      (str(Flags[1])))
 
     # 3) fail boot unsupported flags
+    class test_boot_warn_with_host_unsupported_flags(MiniSubtest):
+        def test(self):
+            #This is virtual cpu flags which are supported by
+            #qemu but no with host cpu.
+            cpu_model, extra_flags = parse_cpu_model()
+
+            flags = HgFlags(cpu_model, extra_flags)
+
+            logging.debug("Unsupported flags %s.",
+                          str(flags.host_all_unsupported_flags))
+            cpuf_model = cpu_model + ",check"
+
+            # Add unsupported flags.
+            for fadd in flags.host_all_unsupported_flags:
+                cpuf_model += ",+" + fadd
+
+            cmd = qemu_binary + " -cpu " + cpuf_model
+            out = None
+
+            try:
+                try:
+                    out = utils.run(cmd, timeout=5, ignore_status=True).stderr
+                    raise error.TestFail("Guest not boot with unsupported "
+                                         "flags.")
+                except error.CmdError, e:
+                    out = e.result_obj.stderr
+            finally:
+                uns_re = re.compile("^warning:.*flag '(.+)'", re.MULTILINE)
+                warn_flags = set(map(virt_utils.Flag, uns_re.findall(out)))
+                fwarn_flags = flags.host_all_unsupported_flags - warn_flags
+                if fwarn_flags:
+                    raise error.TestFail("Qemu did not warn the use of "
+                                         "flags %s" % str(fwarn_flags))
+
+    # 3) fail boot unsupported flags
     class test_fail_boot_with_host_unsupported_flags(MiniSubtest):
         def test(self):
             #This is virtual cpu flags which are supported by
diff --git a/client/virt/subtests.cfg.sample b/client/virt/subtests.cfg.sample
index ad24075..58e2928 100644
--- a/client/virt/subtests.cfg.sample
+++ b/client/virt/subtests.cfg.sample
@@ -1437,6 +1437,8 @@ variants:
                         test_type = "test_boot_cpu_model"
                     - qemu_boot_cpu_model_and_flags:
                         test_type = "test_boot_cpu_model_and_additional_flags"
+                    - qemu_warn_boot_check_cpu_model:
+                        test_type = "test_boot_warn_with_host_unsupported_flags"
                     - qemu_boot_fail_cpu_model:
                         test_type = "test_fail_boot_with_host_unsupported_flags"
             - stress_guest:
diff --git a/client/virt/virt_utils.py b/client/virt/virt_utils.py
index 20ed4ba..e65b322 100644
--- a/client/virt/virt_utils.py
+++ b/client/virt/virt_utils.py
@@ -1331,6 +1331,7 @@ kvm_map_flags_to_test = {
 kvm_map_flags_aliases = {
             'sse4.1'              :'sse4_1',
             'sse4.2'              :'sse4_2',
+            'pclmulqdq'           :'pclmuldq',
             }
 
 
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux