]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa.buildperf: extend xml format to contain measurement data
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Fri, 28 Oct 2016 07:19:45 +0000 (10:19 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 23 Jan 2017 12:03:59 +0000 (12:03 +0000)
Make the xml report format slightly non-standard by incorporating
measurement data into it.

[YOCTO #10590]

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oeqa/buildperf/base.py

index de0ee40a23cab47dc2ee3faabd52f1dc1c15976a..efbe20c500a8463275f0e8bf524584c7559fb90c 100644 (file)
@@ -269,6 +269,7 @@ class BuildPerfTestResult(unittest.TextTestResult):
 
         test_cnt = 0
         for status, (test, reason) in self.all_results():
+            test_cnt += 1
             testcase = ET.SubElement(suite, 'testcase')
             testcase.set('classname', test.__module__ + '.' + test.__class__.__name__)
             testcase.set('name', test.name)
@@ -287,7 +288,27 @@ class BuildPerfTestResult(unittest.TextTestResult):
                 result.text = reason
             elif status not in ('SUCCESS', 'UNEXPECTED_SUCCESS'):
                 raise TypeError("BUG: invalid test status '%s'" % status)
-            test_cnt += 1
+
+            for data in test.measurements:
+                measurement = ET.SubElement(testcase, data['type'])
+                measurement.set('name', data['name'])
+                measurement.set('legend', data['legend'])
+                vals = data['values']
+                if data['type'] == BuildPerfTestCase.SYSRES:
+                    ET.SubElement(measurement, 'time',
+                                  timestamp=vals['start_time'].isoformat()).text = \
+                        str(vals['elapsed_time'].total_seconds())
+                    if 'buildstats_file' in vals:
+                        ET.SubElement(measurement, 'buildstats_file').text = vals['buildstats_file']
+                    attrib = dict((k, str(v)) for k, v in vals['iostat'].items())
+                    ET.SubElement(measurement, 'iostat', attrib=attrib)
+                    attrib = dict((k, str(v)) for k, v in vals['rusage'].items())
+                    ET.SubElement(measurement, 'rusage', attrib=attrib)
+                elif data['type'] == BuildPerfTestCase.DISKUSAGE:
+                    ET.SubElement(measurement, 'size').text = str(vals['size'])
+                else:
+                    raise TypeError('BUG: unsupported measurement type')
+
         suite.set('tests', str(test_cnt))
 
         # Use minidom for pretty-printing