[lnst] smoke tests: remove invalid 'type' attribute
by Jiří Pírko
commit f49510662d6b700604c34404d830823b34a1d914
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Wed Jun 5 13:25:25 2013 +0200
smoke tests: remove invalid 'type' attribute
This commit removes the attribute type from the interface tags team and
vlan. This was overlooked previously when the files were adjusted to fit
the new recipe format.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
recipes/smoke/lib/conf-team.xml | 2 +-
recipes/smoke/lib/conf-vlan.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/recipes/smoke/lib/conf-team.xml b/recipes/smoke/lib/conf-team.xml
index cf5aac8..8493e09 100644
--- a/recipes/smoke/lib/conf-team.xml
+++ b/recipes/smoke/lib/conf-team.xml
@@ -1,7 +1,7 @@
<interfaces>
<eth id="if-1" network="net"/>
<eth id="if-2" network="net"/>
- <team id="testiface" type="team">
+ <team id="testiface">
<options>
<option name="teamd_config">
{
diff --git a/recipes/smoke/lib/conf-vlan.xml b/recipes/smoke/lib/conf-vlan.xml
index 92d5e23..542b167 100644
--- a/recipes/smoke/lib/conf-vlan.xml
+++ b/recipes/smoke/lib/conf-vlan.xml
@@ -1,6 +1,6 @@
<interfaces>
<eth id="if-1" network="net"/>
- <vlan id="testiface" type="vlan">
+ <vlan id="testiface">
<options>
<option name="vlan_tci" value="10"/>
</options>
10 years, 10 months
[lnst] smoke lib: add variable icmp_result to cmd sequences
by Jiří Pírko
commit 161ac5885c3f67ef53f90664c4b2b6f9c92e7be7
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Wed Jun 5 13:24:20 2013 +0200
smoke lib: add variable icmp_result to cmd sequences
This commit adds the recently added attribute pass_result tag to two
commands in command sequences of smoke tests. The value of this
attribute is a variable icmp_result added in the previous commit.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
recipes/smoke/lib/seq-bg.xml | 2 +-
recipes/smoke/lib/seq-ping.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/recipes/smoke/lib/seq-bg.xml b/recipes/smoke/lib/seq-bg.xml
index 302a9f4..7f3ec80 100644
--- a/recipes/smoke/lib/seq-bg.xml
+++ b/recipes/smoke/lib/seq-bg.xml
@@ -9,5 +9,5 @@
</options>
</command>
<command type="ctl_wait" value="5"/>
- <command machine_id="1" timeout="30" type="intr" value="1"/>
+ <command machine_id="1" timeout="30" type="intr" pass_result="#icmp_result#" value="1"/>
</command_sequence>
diff --git a/recipes/smoke/lib/seq-ping.xml b/recipes/smoke/lib/seq-ping.xml
index 27dd032..ec8e340 100644
--- a/recipes/smoke/lib/seq-ping.xml
+++ b/recipes/smoke/lib/seq-ping.xml
@@ -1,5 +1,5 @@
<command_sequence>
- <command machine_id="1" timeout="30" type="test" value="IcmpPing">
+ <command machine_id="1" timeout="30" type="test" value="IcmpPing" pass_result="#icmp_result#">
<options>
<option name="addr" value="{ip(2,testiface)}"/>
<option name="count" value="40"/>
10 years, 10 months
[lnst] add generate-recipes.py
by Jiří Pírko
commit 0f3920c216a7f6d7dcfd2dc5ed6fc84a8ea7ed8e
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Wed Jun 5 13:24:19 2013 +0200
add generate-recipes.py
This commit adds a python version of the generate-recipes.sh script made
by Radek. I made this because I wanted to add a feature to the recipe
generation which required xml manipulation.
The new script will create a recipe for every combination of two
machines, similarily to how the original script did. After that it will
parse the recipe xml and expand the sourced tags. Then it will do a
final round of variable replacement. The resulting xml is written to the
recipe file.
The added feature is the second round of variable replacement. These
variables are dynamically loaded from the file variables.conf also added
in this patch. This file can define aditional variables in the section
defaults and then in sections named after the combinations of
configuration files (e.g. bond-bond or vlan-bond). This allows us to
define a slightly different behaviour of command sequences for different
configurations. At the moment the only defined variable is 'icmp_result'
which I use to indicate that the IcmpPing test should fail for
configurations of vlan-<non-vlan>.
To use a defined variable in the recipe fragments write this: #var_name#
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
recipes/smoke/generate-recipes.py | 143 +++++++++++++++++++++++++++++++++++++
recipes/smoke/lib/variables.conf | 14 ++++
2 files changed, 157 insertions(+), 0 deletions(-)
---
diff --git a/recipes/smoke/generate-recipes.py b/recipes/smoke/generate-recipes.py
new file mode 100755
index 0000000..e81d265
--- /dev/null
+++ b/recipes/smoke/generate-recipes.py
@@ -0,0 +1,143 @@
+#! /usr/bin/env python
+
+# LNST Smoke Tests
+# Author: Ondrej Lichtner <olichtne(a)redhat.com>
+# License: GNU GPLv2
+# Based on generate-recipes.sh from Radek Pazdera <rpazdera(a)redhat.com>
+
+# This script will generate a set of recipes for assessing the very basic
+# functionality of LNST.
+
+import os
+import shutil
+import re
+import ConfigParser
+import xml.dom.minidom
+
+def print_test_usage():
+ print ""
+
+ print "To run these recipes, you need to have a pool prepared with at"
+ print "least two machines. Both of them must have at least two test"
+ print "interfaces connected to the same network segment."
+
+ print ""
+
+ print " +-----------+ +--------+ +-----------+"
+ print " | |----------| |----------| |"
+ print " | Machine | | Switch | | Machine |"
+ print " | 1 |----------| |----------| 2 |"
+ print " | | +--------+ | |"
+ print " +-----------+ +-----------+"
+
+ print "\nYou can execute the set using the following command:"
+ print " ./lnst-ctl -d recipes/smoke/tests/ run"
+
+def replace_variables(recipe, name1, name2, variables):
+ vars = dict(variables.items("defaults"))
+
+ if variables.has_section("%s-%s" % (name1, name2)):
+ section = variables.items("%s-%s" % (name1, name2))
+ for name, val in section:
+ vars[name] = val
+
+ for name, val in vars.iteritems():
+ recipe = recipe.replace("#%s#" % name, val)
+ return recipe
+
+def handleNode(node):
+ if node.nodeType == node.ELEMENT_NODE:
+ if node.hasAttribute("source"):
+ src_file_name = node.getAttribute("source")
+ loaded_dom = xml.dom.minidom.parse(src_file_name)
+ loaded_node = None
+ try:
+ loaded_node = loaded_dom.getElementsByTagName(node.nodeName)[0]
+ except Exception:
+ msg = ("No '%s' element present in included file '%s'."
+ % (node.nodeName, src_file_name))
+ raise Exception(msg, node)
+
+ old_attrs = node.attributes
+
+ parent = node.parentNode
+ parent.replaceChild(loaded_node, node)
+ node = loaded_node
+
+ # copy all of the original attributes to the sourced node
+ for i in range(old_attrs.length):
+ attr = old_attrs.item(i)
+ # do not overwrite sourced attributes
+ if not node.hasAttribute(attr.name) and attr.name != "source":
+ node.setAttribute(attr.name, attr.value)
+
+ handleNode(node)
+ else:
+ childNodes = list(node.childNodes)
+ for child in childNodes:
+ if child.nodeType == node.TEXT_NODE and child.data.isspace():
+ node.removeChild(child)
+ else:
+ handleNode(child)
+
+def expand_sources(recipe):
+ document = xml.dom.minidom.parseString(recipe)
+ for child in document.childNodes:
+ handleNode(child)
+ recipe = document.toprettyxml()
+ return recipe
+
+def main():
+ DIR = "tests/"
+ LIB = "../lib/"
+ vars_filename = "%svariables.conf" % LIB
+
+ print "[LNST Smoke Tests]"
+ print "Creating '%s' directory for the recipes..." % DIR,
+ shutil.rmtree(DIR, ignore_errors=True)
+ os.mkdir(DIR)
+ os.chdir(DIR)
+ print "[DONE]"
+
+ sequences = ""
+ for seq in os.listdir(LIB):
+ if not re.match("seq-.*", seq):
+ continue
+ print "Found command sequence %s%s" % (LIB, seq)
+ sequences += "\n <command_sequence source=\"%s%s\"/>" % (LIB, seq)
+
+ conf_files = [LIB+i for i in os.listdir(LIB) if re.match("conf-.*", i)]
+ for conf in conf_files:
+ print "Found configuration %s" % conf
+
+ template_file = open("%s/recipe-temp.xml" % LIB, 'r')
+ template = template_file.read()
+
+ variables = ConfigParser.ConfigParser()
+ variables.read(vars_filename)
+
+ for machine1 in conf_files:
+ for machine2 in conf_files:
+ name1 = re.match(".*conf-(.*)\.xml", machine1).group(1)
+ name2 = re.match(".*conf-(.*)\.xml", machine2).group(1)
+ recipe_name = "recipe-%s-%s.xml" % (name1, name2)
+ print "Generating %s%s..." % (DIR, recipe_name),
+
+ recipe = template.replace("#CONF1#", machine1)\
+ .replace("#CONF2#", machine2)\
+ .replace("#SEQUENCES#", sequences)
+
+ recipe = expand_sources(recipe)
+
+ recipe = replace_variables(recipe, name1, name2, variables)
+
+ recipe_file = open("%s" % recipe_name, 'w')
+ recipe_file.write(recipe)
+ recipe_file.close()
+
+ print "[DONE]"
+
+ print_test_usage()
+
+if __name__ == "__main__":
+ main()
diff --git a/recipes/smoke/lib/variables.conf b/recipes/smoke/lib/variables.conf
new file mode 100644
index 0000000..a0ad9f9
--- /dev/null
+++ b/recipes/smoke/lib/variables.conf
@@ -0,0 +1,14 @@
+[defaults]
+icmp_result = true
+[bond-vlan]
+icmp_result=false
+[team-vlan]
+icmp_result=false
+[eth-vlan]
+icmp_result=false
+[vlan-bond]
+icmp_result=false
+[vlan-team]
+icmp_result=false
+[vlan-eth]
+icmp_result=false
10 years, 10 months
[lnst] add attribute "pass_result" to <command> tags
by Jiří Pírko
commit 2feb83820516ae48099178dcea93b95e1980a318
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Wed Jun 5 13:24:18 2013 +0200
add attribute "pass_result" to <command> tags
The added attribute indicates what the expected result of the command
is. The result of the command is then calculated as an equality of the
expected result and recieved result. This can be used to test scenarios
where you expect the command should fail and therefore indicates a
successfull run of the command.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/Machine.py | 3 +++
lnst/Controller/RecipeParse.py | 7 +++++++
recipe-schema.rng | 27 +++++++++++++++++++++++++++
3 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index 006a5a0..2ae008c 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -178,6 +178,9 @@ class Machine(object):
signal.alarm(0)
signal.signal(signal.SIGALRM, prev_handler)
+ if "pass_result" in command:
+ cmd_res["passed"] = cmd_res["passed"] == command["pass_result"]
+
return cmd_res
def get_hostname(self):
diff --git a/lnst/Controller/RecipeParse.py b/lnst/Controller/RecipeParse.py
index d2d1171..04cb648 100644
--- a/lnst/Controller/RecipeParse.py
+++ b/lnst/Controller/RecipeParse.py
@@ -452,6 +452,13 @@ class CommandParse(LnstParser):
if self._has_attribute(node, "value"):
command["value"] = self._get_attribute(node, "value")
+ if self._has_attribute(node, "pass_result"):
+ command["pass_result"] = self._get_attribute(node, "pass_result",
+ bool_it)
+ if command["type"] == "system_config":
+ msg = "Invalid attribute pass_result for command system_config"
+ raise XmlProcessingError(msg, node)
+
if self._has_attribute(node, "timeout"):
command["timeout"] = self._get_attribute(node, "timeout", int)
diff --git a/recipe-schema.rng b/recipe-schema.rng
index 57445b4..9f109af 100644
--- a/recipe-schema.rng
+++ b/recipe-schema.rng
@@ -377,6 +377,15 @@
<optional>
<attribute name="source"/>
</optional>
+
+ <optional>
+ <attribute name="pass_result">
+ <choice>
+ <value>true</value>
+ <value>false</value>
+ </choice>
+ </attribute>
+ </optional>
</define>
<define name="system_config">
@@ -450,6 +459,15 @@
<optional>
<attribute name="source"/>
</optional>
+
+ <optional>
+ <attribute name="pass_result">
+ <choice>
+ <value>true</value>
+ <value>false</value>
+ </choice>
+ </attribute>
+ </optional>
</define>
<define name="control_commands">
@@ -484,5 +502,14 @@
<optional>
<attribute name="source"/>
</optional>
+
+ <optional>
+ <attribute name="pass_result">
+ <choice>
+ <value>true</value>
+ <value>false</value>
+ </choice>
+ </attribute>
+ </optional>
</define>
</grammar>
10 years, 10 months
[lnst] NetTestController: add command result on crash
by Jiří Pírko
commit 93917e2084c5ccceeb484c697472bb34cc1768a7
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Mon Jun 3 11:43:01 2013 +0200
NetTestController: add command result on crash
If there was an exception raised during command execution, that command
wouldn't have a result assigned. This will be visible in the summary
output as a sequence of commands having passed but the overal recipe
result is FAIL.
This commit fixes that by adding a FAIL result to the command and an
error message to indicate that the command failed because of an
exception.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/NetTestController.py | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index 3cf3f91..ae2a78a 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -210,9 +210,15 @@ class NetTestController:
seq_passed = True
for command in sequence["commands"]:
logging.info("Executing command: [%s]", str_command(command))
- cmd_res = self._run_command(command)
- if self._res_serializer:
- self._res_serializer.add_cmd_result(command, cmd_res)
+
+ try:
+ cmd_res = self._run_command(command)
+ except Exception as exc:
+ cmd_res = {"passed": False, "err_msg": "Exception raised."}
+ raise exc
+ finally:
+ if self._res_serializer:
+ self._res_serializer.add_cmd_result(command, cmd_res)
logging.debug("Result: %s", str(cmd_res))
if "res_data" in cmd_res:
res_data = pformat(cmd_res["res_data"])
10 years, 10 months
[lnst] NetTestResultSerializer: fix recipe result on crash
by Jiří Pírko
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")
10 years, 10 months
[PATCH] smoke tests: remove invalid 'type' attribute
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
This commit removes the attribute type from the interface tags team and
vlan. This was overlooked previously when the files were adjusted to fit
the new recipe format.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
recipes/smoke/lib/conf-team.xml | 2 +-
recipes/smoke/lib/conf-vlan.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/recipes/smoke/lib/conf-team.xml b/recipes/smoke/lib/conf-team.xml
index cf5aac8..8493e09 100644
--- a/recipes/smoke/lib/conf-team.xml
+++ b/recipes/smoke/lib/conf-team.xml
@@ -1,7 +1,7 @@
<interfaces>
<eth id="if-1" network="net"/>
<eth id="if-2" network="net"/>
- <team id="testiface" type="team">
+ <team id="testiface">
<options>
<option name="teamd_config">
{
diff --git a/recipes/smoke/lib/conf-vlan.xml b/recipes/smoke/lib/conf-vlan.xml
index 92d5e23..542b167 100644
--- a/recipes/smoke/lib/conf-vlan.xml
+++ b/recipes/smoke/lib/conf-vlan.xml
@@ -1,6 +1,6 @@
<interfaces>
<eth id="if-1" network="net"/>
- <vlan id="testiface" type="vlan">
+ <vlan id="testiface">
<options>
<option name="vlan_tci" value="10"/>
</options>
--
1.8.1.4
10 years, 10 months
[PATCH 0/3] smoke test changes proposal
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
The following patch series is meant as a proposal to add a new feature and
change smoke test generation. Please read the ideas behind this first before
actually applying it.
The following patch series changes the way smoke tests are generated. I decided
to implement this change because the automatic generation of all combinations
doesn't take into account the different semantics of the resulting recipes.
Every recipe contains the same comman sequence, however for some combinations
the commands are expected to fail. This happens in recipes that have a vlan
interface on one side and a non-vlan interface on the other side. These were
previously reporting a FAIL which was expected, but seeing it in the results
can be confusing and not clear on first look.
The first patch therefore adds an attribute pass_result to the command tag,
this attribute represents the command result that is seen as a PASS state for
the command, the default value is true.
I'm not 100% sure about this change because the boolean value isn't really
descripte enough. The other approach is to have a way to tell the test modules
directly that they should expect a negative result. This could be a better
solution because it could still report an unexpected failure of the test while
providing a PASS result when the test was negative. This however wouldn't be
usable for exec commands, and it would require cooperation from test module
authors which could be unreliable.
The other two patches reimplement the recipe generation script in python. The
resulting recipes are now fully expanded (no source attributes) and can contain
additional varible references that can be dynamically defined in a sepparate
file. This is now used to set a different pass_result value based on the
configuration combination of the currently generated recipe.
Ondrej Lichtner (3):
add attribute "pass_result" to <command> tags
add generate-recipes.py
smoke lib: add variable icmp_result to cmd sequences
lnst/Controller/Machine.py | 3 +
lnst/Controller/RecipeParse.py | 7 ++
recipe-schema.rng | 27 +++++++
recipes/smoke/generate-recipes.py | 143 ++++++++++++++++++++++++++++++++++++++
recipes/smoke/lib/seq-bg.xml | 2 +-
recipes/smoke/lib/seq-ping.xml | 2 +-
recipes/smoke/lib/variables.conf | 14 ++++
7 files changed, 196 insertions(+), 2 deletions(-)
create mode 100755 recipes/smoke/generate-recipes.py
create mode 100644 recipes/smoke/lib/variables.conf
--
1.8.1.4
10 years, 10 months
Re: [lnst trac] #21: result summary improvement
by fedora-badges
#21: result summary improvement
--------------------------+----------------------
Reporter: olichtne | Owner: olichtne
Type: enhancement | Status: assigned
Priority: major | Milestone:
Component: lnst-ctl | Version:
Resolution: | Keywords:
Blocked By: | Blocking:
--------------------------+----------------------
Changes (by olichtne):
* owner: somebody => olichtne
* status: new => assigned
Comment:
I've done some work on this, the patches, with an example of how the new
format looks, are available here:
https://lists.fedorahosted.org/pipermail/lnst-
developers/2013-May/001236.html
The patches have already been applied. There are two more that fix
behaviour when a crash occurs.
For now we don't enforce any API, but we expect the result format to be
similar to what we use in our test modules. This might change in the
future as enforcing an API would enable us to make a more precise
implementation of the result reporting. I will therefore leave this ticket
open for now in case we decide to implement this change.
--
Ticket URL: <https://fedorahosted.org/lnst/ticket/21#comment:3>
lnst <https://fedorahosted.org/lnst/>
Linux Network Stack Test
10 years, 10 months
[PATCH 1/2] NetTestResultSerializer: fix recipe result on crash
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
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>
---
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")
--
1.8.1.4
10 years, 10 months