All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] KVM Test: Add control file dbench.control.200 for dbench
@ 2010-04-07  8:49 Feng Yang
  2010-04-07  8:49 ` [PATCH 2/3] KVM Test: Add function run_autotest_background and wait_autotest_background Feng Yang
  0 siblings, 1 reply; 7+ messages in thread
From: Feng Yang @ 2010-04-07  8:49 UTC (permalink / raw)
  To: autotest; +Cc: kvm, Feng Yang

This control file set seconds to 200. It is used by
ioquit script.

Signed-off-by: Feng Yang <fyang@redhat.com>
---
 .../tests/kvm/autotest_control/dbench.control.200  |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
 create mode 100644 client/tests/kvm/autotest_control/dbench.control.200

diff --git a/client/tests/kvm/autotest_control/dbench.control.200 b/client/tests/kvm/autotest_control/dbench.control.200
new file mode 100644
index 0000000..c648f7a
--- /dev/null
+++ b/client/tests/kvm/autotest_control/dbench.control.200
@@ -0,0 +1,20 @@
+TIME="SHORT"
+AUTHOR = "Martin Bligh <mbligh@google.com>"
+DOC = """
+dbench is one of our standard kernel stress tests.  It produces filesystem
+load like netbench originally did, but involves no network system calls.
+Its results include throughput rates, which can be used for performance
+analysis.
+
+More information on dbench can be found here:
+http://samba.org/ftp/tridge/dbench/README
+
+Currently it needs to be updated in its configuration. It is a great test for
+the higher level I/O systems but barely touches the disk right now.
+"""
+NAME = 'dbench'
+TEST_CLASS = 'kernel'
+TEST_CATEGORY = 'Functional'
+TEST_TYPE = 'client'
+
+job.run_test('dbench', seconds=200)
-- 
1.5.5.6


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] KVM Test: Add function run_autotest_background and wait_autotest_background.
  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 ` Feng Yang
  2010-04-07  8:49   ` [PATCH 3/3] KVM Test: Add ioquit test case Feng Yang
  2010-04-08 14:18   ` [PATCH 2/3] KVM Test: Add function run_autotest_background and wait_autotest_background Michael Goldish
  0 siblings, 2 replies; 7+ messages in thread
From: Feng Yang @ 2010-04-07  8:49 UTC (permalink / raw)
  To: autotest; +Cc: kvm, Feng Yang

Add function run_autotest_background and wait_autotest_background to
kvm_test_utils.py.  This two functions is used in ioquit test script.

Signed-off-by: Feng Yang <fyang@redhat.com>
---
 client/tests/kvm/kvm_test_utils.py |   68 +++++++++++++++++++++++++++++++++++-
 1 files changed, 67 insertions(+), 1 deletions(-)

diff --git a/client/tests/kvm/kvm_test_utils.py b/client/tests/kvm/kvm_test_utils.py
index f512044..2a1054e 100644
--- a/client/tests/kvm/kvm_test_utils.py
+++ b/client/tests/kvm/kvm_test_utils.py
@@ -21,7 +21,7 @@ More specifically:
 @copyright: 2008-2009 Red Hat Inc.
 """
 
-import time, os, logging, re, commands
+import time, os, logging, re, commands, sys
 from autotest_lib.client.common_lib import error
 from autotest_lib.client.bin import utils
 import kvm_utils, kvm_vm, kvm_subprocess, scan_results
@@ -402,3 +402,69 @@ def run_autotest(vm, session, control_path, timeout, test_name, outputdir):
         result = bad_results[0]
         raise error.TestFail("Test '%s' ended with %s (reason: '%s')"
                              % (result[0], result[1], result[3]))
+
+
+def run_autotest_background(vm, session, control_path, timeout, test_name,
+                                outputdir):
+    """
+    Wrapper of run_autotest() and make it run in the background through fork()
+    and let it run in the child process.
+    1) Flush the stdio.
+    2) Build test params which is recevied from arguments and used by
+       run_autotest()
+    3) Fork the process and let the run_autotest() run in the child
+    4) Catch the exception raise by run_autotest() and exit the child with
+       non-zero return code.
+    5) If no exception catched, reutrn 0
+
+    @param vm: VM object.
+    @param session: A shell session on the VM provided.
+    @param control: An autotest control file.
+    @param timeout: Timeout under which the autotest test must complete.
+    @param test_name: Autotest client test name.
+    @param outputdir: Path on host where we should copy the guest autotest
+            results to.
+    """
+
+    def flush():
+        sys.stdout.flush()
+        sys.stderr.flush()
+
+    logging.info("Running autotest background ...")
+    flush()
+    pid = os.fork()
+    if pid:
+        # Parent process
+        return pid
+
+    try:
+        # Launch autotest
+        logging.info("child process of run_autotest_background")
+        run_autotest(vm, session, control_path, timeout, test_name, outputdir)
+    except error.TestFail, message_fail:
+        logging.info("[Autotest Background FAIL] %s" % message_fail)
+        os._exit(1)
+    except error.TestError, message_error:
+        logging.info("[Autotest Background ERROR] %s" % message_error)
+        os._exit(2)
+    except:
+        os._exit(3)
+
+    logging.info("[Auototest Background GOOD]")
+    os._exit(0)
+
+
+def wait_autotest_background(pid):
+    """
+    Wait for background autotest finish.
+
+    @param pid: Pid of the child process executing background autotest
+    """
+    logging.info("Waiting for background autotest to finish ...")
+
+    (pid, s) = os.waitpid(pid,0)
+    status = os.WEXITSTATUS(s)
+    if status != 0:
+        return False
+    return True
+
-- 
1.5.5.6


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] KVM Test: Add ioquit test case
  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
  2010-04-08 14:36     ` Michael Goldish
                       ` (2 more replies)
  2010-04-08 14:18   ` [PATCH 2/3] KVM Test: Add function run_autotest_background and wait_autotest_background Michael Goldish
  1 sibling, 3 replies; 7+ messages in thread
From: Feng Yang @ 2010-04-07  8:49 UTC (permalink / raw)
  To: autotest; +Cc: kvm, Feng Yang

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] KVM Test: Add function run_autotest_background and wait_autotest_background.
  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   ` [PATCH 3/3] KVM Test: Add ioquit test case Feng Yang
@ 2010-04-08 14:18   ` Michael Goldish
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Goldish @ 2010-04-08 14:18 UTC (permalink / raw)
  To: Feng Yang; +Cc: autotest, kvm

On 04/07/2010 11:49 AM, Feng Yang wrote:
> Add function run_autotest_background and wait_autotest_background to
> kvm_test_utils.py.  This two functions is used in ioquit test script.
> 
> Signed-off-by: Feng Yang <fyang@redhat.com>
> ---
>  client/tests/kvm/kvm_test_utils.py |   68 +++++++++++++++++++++++++++++++++++-
>  1 files changed, 67 insertions(+), 1 deletions(-)
> 
> diff --git a/client/tests/kvm/kvm_test_utils.py b/client/tests/kvm/kvm_test_utils.py
> index f512044..2a1054e 100644
> --- a/client/tests/kvm/kvm_test_utils.py
> +++ b/client/tests/kvm/kvm_test_utils.py
> @@ -21,7 +21,7 @@ More specifically:
>  @copyright: 2008-2009 Red Hat Inc.
>  """
>  
> -import time, os, logging, re, commands
> +import time, os, logging, re, commands, sys
>  from autotest_lib.client.common_lib import error
>  from autotest_lib.client.bin import utils
>  import kvm_utils, kvm_vm, kvm_subprocess, scan_results
> @@ -402,3 +402,69 @@ def run_autotest(vm, session, control_path, timeout, test_name, outputdir):
>          result = bad_results[0]
>          raise error.TestFail("Test '%s' ended with %s (reason: '%s')"
>                               % (result[0], result[1], result[3]))
> +
> +
> +def run_autotest_background(vm, session, control_path, timeout, test_name,
> +                                outputdir):
> +    """
> +    Wrapper of run_autotest() and make it run in the background through fork()
> +    and let it run in the child process.
> +    1) Flush the stdio.
> +    2) Build test params which is recevied from arguments and used by
> +       run_autotest()
> +    3) Fork the process and let the run_autotest() run in the child
> +    4) Catch the exception raise by run_autotest() and exit the child with
> +       non-zero return code.
> +    5) If no exception catched, reutrn 0
> +
> +    @param vm: VM object.
> +    @param session: A shell session on the VM provided.
> +    @param control: An autotest control file.
> +    @param timeout: Timeout under which the autotest test must complete.
> +    @param test_name: Autotest client test name.
> +    @param outputdir: Path on host where we should copy the guest autotest
> +            results to.
> +    """
> +
> +    def flush():
> +        sys.stdout.flush()
> +        sys.stderr.flush()
> +
> +    logging.info("Running autotest background ...")
> +    flush()
> +    pid = os.fork()
> +    if pid:
> +        # Parent process
> +        return pid
> +
> +    try:
> +        # Launch autotest
> +        logging.info("child process of run_autotest_background")
> +        run_autotest(vm, session, control_path, timeout, test_name, outputdir)
> +    except error.TestFail, message_fail:
> +        logging.info("[Autotest Background FAIL] %s" % message_fail)
> +        os._exit(1)
> +    except error.TestError, message_error:
> +        logging.info("[Autotest Background ERROR] %s" % message_error)
> +        os._exit(2)
> +    except:
> +        os._exit(3)
> +
> +    logging.info("[Auototest Background GOOD]")
> +    os._exit(0)
> +
> +
> +def wait_autotest_background(pid):
> +    """
> +    Wait for background autotest finish.
> +
> +    @param pid: Pid of the child process executing background autotest
> +    """
> +    logging.info("Waiting for background autotest to finish ...")
> +
> +    (pid, s) = os.waitpid(pid,0)
> +    status = os.WEXITSTATUS(s)
> +    if status != 0:
> +        return False
> +    return True
> +

I think these functions are unnecessary.  IMO forking is not the clean
way of running autotest in the background.  The kvm_shell_session
object, used to run autotest in the guest, by default runs things in the
background (e.g. session.sendline() returns immediately).
run_autotest(), which uses kvm_shell_session, blocks until the autotest
test is done.  So in order to run autotest in the background, we should
modify run_autotest(), or break it up into smaller parts, to make it
nonblocking.  There's no need to implement yet another wrapper.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] KVM Test: Add ioquit test case
  2010-04-07  8:49   ` [PATCH 3/3] KVM Test: Add ioquit test case Feng Yang
@ 2010-04-08 14:36     ` Michael Goldish
  2010-05-06 23:27     ` Lucas Meneghel Rodrigues
  2010-05-06 23:32     ` Lucas Meneghel Rodrigues
  2 siblings, 0 replies; 7+ messages in thread
From: Michael Goldish @ 2010-04-08 14:36 UTC (permalink / raw)
  To: Feng Yang; +Cc: autotest, kvm

On 04/07/2010 11:49 AM, Feng Yang wrote:
> 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.
> +    """

- Can you explain the goal of this test?  Why quit a VM under IO
workload?  What results do you expect?  How can the test ever fail?

- Why is dbench any better for this purpose than dd or some other simple
command?  Using dbench isn't necessarily bad, I'm just curious.

> +    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)

As mentioned in the other message, I don't think it's necessary to fork
and use run_autotest() in a separate process.  Instead we should modify
run_autotest() to support non-blocking operation (if we need that at all).

> +    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()

This will do a 'kill -9' on the qemu process.  Didn't you intend to use
a 'quit'?  To do that, you should use vm.destroy(gracefully=False).

> +    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

You should probably add extra_params += " -snapshot" because this test
can break the filesystem.

>      # 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] KVM Test: Add ioquit test case
  2010-04-07  8:49   ` [PATCH 3/3] KVM Test: Add ioquit test case Feng Yang
  2010-04-08 14:36     ` Michael Goldish
@ 2010-05-06 23:27     ` Lucas Meneghel Rodrigues
  2010-05-06 23:32     ` Lucas Meneghel Rodrigues
  2 siblings, 0 replies; 7+ messages in thread
From: Lucas Meneghel Rodrigues @ 2010-05-06 23:27 UTC (permalink / raw)
  To: Feng Yang; +Cc: autotest, kvm

On Wed, Apr 7, 2010 at 5:49 AM, Feng Yang <fyang@redhat.com> wrote:
> 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.
> +    """

Hi Feng, after reading your test I think I got the idea. You want to
put some heavy load on the system, quit the VM through a monitor
command and then we pray for it to not segfault during the process.

However:



> +    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
>
> _______________________________________________
> Autotest mailing list
> Autotest@test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
>



-- 
Lucas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] KVM Test: Add ioquit test case
  2010-04-07  8:49   ` [PATCH 3/3] KVM Test: Add ioquit test case Feng Yang
  2010-04-08 14:36     ` Michael Goldish
  2010-05-06 23:27     ` Lucas Meneghel Rodrigues
@ 2010-05-06 23:32     ` Lucas Meneghel Rodrigues
  2 siblings, 0 replies; 7+ messages in thread
From: Lucas Meneghel Rodrigues @ 2010-05-06 23:32 UTC (permalink / raw)
  To: Feng Yang; +Cc: autotest, kvm

On Wed, Apr 7, 2010 at 5:49 AM, Feng Yang <fyang@redhat.com> wrote:
> 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.
> +    """

Hi Feng, after reading your test I *think* I got the idea. You want to
put some heavy load on the system, quit the VM through a monitor
command and then we pray for it to not segfault during the process.

However:

1) Using autotest in the background to generate the high load
certainly seems overkill. I'd say to use a rather standard shell one
liner to generate the load, put it to run in background, and that is
it.
2) In no moment this test actually issues a 'quit' through monitor
3) When sending 'quit' is implemented, then if the VM segfaults the
crash handler will pick up the core dump

So, please simplify the test removing the function that forks autotest
and runs it on background, actually send quit through the monitor,
give it a good round of testing and then send it again. I am still not
100% convinced of the usefulness of the test, but it's worth a try.

> +    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
>
> _______________________________________________
> Autotest mailing list
> Autotest@test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
>



-- 
Lucas

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-05-06 23:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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   ` [PATCH 3/3] KVM Test: Add ioquit test case Feng Yang
2010-04-08 14:36     ` 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

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.