From: Feng Yang <fyang@redhat.com>
To: autotest@test.kernel.org
Cc: kvm@vger.kernel.org, Feng Yang <fyang@redhat.com>
Subject: [PATCH 3/3] KVM Test: Add ioquit test case
Date: Wed, 7 Apr 2010 16:49:16 +0800 [thread overview]
Message-ID: <1270630156-9904-3-git-send-email-fyang@redhat.com> (raw)
In-Reply-To: <1270630156-9904-2-git-send-email-fyang@redhat.com>
Signed-off-by: Feng Yang <fyang@redhat.com>
---
client/tests/kvm/tests/ioquit.py | 54 ++++++++++++++++++++++++++++++++
client/tests/kvm/tests_base.cfg.sample | 4 ++
2 files changed, 58 insertions(+), 0 deletions(-)
create mode 100644 client/tests/kvm/tests/ioquit.py
diff --git a/client/tests/kvm/tests/ioquit.py b/client/tests/kvm/tests/ioquit.py
new file mode 100644
index 0000000..c75a0e3
--- /dev/null
+++ b/client/tests/kvm/tests/ioquit.py
@@ -0,0 +1,54 @@
+import logging, time, random, signal, os
+from autotest_lib.client.common_lib import error
+import kvm_test_utils, kvm_utils
+
+
+def run_ioquit(test, params, env):
+ """
+ Emulate the poweroff under IO workload(dbench so far) using monitor
+ command 'quit'.
+
+ @param test: Kvm test object
+ @param params: Dictionary with the test parameters.
+ @param env: Dictionary with test environment.
+ """
+ vm = kvm_test_utils.get_living_vm(env, params.get("main_vm"))
+ session = kvm_test_utils.wait_for_login(vm,
+ timeout=int(params.get("login_timeout", 360)))
+ session2 = kvm_test_utils.wait_for_login(vm,
+ timeout=int(params.get("login_timeout", 360)))
+ def is_autotest_launched():
+ if session.get_command_status("pgrep autotest") != 0:
+ logging.debug("Autotest process not found")
+ return False
+ return True
+
+ test_name = params.get("background_test", "dbench")
+ control_file = params.get("control_file", "dbench.control")
+ timeout = int(params.get("test_timeout", 300))
+ control_path = os.path.join(test.bindir, "autotest_control",
+ control_file)
+ outputdir = test.outputdir
+
+ pid = kvm_test_utils.run_autotest_background(vm, session2, control_path,
+ timeout, test_name,
+ outputdir)
+ if pid < 0:
+ raise error.TestError("Could not create child process to execute "
+ "autotest background")
+
+ if kvm_utils.wait_for(is_autotest_launched, 240, 0, 2):
+ logging.debug("Background autotest successfully")
+ else:
+ logging.debug("Background autotest failed, start the test anyway")
+
+ time.sleep(100 + random.randrange(0,100))
+ logging.info("Kill the virtual machine")
+ vm.process.close()
+
+ logging.info("Kill the tracking process")
+ kvm_utils.safe_kill(pid, signal.SIGKILL)
+ kvm_test_utils.wait_autotest_background(pid)
+ session.close()
+ session2.close()
+
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index 9b12fc2..d8530f6 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -305,6 +305,10 @@ variants:
- ksm_parallel:
ksm_mode = "parallel"
+ - ioquit:
+ type = ioquit
+ control_file = dbench.control.200
+ background_test = dbench
# system_powerdown, system_reset and shutdown *must* be the last ones
# defined (in this order), since the effect of such tests can leave
# the VM on a bad state.
--
1.5.5.6
next prev parent reply other threads:[~2010-04-07 8:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-07 8:49 [PATCH 1/3] KVM Test: Add control file dbench.control.200 for dbench Feng Yang
2010-04-07 8:49 ` [PATCH 2/3] KVM Test: Add function run_autotest_background and wait_autotest_background Feng Yang
2010-04-07 8:49 ` Feng Yang [this message]
2010-04-08 14:36 ` [PATCH 3/3] KVM Test: Add ioquit test case Michael Goldish
2010-05-06 23:27 ` Lucas Meneghel Rodrigues
2010-05-06 23:32 ` Lucas Meneghel Rodrigues
2010-04-08 14:18 ` [PATCH 2/3] KVM Test: Add function run_autotest_background and wait_autotest_background Michael Goldish
[not found] <1224281688.193301273198204980.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>
2010-05-07 2:15 ` [PATCH 3/3] KVM Test: Add ioquit test case Feng Yang
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=1270630156-9904-3-git-send-email-fyang@redhat.com \
--to=fyang@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 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).