kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jiří Župka" <jzupka@redhat.com>
To: autotest@test.kernel.org, kvm@vger.kernel.org,
	kvm-autotest@redhat.com, lmr@redhat.com, ldoktor@redhat.com,
	jzupka@redhat.com
Subject: [KVM-Autotest][PATCH 1/5] virt: Check illegal instruction code
Date: Tue, 31 Jan 2012 15:40:13 +0100	[thread overview]
Message-ID: <1328020817-8159-2-git-send-email-jzupka@redhat.com> (raw)
In-Reply-To: <1328020817-8159-1-git-send-email-jzupka@redhat.com>

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@redhat.com>
---
 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


  reply	other threads:[~2012-01-31 14:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-31 14:40 [KVM-Autotest] Add multihost migration support to cpuflags Jiří Župka
2012-01-31 14:40 ` Jiří Župka [this message]
2012-01-31 14:40 ` [KVM-Autotest][PATCH 2/5] virt: Add aliases to class Flag Jiří Župka
2012-01-31 14:40 ` [KVM-Autotest][PATCH 3/5] kvm test: Introduce multi_host.srv Jiří Župka
2012-01-31 14:40 ` [KVM-Autotest][PATCH 4/5] virt deps: Reduces memory usage of test Jiří Župka
2012-01-31 14:40 ` [KVM-Autotest][PATCH 5/5] kvm test: Add multihost migration support to cpuflag test Jiří Župka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1328020817-8159-2-git-send-email-jzupka@redhat.com \
    --to=jzupka@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=kvm-autotest@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=ldoktor@redhat.com \
    --cc=lmr@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).