From: Jason Wang <jasowang@redhat.com>
To: lmr@redhat.com, autotest@test.kernel.org
Cc: kvm@vger.kernel.org
Subject: [v3 PATCH] KVM test: Add a helper to search the panic in the log
Date: Wed, 19 May 2010 17:13:41 +0800 [thread overview]
Message-ID: <20100519091341.13404.57277.stgit@dhcp-91-25.nay.redhat.com> (raw)
This checker serves as the post_command to find the panic information
in the file which contains the content of guest serial console.
Changes from v2:
- Put all things into __main__
- Fix some typos
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
client/tests/kvm/scripts/check_serial.py | 24 ++++++++++++++++++++++++
client/tests/kvm/tests_base.cfg.sample | 7 +++++--
2 files changed, 29 insertions(+), 2 deletions(-)
create mode 100644 client/tests/kvm/scripts/check_serial.py
diff --git a/client/tests/kvm/scripts/check_serial.py b/client/tests/kvm/scripts/check_serial.py
new file mode 100644
index 0000000..6432c27
--- /dev/null
+++ b/client/tests/kvm/scripts/check_serial.py
@@ -0,0 +1,24 @@
+import os, sys, glob, re
+
+
+class SerialCheckerError(Exception):
+ """
+ Simple wrapper for the builtin Exception class.
+ """
+ pass
+
+
+if __name__ == "__main__":
+ client_dir = os.environ['AUTODIR']
+ pattern = os.environ['KVM_TEST_search_pattern']
+ shortname = os.environ['KVM_TEST_shortname']
+ debugdir = os.path.join(client_dir, "results/default/kvm.%s/debug"
+ % shortname)
+ serial_files = glob.glob(os.path.join(debugdir, 'serial*'))
+
+ fail = [ f for f in serial_files if
+ re.findall(pattern, file(f).read(), re.I) ]
+ if fail:
+ print "%s is found in %s" % (pattern, fail)
+ raise SerialCheckerError("Error found during the check, please "
+ "check the log")
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index e85bb4a..c4e522a 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -52,6 +52,10 @@ address_index = 0
# Misc
profilers = kvm_stat
+# pattern to search in guest serial console
+search_pattern = panic
+post_command = "python scripts/check_serial.py"
+post_command_noncritical = no
# Tests
variants:
@@ -1324,10 +1328,9 @@ virtio|virtio_blk|e1000|balloon_check:
variants:
- @qcow2:
image_format = qcow2
- post_command = " python scripts/check_image.py;"
+ post_command += " && python scripts/check_image.py"
remove_image = no
post_command_timeout = 600
- post_command_noncritical = yes
- vmdk:
only Fedora Ubuntu Windows
only smp2
next reply other threads:[~2010-05-19 9:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-19 9:13 Jason Wang [this message]
2010-05-20 10:00 ` [Autotest] [v3 PATCH] KVM test: Add a helper to search the panic in the log Michael Goldish
2010-05-24 7:38 ` Jason Wang
2010-05-26 9:50 ` [Autotest] " Michael Goldish
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=20100519091341.13404.57277.stgit@dhcp-91-25.nay.redhat.com \
--to=jasowang@redhat.com \
--cc=autotest@test.kernel.org \
--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 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).