Boost logo

Boost-Commit :

From: daniel_at_[hidden]
Date: 2007-11-20 09:19:02


Author: danielw
Date: 2007-11-20 09:19:01 EST (Tue, 20 Nov 2007)
New Revision: 41255
URL: http://svn.boost.org/trac/boost/changeset/41255

Log:
Try to figure out the test source file.

Text files modified:
   branches/bitten/tools/regression/src/collect_and_upload_logs.py | 32 +++++++++++++++++++++++++++++---
   branches/bitten/tools/regression/src/regression.py | 3 ++-
   2 files changed, 31 insertions(+), 4 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-20 09:19:01 EST (Tue, 20 Nov 2007)
@@ -186,7 +186,31 @@
         if level and (not elem.tail or not elem.tail.strip()):
             elem.tail = i
 
-def create_bitten_reports(input_filename):
+def relpath(path, reldir):
+ """Returns 'path' relative to 'reldir'."""
+
+ # use normpath to ensure path separators are uniform
+ path = os.path.normpath(path)
+
+ # find length of reldir as prefix of path (or zero if it isn't)
+ prelen = len(os.path.commonprefix((
+ os.path.normcase(path),
+ # add a separator to get correct prefix length
+ # (normpath removes trailing separators)
+ os.path.normcase(os.path.normpath(reldir)) + os.sep
+ )))
+ return path[prelen:]
+
+def filename_from_test(root, test):
+ """Returns the source file for a test file, relative
+ to `root`."""
+
+ if test.endswith('.test'):
+ test = ''.join((test[:-4], 'cpp'))
+
+ return relpath(test, root)
+
+def create_bitten_reports(root, input_filename):
     results = test_results.TestResults(open(input_filename))
 
     report = ET.Element('report', category='test',
@@ -196,10 +220,12 @@
         if r[1] == 'skipped':
             continue
 
- fixture = os.path.split(r[0])[1]
         status = {'success': 'success', 'failed': 'failure'}.get(r[1])
+ filename = filename_from_test(root, r[0])
+ fixture = os.path.split(filename)[1]
+
         test = ET.SubElement(report, 'test', duration="0",
- fixture=fixture, name=r[0], file=r[0], status=status)
+ fixture=fixture, name=fixture, file=filename, status=status)
         if r[1] == 'failed':
             stdout = ET.SubElement(test, 'stdout')
             output = str(r[2][0][2])

Modified: branches/bitten/tools/regression/src/regression.py
==============================================================================
--- branches/bitten/tools/regression/src/regression.py (original)
+++ branches/bitten/tools/regression/src/regression.py 2007-11-20 09:19:01 EST (Tue, 20 Nov 2007)
@@ -419,7 +419,8 @@
             xml_root = os.path.join( self.regression_results, 'boost',
                                          'bin.v2' )
 
- report = create_bitten_reports(os.path.join(self.regression_results,
+ report = create_bitten_reports(self.boost_root,
+ os.path.join(self.regression_results,
                                                     'test_results.xml'))
 
         dir = os.path.split(self.bitten_report)[0]


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