From: Jiri Pirko <jiri(a)mellanox.com>
Just ignore the user option and save the stderr and stdout always.
Allows to shorten the run method call from tasks.
Signed-off-by: Jiri Pirko <jiri(a)mellanox.com>
---
lnst/Common/NetTestCommand.py | 10 ++--------
lnst/Controller/NetTestController.py | 2 --
lnst/Controller/Task.py | 2 +-
lnst/RecipeCommon/IRQ.py | 2 +-
regression-tests/tests/28/recipe1.py | 2 +-
regression-tests/tests/28/recipe2.py | 2 +-
regression-tests/tests/28/recipe3.py | 2 +-
regression-tests/tests/28/recipe4.py | 2 +-
8 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/lnst/Common/NetTestCommand.py b/lnst/Common/NetTestCommand.py
index 774c26e..3c290dc 100644
--- a/lnst/Common/NetTestCommand.py
+++ b/lnst/Common/NetTestCommand.py
@@ -400,7 +400,6 @@ class NetTestCommandGeneric(object):
class NetTestCommandExec(NetTestCommandGeneric):
def __init__(self, command):
super(NetTestCommandExec, self).__init__(command)
- self._save_output = "save_output" in command
def run(self):
try:
@@ -409,15 +408,10 @@ class NetTestCommandExec(NetTestCommandGeneric):
self._command["command"])
else:
stdout, stderr = self.exec_cmd(self._command["command"])
- res_data = None
- if self._save_output:
- res_data = { "stdout": stdout, "stderr": stderr }
+ res_data = {"stdout": stdout, "stderr": stderr}
self.set_pass(res_data)
except ExecCmdFail as e:
- res_data = None
- if self._save_output:
- res_data = { "stdout": e.get_stdout(),
- "stderr": e.get_stderr() }
+ res_data = {"stdout": e.get_stdout(), "stderr":
e.get_stderr()}
if "bg_id" in self._command:
logging.info("Command probably intentionally killed.
Passing.")
self.set_pass(res_data)
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index 791dd95..c8a58b3 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -439,8 +439,6 @@ class NetTestController:
if "from" in cmd_data:
cmd["from"] = cmd_data["from"]
- if "save_output" in cmd_data:
- cmd["save_output"] = cmd_data["save_output"]
elif cmd["type"] in ["wait", "intr",
"kill"]:
# 'proc_id' is used to store bg_id for wait/kill/intr
# 'bg_id' is used for test/exec
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py
index 6f36e86..fefe2cb 100644
--- a/lnst/Controller/Task.py
+++ b/lnst/Controller/Task.py
@@ -282,7 +282,7 @@ class HostAPI(object):
elif arg == "netns":
cmd["netns"] = argval
elif arg == "save_output":
- cmd["save_output"] = argval
+ pass # now ignored as output is saved always
else:
msg = "Argument '%s' not recognised by the run()
method." % arg
raise TaskError(msg)
diff --git a/lnst/RecipeCommon/IRQ.py b/lnst/RecipeCommon/IRQ.py
index 4548a89..825a2b3 100644
--- a/lnst/RecipeCommon/IRQ.py
+++ b/lnst/RecipeCommon/IRQ.py
@@ -21,7 +21,7 @@ cpu: integer
'''
def pin_dev_irqs(machine, device, cpu):
pi = machine.run("grep %s /proc/interrupts | cut -f1 -d: | sed 's/
//'"
- % device.get_devname(), save_output=True)
+ % device.get_devname())
res = pi.get_result()
intrs = res["res_data"]["stdout"]
for intr in intrs.split('\n'):
diff --git a/regression-tests/tests/28/recipe1.py b/regression-tests/tests/28/recipe1.py
index a0834e9..ed19f23 100644
--- a/regression-tests/tests/28/recipe1.py
+++ b/regression-tests/tests/28/recipe1.py
@@ -4,7 +4,7 @@ m1 = ctl.get_host("testmachine1")
m1.sync_resources(modules=["Custom"], tools=[])
-test = m1.run("while true; do echo test; sleep 1; done", bg=True,
save_output="yes")
+test = m1.run("while true; do echo test; sleep 1; done", bg=True)
ctl.wait(5)
diff --git a/regression-tests/tests/28/recipe2.py b/regression-tests/tests/28/recipe2.py
index b47ff5a..7b739bb 100644
--- a/regression-tests/tests/28/recipe2.py
+++ b/regression-tests/tests/28/recipe2.py
@@ -4,7 +4,7 @@ m1 = ctl.get_host("testmachine1")
m1.sync_resources(modules=["Custom"], tools=[])
-test = m1.run("for i in `seq 5`; do echo test; sleep 1; done", bg=True,
save_output="yes")
+test = m1.run("for i in `seq 5`; do echo test; sleep 1; done", bg=True)
test.wait()
diff --git a/regression-tests/tests/28/recipe3.py b/regression-tests/tests/28/recipe3.py
index 802d93f..9d9fd9b 100644
--- a/regression-tests/tests/28/recipe3.py
+++ b/regression-tests/tests/28/recipe3.py
@@ -4,7 +4,7 @@ m1 = ctl.get_host("testmachine1")
m1.sync_resources(modules=["Custom"], tools=[])
-test = m1.run("while true; do echo test; sleep 1; done", bg=True,
save_output="yes")
+test = m1.run("while true; do echo test; sleep 1; done", bg=True)
ctl.wait(5)
diff --git a/regression-tests/tests/28/recipe4.py b/regression-tests/tests/28/recipe4.py
index e8e8f99..ae36c37 100644
--- a/regression-tests/tests/28/recipe4.py
+++ b/regression-tests/tests/28/recipe4.py
@@ -4,7 +4,7 @@ m1 = ctl.get_host("testmachine1")
m1.sync_resources(modules=["Custom"], tools=[])
-test = m1.run("echo test", save_output="yes")
+test = m1.run("echo test")
output = test.get_result()["res_data"]["stdout"]
custom = ctl.get_module("Custom", options={ "fail": True })
--
2.5.5