From patchwork Wed May 19 09:13:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 100817 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4J99nVX030699 for ; Wed, 19 May 2010 09:09:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757118Ab0ESJIp (ORCPT ); Wed, 19 May 2010 05:08:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32885 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755193Ab0ESJIm (ORCPT ); Wed, 19 May 2010 05:08:42 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4J98fvT002485 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 May 2010 05:08:41 -0400 Received: from dhcp-91-25.nay.redhat.com (dhcp-91-25.nay.redhat.com [10.66.91.25]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4J98c4P029273; Wed, 19 May 2010 05:08:39 -0400 Subject: [v3 PATCH] KVM test: Add a helper to search the panic in the log To: lmr@redhat.com, autotest@test.kernel.org From: Jason Wang Cc: kvm@vger.kernel.org Date: Wed, 19 May 2010 17:13:41 +0800 Message-ID: <20100519091341.13404.57277.stgit@dhcp-91-25.nay.redhat.com> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 19 May 2010 09:09:49 +0000 (UTC) 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