From: Michael Goldish <mgoldish@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: Lucas Meneghel Rodrigues <lmr@redhat.com>,
autotest@test.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM test: Create a verify_kernel_crash() VM method
Date: Wed, 02 Mar 2011 12:56:08 +0200 [thread overview]
Message-ID: <4D6E2248.6070602@redhat.com> (raw)
In-Reply-To: <19821.54756.290526.871208@gargle.gargle.HOWL>
On 03/02/2011 07:30 AM, Jason Wang wrote:
> Lucas Meneghel Rodrigues writes:
> > A method to verify guest kernel panics can be very
> > useful for a number of tests. Adapted from a function
> > present on virtio_console test, create VM.verify_kernel_crash()
> > and use it on unattended_install.
> >
>
> How about using a thread to monitor the serial console, so other test can also
> benefit from this?
If an exception is raised in a background thread, it won't kill the main
thread, so it's not obvious how a background thread can help here. Or
maybe I misunderstood your suggestion?
> > Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
> > ---
> > client/tests/kvm/kvm_vm.py | 32 ++++++++++++++++++++++++++
> > client/tests/kvm/tests/unattended_install.py | 1 +
> > 2 files changed, 33 insertions(+), 0 deletions(-)
> >
> > diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
> > index 41f7491..ab60f71 100755
> > --- a/client/tests/kvm/kvm_vm.py
> > +++ b/client/tests/kvm/kvm_vm.py
> > @@ -105,6 +105,15 @@ class VMDeadError(VMError):
> > (self.status, self.output))
> >
> >
> > +class VMDeadKernelCrashError(VMError):
> > + def __init__(self, kernel_crash):
> > + VMError.__init__(self, kernel_crash)
> > + self.kernel_crash = kernel_crash
> > +
> > + def __str__(self):
> > + return ("VM is dead due to a kernel crash: %s" % self.kernel_crash)
> > +
> > +
> > class VMAddressError(VMError):
> > pass
> >
> > @@ -1471,6 +1480,29 @@ class VM:
> > return self.serial_login(internal_timeout)
> >
> >
> > + def verify_kernel_crash(self, timeout=2):
> > + """
> > + Find kernel crash message on serial console.
> > +
> > + @param timeout: Timeout used to verify expected output.
> > +
> > + @raise: VMDeadKernelCrashError, in case a kernel crash message was
> > + found.
> > + """
> > + data = self.serial_console.read_nonblocking()
> > + match = re.search("BUG:", data, re.MULTILINE)
> > + if match is not None:
> > + match = re.search(r"BUG:.*---\[ end trace .* \]---",
> > + data, re.DOTALL |re.MULTILINE)
> > + if match is None:
> > + data += self.serial_console.read_until_last_line_matches(
> > + ["---\[ end trace .* \]---"],
> > + timeout)
> > + match = re.search(r"(BUG:.*---\[ end trace .* \]---)",
> > + data, re.DOTALL |re.MULTILINE)
> > + raise VMDeadKernelCrashError(match.group(0))
> > +
> > +
> > @error.context_aware
> > def migrate(self, timeout=3600, protocol="tcp", cancel_delay=None,
> > offline=False, stable_check=False, clean=True,
> > diff --git a/client/tests/kvm/tests/unattended_install.py b/client/tests/kvm/tests/unattended_install.py
> > index 7c6d845..955f8d6 100644
> > --- a/client/tests/kvm/tests/unattended_install.py
> > +++ b/client/tests/kvm/tests/unattended_install.py
> > @@ -33,6 +33,7 @@ def run_unattended_install(test, params, env):
> > start_time = time.time()
> > while (time.time() - start_time) < install_timeout:
> > vm.verify_alive()
> > + vm.verify_kernel_crash()
> > client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> > try:
> > client.connect((vm.get_address(), port))
> > --
> > 1.7.4
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe kvm" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2011-03-02 10:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-02 3:46 [PATCH] KVM test: Create a verify_kernel_crash() VM method Lucas Meneghel Rodrigues
2011-03-02 5:30 ` Jason Wang
2011-03-02 10:56 ` Michael Goldish [this message]
2011-03-02 11:05 ` Michael Goldish
2011-03-02 13:07 ` Lucas Meneghel Rodrigues
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=4D6E2248.6070602@redhat.com \
--to=mgoldish@redhat.com \
--cc=autotest@test.kernel.org \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.