commit ced02cbc81701aa114d8cacc255e8bd06c6ae873
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Mon Jun 3 11:43:00 2013 +0200
NetTestResultSerializer: fix recipe result on crash
In case of crash during recipe execution the result would be PASS even
though it should be FAIL. I tried to fix this before but it turns out I
only fixed it when the crash happened in the first command.
This commit should fix it completely, in the next patch I'll add an
error message to the command that caused the crash.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst-ctl | 2 ++
lnst/Controller/NetTestResultSerializer.py | 11 ++++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/lnst-ctl b/lnst-ctl
index 05f17c1..210c6dc 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -73,6 +73,8 @@ def get_recipe_result(args, file_path, cleanup, res_serializer,
packet_capture,
log_exc_traceback()
logging.error(err)
+ res_serializer.set_recipe_result(res)
+
return ((file_path, res))
def main():
diff --git a/lnst/Controller/NetTestResultSerializer.py
b/lnst/Controller/NetTestResultSerializer.py
index 7e83759..b41ac39 100644
--- a/lnst/Controller/NetTestResultSerializer.py
+++ b/lnst/Controller/NetTestResultSerializer.py
@@ -59,7 +59,12 @@ class NetTestResultSerializer:
self._top_el.appendChild(recipe_el)
self._cur_recipe_el = recipe_el
self._cur_cmd_seq_el = None
- self._first_command = True
+
+ def set_recipe_result(self, result):
+ if result:
+ self._cur_recipe_el.setAttribute("result", "PASS")
+ else:
+ self._cur_recipe_el.setAttribute("result", "FAIL")
def add_command_sequence(self):
cmd_seq_el = self._dom.createElement("command_sequence")
@@ -80,13 +85,9 @@ class NetTestResultSerializer:
if cmd_res["passed"]:
res = "PASS"
- if self._first_command:
- self._cur_recipe_el.setAttribute("result", "PASS")
else:
res = "FAIL"
- self._cur_recipe_el.setAttribute("result", "FAIL")
result_el.setAttribute("result", res)
- self._first_command = False
if "err_msg" in cmd_res:
err_el = self._dom.createElement("error_message")
Show replies by date