|
Boost-Commit : |
From: daniel_at_[hidden]
Date: 2007-11-19 11:41:49
Author: danielw
Date: 2007-11-19 11:41:49 EST (Mon, 19 Nov 2007)
New Revision: 41233
URL: http://svn.boost.org/trac/boost/changeset/41233
Log:
Generate bitten reports from BB XML output.
Text files modified:
branches/bitten/tools/regression/src/collect_and_upload_logs.py | 52 +++++++++++++++++++++++++++++++++++++++
1 files changed, 51 insertions(+), 1 deletions(-)
Modified: branches/bitten/tools/regression/src/collect_and_upload_logs.py
==============================================================================
--- branches/bitten/tools/regression/src/collect_and_upload_logs.py (original)
+++ branches/bitten/tools/regression/src/collect_and_upload_logs.py 2007-11-19 11:41:49 EST (Mon, 19 Nov 2007)
@@ -18,6 +18,12 @@
import string
import sys
+import test_results
+
+try:
+ import xml.etree.cElementTree as ET
+except ImportError:
+ import elementtree.cElementTree as ET
def process_xml_file( input_file, output_file ):
utils.log( 'Processing test log "%s"' % input_file )
@@ -166,7 +172,51 @@
os.path.walk( input_dir, _collect_bitten_report_files_, None )
return report
-
+
+def indent(elem, level=0):
+ i = "\n" + level*" "
+ if len(elem):
+ if not elem.text or not elem.text.strip():
+ elem.text = i + " "
+ for elem in elem:
+ indent(elem, level+1)
+ if not elem.tail or not elem.tail.strip():
+ elem.tail = i
+ else:
+ if level and (not elem.tail or not elem.tail.strip()):
+ elem.tail = i
+
+def create_bitten_reports(input_filename):
+ results = test_results.TestResults(open(input_filename))
+
+ report = ET.Element('report', category='test',
+ generator="http://svn.boost.org/svn/boost/trunk/tools/"
+ "regression/src/collect_and_upload_logs.py")
+ for r in results:
+ if r[1] == 'skipped':
+ continue
+ test = ET.SubElement(report, 'test', duration="0",
+ fixture=r[0], name=r[0], file=r[0], status=r[1])
+ if r[1] == 'failed':
+ stdout = ET.SubElement(test, 'stdout')
+ output = str(r[2][0][2])
+ stdout.text = output
+ indent(report)
+
+ platform_report = ET.Element('report', category='platform')
+ platform = ET.SubElement(platform_report, 'platform')
+
+ platform.set('os', results.os[0])
+ platform.set('platform', results.os[1])
+ if results.os[2]:
+ platform.set('os-extra', results.os[2])
+ platform.set('jam-version', results.jam_version)
+ platform.set('command', results.command)
+ platform.set('timestamp', results.timestamp)
+
+ indent(platform_report)
+ return ET.tostring(report, 'utf-8')
+
def publish_test_logs(
input_dirs,
runner_id, tag, platform, comment_file, timestamp, user, source, run_type,
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk