Merge pull request #12535 from terfendail:testparser_update

pull/12512/head
Alexander Alekhin 6 years ago
commit 29c10b6792
  1. 36
      modules/ts/misc/testlog_parser.py

@ -33,6 +33,11 @@ class TestInfo(object):
self.status = "disabled"
self.fixture = self.fixture.replace("DISABLED_", "")
self.name = self.name.replace("DISABLED_", "")
self.properties = {
prop.getAttribute("name") : prop.getAttribute("value")
for prop in xmlnode.getElementsByTagName("property")
if prop.hasAttribute("name") and prop.hasAttribute("value")
}
self.metrix = {}
self.parseLongMetric(xmlnode, "bytesIn");
self.parseLongMetric(xmlnode, "bytesOut");
@ -48,33 +53,34 @@ class TestInfo(object):
self.parseFloatMetric(xmlnode, "time");
def parseLongMetric(self, xmlnode, name, default = 0):
if xmlnode.hasAttribute(name):
tmp = xmlnode.getAttribute(name)
val = long(tmp)
self.metrix[name] = val
if name in self.properties:
self.metrix[name] = long(self.properties[name])
elif xmlnode.hasAttribute(name):
self.metrix[name] = long(xmlnode.getAttribute(name))
else:
self.metrix[name] = default
def parseIntMetric(self, xmlnode, name, default = 0):
if xmlnode.hasAttribute(name):
tmp = xmlnode.getAttribute(name)
val = int(tmp)
self.metrix[name] = val
if name in self.properties:
self.metrix[name] = int(self.properties[name])
elif xmlnode.hasAttribute(name):
self.metrix[name] = int(xmlnode.getAttribute(name))
else:
self.metrix[name] = default
def parseFloatMetric(self, xmlnode, name, default = 0):
if xmlnode.hasAttribute(name):
tmp = xmlnode.getAttribute(name)
val = float(tmp)
self.metrix[name] = val
if name in self.properties:
self.metrix[name] = float(self.properties[name])
elif xmlnode.hasAttribute(name):
self.metrix[name] = float(xmlnode.getAttribute(name))
else:
self.metrix[name] = default
def parseStringMetric(self, xmlnode, name, default = None):
if xmlnode.hasAttribute(name):
tmp = xmlnode.getAttribute(name)
self.metrix[name] = tmp.strip()
if name in self.properties:
self.metrix[name] = self.properties[name].strip()
elif xmlnode.hasAttribute(name):
self.metrix[name] = xmlnode.getAttribute(name).strip()
else:
self.metrix[name] = default

Loading…
Cancel
Save