All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Goldish <mgoldish@redhat.com>
To: autotest@test.kernel.org, kvm@vger.kernel.org
Subject: [KVM-AUTOTEST PATCH 5/5] KVM test: abort-on-error mode
Date: Tue, 23 Mar 2010 21:10:01 +0200	[thread overview]
Message-ID: <1269371401-9341-5-git-send-email-mgoldish@redhat.com> (raw)
In-Reply-To: <1269371401-9341-4-git-send-email-mgoldish@redhat.com>

If 'abort_on_error' is set to 'yes' for a test, the entire job will be aborted
when that test fails.  If the parameter is set for all tests, the job will be
aborted as soon as the first test fails.  Before aborting, the filename of the
monitor unix socket of each VM will be printed, as well as the command line
used to start that VM.

Currently this is only supported in serial exceution mode.  Behavior in
parallel mode is undefined.

To enable abort-on-error, and to prevent the postprocessor from killing any
VMs, set the following options:

abort_on_error = yes
kill_vm.* ?= no
kill_unresponsive_vms.* ?= no

These options appear commented out near the end of tests.cfg.sample.

They can also be set for specific tests, either by writing an exception like

WinXP.32\b.*\bmigrate:
    abort_on_error = yes
    ...

in tests.cfg, or by setting the parameters in the test variant itself
(somewhere in tests_base.cfg).

Signed-off-by: Michael Goldish <mgoldish@redhat.com>
---
 client/tests/kvm/kvm_preprocessing.py |   13 +++++++++++++
 client/tests/kvm/tests.cfg.sample     |    5 +++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/kvm_preprocessing.py b/client/tests/kvm/kvm_preprocessing.py
index b3fef9d..50db65c 100644
--- a/client/tests/kvm/kvm_preprocessing.py
+++ b/client/tests/kvm/kvm_preprocessing.py
@@ -347,6 +347,19 @@ def postprocess(test, params, env):
                         int(params.get("post_command_timeout", "600")),
                         params.get("post_command_noncritical") == "yes")
 
+    # Abort on error?
+    if params.get("abort") == "yes":
+        exc_string = str(sys.exc_info()[1])
+        logging.info("Aborting job (%s)", exc_string)
+        for vm in kvm_utils.env_get_all_vms(env):
+            if not vm.is_dead():
+                logging.info("VM '%s' is alive.", vm.name)
+                logging.info("The monitor unix socket of '%s' is: %s",
+                             vm.name, vm.monitor_file_name)
+                logging.info("The command line used to start '%s' was:\n%s",
+                             vm.name, vm.make_qemu_command())
+        raise error.JobError("Abort requested (%s)" % exc_string)
+
 
 def postprocess_on_error(test, params, env):
     """
diff --git a/client/tests/kvm/tests.cfg.sample b/client/tests/kvm/tests.cfg.sample
index b86b6c4..2c17454 100644
--- a/client/tests/kvm/tests.cfg.sample
+++ b/client/tests/kvm/tests.cfg.sample
@@ -74,5 +74,10 @@ variants:
         only Fedora.12.64
         only unattended_install boot shutdown
 
+# Uncomment the following lines to enable abort-on-error mode:
+#abort_on_error = yes
+#kill_vm.* ?= no
+#kill_unresponsive_vms.* ?= no
+
 # Choose your test list from the testsets defined
 only qemu_kvm_f12_quick
-- 
1.5.4.1

      reply	other threads:[~2010-03-23 19:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-23 19:09 [KVM-AUTOTEST PATCH 1/5] KVM test: remote_login(): if rss.exe says "Please wait", wait Michael Goldish
2010-03-23 19:09 ` [KVM-AUTOTEST PATCH 2/5] KVM test: tests_base.cfg.sample: add /f option to all Windows shutdown commands Michael Goldish
2010-03-23 19:09   ` [KVM-AUTOTEST PATCH 3/5] KVM test: timedrift: first open ssh/rss sessions with the guest, then start load Michael Goldish
2010-03-23 19:10     ` [KVM-AUTOTEST PATCH 4/5] KVM test: stress_boot: make boot timeout controllable Michael Goldish
2010-03-23 19:10       ` Michael Goldish [this message]

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=1269371401-9341-5-git-send-email-mgoldish@redhat.com \
    --to=mgoldish@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=kvm@vger.kernel.org \
    /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.