commit 0438c8330b1659792038da945e2e55a5ceefdcee
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Fri Mar 29 13:55:03 2013 +0100
NetTestCommand: reimplement the NetTestCommand classes
These classes previously worked only with background processes and
needed to be changed to reflect this.
The kill/intr/wait test commands are the only exception to the
"all test commands will run in the background" and will be run in the
main process since they need access to the child processes.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
lnst/Common/NetTestCommand.py | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/lnst/Common/NetTestCommand.py b/lnst/Common/NetTestCommand.py
index 3fd6ac4..146401e 100644
--- a/lnst/Common/NetTestCommand.py
+++ b/lnst/Common/NetTestCommand.py
@@ -326,29 +326,35 @@ class NetTestCommandControl(NetTestCommandGeneric):
class NetTestCommandWait(NetTestCommandControl):
def run(self):
bg_id = self._command["value"]
- bg_cmd = self._command_context.get_bg_cmd(bg_id)
+ bg_cmd = self._command_context.get_cmd(bg_id)
bg_cmd.wait_for()
result = bg_cmd.get_result()
- self._command_context.del_bg_cmd(bg_cmd)
- self.set_result(result)
+ if result != None:
+ bg_cmd.join()
+ self._command_context.del_cmd(bg_cmd)
+ return result
class NetTestCommandIntr(NetTestCommandControl):
def run(self):
bg_id = self._command["value"]
- bg_cmd = self._command_context.get_bg_cmd(bg_id)
+ bg_cmd = self._command_context.get_cmd(bg_id)
bg_cmd.interrupt()
result = bg_cmd.get_result()
- self._command_context.del_bg_cmd(bg_cmd)
- self.set_result(result)
+ if result != None:
+ bg_cmd.join()
+ self._command_context.del_cmd(bg_cmd)
+ return result
class NetTestCommandKill(NetTestCommandControl):
def run(self):
bg_id = self._command["value"]
- bg_cmd = self._command_context.get_bg_cmd(bg_id)
+ bg_cmd = self._command_context.get_cmd(bg_id)
bg_cmd.kill()
result = bg_cmd.get_result()
- self._command_context.del_bg_cmd(bg_cmd)
- self.set_result({"passed": True})
+ if result != None:
+ bg_cmd.join()
+ self._command_context.del_cmd(bg_cmd)
+ return result
def get_command_class(command_context, command, resource_table):
cmd_type = command["type"]
Show replies by date