[PATCH] TaskAPI: Fix crash on missing test tool
by Jan Tluka
The patch fixes the crash in case of missing test tool on slave machine.
Without the patch the controller crashes with an exception because 'cmd'
is undefined.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Controller/Task.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py
index ad7fb68..e23ad9d 100644
--- a/lnst/Controller/Task.py
+++ b/lnst/Controller/Task.py
@@ -252,7 +252,7 @@ class HostAPI(object):
else:
msg = "Module '%s' not found on the controller"\
% mod
- raise TaskError(msg, cmd)
+ raise TaskError(msg)
for tool in tools:
if tool in res_table['tools']:
@@ -260,7 +260,7 @@ class HostAPI(object):
else:
msg = "Tool '%s' not found on the controller"\
% tool
- raise TaskError(msg, cmd)
+ raise TaskError(msg)
self._m.sync_resources(sync_table)
--
1.8.1.4
9 years, 9 months
[lnst] 4 release
by Jiří Pírko
commit cca5ad80a0dc9f445b747141531331a316d3fd13
Author: Jiri Pirko <jiri(a)resnulli.us>
Date: Thu Jul 3 10:51:29 2014 +0200
4 release
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
setup.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/setup.py b/setup.py
index 71905c1..2835844 100755
--- a/setup.py
+++ b/setup.py
@@ -163,12 +163,12 @@ DATA_FILES = CONFIG + TEST_MODULES + MULTICAST_TEST_TOOLS + MAN_PAGES + \
SCHEMAS + BASH_COMP
setup(name="lnst",
- version="3",
+ version="4",
description="Linux Network Stack Test",
author="LNST Team",
author_email="lnst-developers(a)lists.fedorahosted.org",
- maintainer="Radek Pazdera",
- maintainer_email="rpazdera(a)redhat.com",
+ maintainer="Jiri Pirko",
+ maintainer_email="jiri(a)resnulli.us",
url="http://lnst-project.org",
long_description=LONG_DESC,
platforms=["linux"],
9 years, 9 months
[lnst] Created tag v4
by Jiří Pírko
The lightweight tag 'v4' was created pointing to:
cca5ad8... 4 release
9 years, 9 months
[lnst] NetTestResultSerializer: remove xslt reference in xml
by Jiří Pírko
commit 71c7ae2c47288d8d08e80e98f590ab92f1dcf4df
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Tue Jul 1 11:54:03 2014 +0200
NetTestResultSerializer: remove xslt reference in xml
This patch removes the xslt reference that was added to generated xml
files. The original plan was to use this so that the browser can
automatically transform the xml file to a html file. We later discovered
that this is not possible in modern browsers due to security issues of
referencing documents from foreign domains. The reference is therefore
useless and removed.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/NetTestResultSerializer.py | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
---
diff --git a/lnst/Controller/NetTestResultSerializer.py b/lnst/Controller/NetTestResultSerializer.py
index ccfb0c9..b36894e 100644
--- a/lnst/Controller/NetTestResultSerializer.py
+++ b/lnst/Controller/NetTestResultSerializer.py
@@ -165,11 +165,7 @@ class NetTestResultSerializer:
impl = getDOMImplementation()
doc = impl.createDocument(None, "results", None)
- xslt_url = lnst_config.get_option("environment", "xslt_url")
- proc_inst = doc.createProcessingInstruction('xml-stylesheet',
- 'type="text/xsl" href="'+xslt_url+'"')
top_el = doc.documentElement
- doc.insertBefore(proc_inst, top_el)
for recipe in self._results:
recipe_el = doc.createElement("recipe")
9 years, 9 months
[lnst] lnst-ctl: add option -t,--html
by Jiří Pírko
commit 30ed1e148abebfa6565c947e42b43cb4fa9a09ec
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Tue Jul 1 11:54:02 2014 +0200
lnst-ctl: add option -t,--html
This option takes a filename argument. If specified LNST will generate
an html file that contains formatted result data.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst-ctl | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/lnst-ctl b/lnst-ctl
index ad7ecf7..008d4ea 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -48,6 +48,7 @@ def usage(retval=0):
print " -p, --packet-capture capture and log all ongoing " \
"network communication during the test"
print " -x, --result=FILE file to write xml_result"
+ print " -t, --html=FILE generate a formatted result html"
print " -s, --xslt-url=URL URL to a XSLT document that the "\
"result xml will reference, only usefull when -x is used as well"
print " -r, --reduce-sync reduces resource synchronization "\
@@ -125,10 +126,11 @@ def main():
try:
opts, args = getopt.getopt(
sys.argv[1:],
- "dhrc:x:s:poma:A:",
+ "dhrc:x:t:s:poma:A:",
["debug", "help", "config", "result=",
"packet-capture", "disable-pool-checks", "no-colours",
- "define_alias", "override_alias", "reduce-sync", "xslt-url"]
+ "define_alias", "override_alias", "reduce-sync", "xslt-url",
+ "html"]
)
except getopt.GetoptError as err:
print str(err)
@@ -156,6 +158,7 @@ def main():
debug = 0
recipe_path = None
result_path = None
+ html_result_path = None
xslt_url = None
config_path = None
packet_capture = False
@@ -173,6 +176,8 @@ def main():
config_path = arg
elif opt in ("-x", "--result"):
result_path = arg
+ elif opt in ("-t", "--html"):
+ html_result_path = arg
elif opt in ("-p", "--packet-capture"):
packet_capture = True
elif opt in ("-o", "--disable-pool-checks"):
@@ -267,6 +272,11 @@ def main():
handle = open(result_path, "w")
handle.write(res_serializer.get_result_xml())
handle.close()
+ if html_result_path:
+ html_result_path = os.path.expanduser(html_result_path)
+ handle = open(html_result_path, "w")
+ handle.write(res_serializer.get_result_html())
+ handle.close()
return retval
9 years, 9 months
[lnst] NetTestResultSerializer: add method get_result_html
by Jiří Pírko
commit 93050a648b381f010b8ea71e639925f8d1d02642
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Tue Jul 1 11:54:01 2014 +0200
NetTestResultSerializer: add method get_result_html
The new method creates the xml result file that we have been using until
now, reads a specified XSL file (based on the appropriate config option)
and performs a XSLT transformation to create an html file.
The method get_result_xml was renamed to _generate_xml because it is
used by both the old get_result_xml and the new get_result_html methods.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/NetTestResultSerializer.py | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/lnst/Controller/NetTestResultSerializer.py b/lnst/Controller/NetTestResultSerializer.py
index 3689835..ccfb0c9 100644
--- a/lnst/Controller/NetTestResultSerializer.py
+++ b/lnst/Controller/NetTestResultSerializer.py
@@ -16,6 +16,8 @@ from xml.dom.minidom import getDOMImplementation
from lnst.Common.NetTestCommand import str_command
from lnst.Common.Colours import decorate_string, decorate_with_preset
from lnst.Common.Config import lnst_config
+from lxml import etree
+from lxml import html as lxml_h
def serialize_obj(obj, dom, el, upper_name="unnamed"):
if isinstance(obj, dict):
@@ -159,7 +161,7 @@ class NetTestResultSerializer:
logging.info(" %s " % output)
logging.info("="*(full_length))
- def get_result_xml(self):
+ def _generate_xml(self):
impl = getDOMImplementation()
doc = impl.createDocument(None, "results", None)
@@ -215,4 +217,21 @@ class NetTestResultSerializer:
res_data_el = doc.createElement("result_data")
serialize_obj(cmd_res["res_data"], doc, res_data_el)
command_el.appendChild(res_data_el)
+ return doc
+
+ def get_result_xml(self):
+ doc = self._generate_xml()
return doc.toprettyxml()
+
+ def get_result_html(self):
+ xml = self._generate_xml().toprettyxml()
+ etree_xml = etree.fromstring(xml)
+
+ xslt_url = lnst_config.get_option("environment", "xslt_url")
+ xslt = etree.parse(xslt_url)
+ transform = etree.XSLT(xslt)
+
+ transformed_xml = transform(etree_xml)
+ html = lxml_h.fromstring(etree.tostring(transformed_xml))
+ return lxml_h.tostring(html, pretty_print=True,
+ doctype="<!DOCTYPE html>")
9 years, 9 months
[lnst] xml_to_html.xsl: fix validation issues
by Jiří Pírko
commit 0b2400ef606897cc701fd20e53ac5d6c0d9e194d
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Tue Jul 1 11:54:00 2014 +0200
xml_to_html.xsl: fix validation issues
This patch moves the <link> and <script> elements under the <head>
element and adds a <title> element and a <meta> element specifying the
encoding of the resulting html file.
I also added a forgotten <tr> element.
These changes make the resulting html file a valid HTML5 document.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
result_xslt/xml_to_html.xsl | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/result_xslt/xml_to_html.xsl b/result_xslt/xml_to_html.xsl
index 31fe0d9..9a494ce 100644
--- a/result_xslt/xml_to_html.xsl
+++ b/result_xslt/xml_to_html.xsl
@@ -3,9 +3,13 @@
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html>
- <body>
+ <head>
+ <title>LNST results</title>
+ <meta charset="utf-8"/>
<link rel="stylesheet" type="text/css" href="http://www.lnst-project.org/files/result_xslt/xml_to_html.css"/>
- <script type="text/javascript" src="http://www.lnst-project.org/files/result_xslt/xml_to_html.js"/>
+ <script type="text/javascript" src="http://www.lnst-project.org/files/result_xslt/xml_to_html.js"></script>
+ </head>
+ <body>
<h2>LNST results</h2>
<xsl:apply-templates select="results/recipe"/>
</body>
@@ -275,7 +279,7 @@
<xsl:template match="result_data">
<table class="result_data">
- <th>Result Data:</th>
+ <tr><th>Result Data:</th></tr>
<xsl:for-each select="*">
<xsl:call-template name="res_data_dict_item"/>
</xsl:for-each>
9 years, 9 months
[PATCH 1/4] xml_to_html.xsl: fix validation issues
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
This patch moves the <link> and <script> elements under the <head>
element and adds a <title> element and a <meta> element specifying the
encoding of the resulting html file.
I also added a forgotten <tr> element.
These changes make the resulting html file a valid HTML5 document.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
result_xslt/xml_to_html.xsl | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/result_xslt/xml_to_html.xsl b/result_xslt/xml_to_html.xsl
index 31fe0d9..9a494ce 100644
--- a/result_xslt/xml_to_html.xsl
+++ b/result_xslt/xml_to_html.xsl
@@ -3,9 +3,13 @@
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html>
- <body>
+ <head>
+ <title>LNST results</title>
+ <meta charset="utf-8"/>
<link rel="stylesheet" type="text/css" href="http://www.lnst-project.org/files/result_xslt/xml_to_html.css"/>
- <script type="text/javascript" src="http://www.lnst-project.org/files/result_xslt/xml_to_html.js"/>
+ <script type="text/javascript" src="http://www.lnst-project.org/files/result_xslt/xml_to_html.js"></script>
+ </head>
+ <body>
<h2>LNST results</h2>
<xsl:apply-templates select="results/recipe"/>
</body>
@@ -275,7 +279,7 @@
<xsl:template match="result_data">
<table class="result_data">
- <th>Result Data:</th>
+ <tr><th>Result Data:</th></tr>
<xsl:for-each select="*">
<xsl:call-template name="res_data_dict_item"/>
</xsl:for-each>
--
1.9.3
9 years, 9 months