new file mode 100644
@@ -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()
+
@@ -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.