public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [KVM-AUTOTEST PATCH 0/17] kvm_subprocess, guestwizard improvements, timedrift and other small things
@ 2009-07-20 15:07 Michael Goldish
  2009-07-20 15:07 ` [KVM-AUTOTEST PATCH 01/17] Add new module kvm_subprocess Michael Goldish
  0 siblings, 1 reply; 45+ messages in thread
From: Michael Goldish @ 2009-07-20 15:07 UTC (permalink / raw)
  To: autotest, kvm


The following patch series includes all the patches I sent that have not been
applied yet. They are all rebased against the latest HEAD (including the recent
UUID patch).

Some new things are included too, such as a simple time drift test for Windows.

Sorry for posting so many commits at once.

^ permalink raw reply	[flat|nested] 45+ messages in thread
* [KVM-AUTOTEST PATCH] KVM test: kvm_subprocess: add function kill_tail_thread()
@ 2009-08-11 12:31 Michael Goldish
  2009-08-11 12:31 ` [KVM-AUTOTEST PATCH] KVM test: kvm_tests.cfg.sample: improve shell_prompt regular expressions Michael Goldish
  0 siblings, 1 reply; 45+ messages in thread
From: Michael Goldish @ 2009-08-11 12:31 UTC (permalink / raw)
  To: autotest, kvm; +Cc: Michael Goldish

Normally all threads are killed when the test process exits.  However, when
running multiple iterations of a test (with iterations=n) the test process
remains alive between iterations, and new threads are started but old threads
are not killed.  This function allow to stop thread execution explicitly.

This patch also makes the postprocessor call the function for all VMs.

Signed-off-by: Michael Goldish <mgoldish@redhat.com>
---
 client/tests/kvm/kvm_preprocessing.py |    4 ++++
 client/tests/kvm/kvm_subprocess.py    |   12 ++++++++++++
 client/tests/kvm/kvm_vm.py            |    8 ++++++++
 3 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/kvm_preprocessing.py b/client/tests/kvm/kvm_preprocessing.py
index 7c16305..ca86221 100644
--- a/client/tests/kvm/kvm_preprocessing.py
+++ b/client/tests/kvm/kvm_preprocessing.py
@@ -288,6 +288,10 @@ def postprocess(test, params, env):
                         int(params.get("post_command_timeout", "600")),
                         params.get("post_command_noncritical") == "yes")
 
+    # Kill the tailing threads of all VMs
+    for vm in kvm_utils.env_get_all_vms(env):
+        vm.kill_tail_thread()
+
     # Terminate tcpdump if no VMs are alive
     living_vms = [vm for vm in kvm_utils.env_get_all_vms(env) if vm.is_alive()]
     if not living_vms and env.has_key("tcpdump"):
diff --git a/client/tests/kvm/kvm_subprocess.py b/client/tests/kvm/kvm_subprocess.py
index dcb20cc..07303a8 100644
--- a/client/tests/kvm/kvm_subprocess.py
+++ b/client/tests/kvm/kvm_subprocess.py
@@ -489,6 +489,7 @@ class kvm_tail(kvm_spawn):
         self.output_prefix = output_prefix
 
         # Start the thread in the background
+        self.__thread_kill_requested = False
         self.tail_thread = threading.Thread(None, self._tail)
         self.tail_thread.start()
 
@@ -551,6 +552,15 @@ class kvm_tail(kvm_spawn):
         self.output_prefix = output_prefix
 
 
+    def kill_tail_thread(self):
+        """
+        Stop the tailing thread which calls output_func() and
+        termination_func().
+        """
+        self.__thread_kill_requested = True
+        self._join_thread()
+
+
     def _tail(self):
         def print_line(text):
             # Pre-pend prefix and remove trailing whitespace
@@ -567,6 +577,8 @@ class kvm_tail(kvm_spawn):
         fd = self._get_fd("tail")
         buffer = ""
         while True:
+            if self.__thread_kill_requested:
+                return
             try:
                 # See if there's any data to read from the pipe
                 r, w, x = select.select([fd], [], [], 0.05)
diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
index 9016ed3..edd822b 100644
--- a/client/tests/kvm/kvm_vm.py
+++ b/client/tests/kvm/kvm_vm.py
@@ -573,6 +573,14 @@ class VM:
         return not self.process or not self.process.is_alive()
 
 
+    def kill_tail_thread(self):
+        """
+        Stop the tailing thread which reports the output of qemu.
+        """
+        if self.process:
+            self.process.kill_tail_thread()
+
+
     def get_params(self):
         """
         Return the VM's params dict. Most modified params take effect only
-- 
1.5.4.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread
[parent not found: <916351769.31401255352843062.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>]

end of thread, other threads:[~2009-10-13 11:58 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-20 15:07 [KVM-AUTOTEST PATCH 0/17] kvm_subprocess, guestwizard improvements, timedrift and other small things Michael Goldish
2009-07-20 15:07 ` [KVM-AUTOTEST PATCH 01/17] Add new module kvm_subprocess Michael Goldish
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 02/17] Modify kvm_vm and kvm_preprocessing to use the new kvm_subprocess module Michael Goldish
2009-07-23  1:37     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 03/17] Modify remote_login and remote_scp in kvm_utils to use kvm_subprocess Michael Goldish
2009-07-23  4:02     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-23  4:03       ` Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 04/17] Modify run_autotest() in kvm_tests.py to use the new kvm_subprocess module Michael Goldish
2009-07-23  4:03     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 05/17] Remove kvm_spawn and run_bg() from kvm_utils.py Michael Goldish
2009-07-23  4:04     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 06/17] kvm_guest_wizard: rename output_dir to debug_dir in barrier_2() Michael Goldish
2009-07-24 18:07     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 07/17] kvm_guest_wizard: pass 'params' directly to barrier_2() Michael Goldish
2009-07-24 19:36     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 08/17] kvm_guest_wizard: allow keeping screendump history for debugging purposes Michael Goldish
2009-07-24 19:36     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 09/17] kvm_tests.cfg.sample: add 'keep_screendump_history = yes' to step file tests Michael Goldish
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 10/17] KVM test: optionally convert PPM files to PNG format after test Michael Goldish
2009-07-24 19:38     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 11/17] KVM test: kvm_tests.cfg.sample: convert PPM files to PNG by default Michael Goldish
2009-07-24 19:38     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 12/17] KVM test: add simple timedrift test (mainly for Windows) Michael Goldish
2009-07-21  9:23     ` [Autotest] " Dor Laor
2009-07-21  9:37       ` Michael Goldish
2009-07-21  9:42         ` Dor Laor
2009-07-21 17:25       ` Marcelo Tosatti
2009-07-21 14:57     ` Yolkfull Chow
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 13/17] KVM test: fix a parsing problem in kvm_config.py Michael Goldish
2009-07-27 13:31     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 14/17] KVM test: fix string and docstring indentation " Michael Goldish
2009-07-27 13:31     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 15/17] KVM test: add timedrift test to kvm_tests.cfg.sample Michael Goldish
2009-07-21  9:47     ` [Autotest] " Dor Laor
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 16/17] KVM test: initialize some VM attributes in __init__() to prevent trouble Michael Goldish
2009-07-27 13:34     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-20 15:07   ` [KVM-AUTOTEST PATCH 17/17] KVM test: make some style changes in kvm_preprocessing.py Michael Goldish
2009-07-27 13:35     ` [Autotest] " Lucas Meneghel Rodrigues
2009-07-22 20:32   ` [Autotest] [KVM-AUTOTEST PATCH 01/17] Add new module kvm_subprocess Lucas Meneghel Rodrigues
2009-10-12  6:55   ` [KVM-AUTOTEST,01/17] " Cao, Chen
  -- strict thread matches above, loose matches on Subject: below --
2009-08-11 12:31 [KVM-AUTOTEST PATCH] KVM test: kvm_subprocess: add function kill_tail_thread() Michael Goldish
2009-08-11 12:31 ` [KVM-AUTOTEST PATCH] KVM test: kvm_tests.cfg.sample: improve shell_prompt regular expressions Michael Goldish
     [not found] <916351769.31401255352843062.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-10-12 13:07 ` [KVM-AUTOTEST,01/17] Add new module kvm_subprocess Michael Goldish
2009-10-13  1:59   ` Cao, Chen
2009-10-13 11:58     ` Michael Goldish

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox