[KVM-Autotest][PATCH 1/5] virt: Check illegal instruction code

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

 



Add a check on the base VM class for illegal
instruction code executed by the VM. That
check is performed on the serial console
output.

Signed-off-by: Jiří Župka <jzupka@xxxxxxxxxx>
---
 client/virt/virt_vm.py |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/client/virt/virt_vm.py b/client/virt/virt_vm.py
index 32593c1..d4fb47d 100644
--- a/client/virt/virt_vm.py
+++ b/client/virt/virt_vm.py
@@ -133,6 +133,18 @@ class VMDeadKernelCrashError(VMError):
         return ("VM is dead due to a kernel crash:\n%s" % self.kernel_crash)
 
 
+class VMInvalidInstructionCode(VMError):
+    def __init__(self, invalid_code):
+        VMError.__init__(self, invalid_code)
+        self.invalid_code = invalid_code
+
+    def __str__(self):
+        error = ""
+        for invalid_code in self.invalid_code:
+            error += "%s" % (invalid_code)
+        return ("Invalid instruction was executed on VM:\n%s" % error)
+
+
 class VMAddressError(VMError):
     pass
 
@@ -656,6 +668,21 @@ class BaseVM(object):
                 raise VMDeadKernelCrashError(match.group(0))
 
 
+    def verify_illegal_instructonn(self):
+        """
+        Find illegal instruction code on VM serial console output.
+
+        @raise: VMInvalidInstructionCode, in case a wrong instruction code.
+        """
+        if self.serial_console is not None:
+            data = self.serial_console.get_output()
+            match = re.findall(r".*trap invalid opcode.*\n", data,
+                               re.MULTILINE)
+
+            if match:
+                raise VMInvalidInstructionCode(match)
+
+
     def get_params(self):
         """
         Return the VM's params dict. Most modified params take effect only
-- 
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