Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49731 - trunk/tools/build/v2/test
From: ghost_at_[hidden]
Date: 2008-11-13 16:30:05


Author: vladimir_prus
Date: 2008-11-13 16:30:05 EST (Thu, 13 Nov 2008)
New Revision: 49731
URL: http://svn.boost.org/trac/boost/changeset/49731

Log:
XML output support
Text files modified:
   trunk/tools/build/v2/test/test_all.py | 47 +++++++++++++++++++++++++++++----------
   1 files changed, 35 insertions(+), 12 deletions(-)

Modified: trunk/tools/build/v2/test/test_all.py
==============================================================================
--- trunk/tools/build/v2/test/test_all.py (original)
+++ trunk/tools/build/v2/test/test_all.py 2008-11-13 16:30:05 EST (Thu, 13 Nov 2008)
@@ -11,7 +11,10 @@
 import string
 import BoostBuild
 
-
+xml = "--xml" in sys.argv
+toolset = BoostBuild.get_toolset()
+
+
 # Clear environment for testing.
 #
 for s in ('BOOST_ROOT', 'BOOST_BUILD_PATH', 'JAM_TOOLSET', 'BCCROOT', 'MSVCDir',
@@ -39,12 +42,15 @@
 
     pass_count = 0
     failures_count = 0
+
     for i in all_tests:
- print ("%-25s : " %(i)),
+ passed = 1
+ if not xml:
+ print ("%-25s : " %(i)),
         try:
             __import__(i)
         except SystemExit:
- print "FAILED"
+ passed = 0;
             if failures_count == 0:
                 f = open(os.path.join(invocation_dir, 'test_results.txt'), 'w')
                 f.write(i)
@@ -52,10 +58,26 @@
             failures_count = failures_count + 1
             # Restore the current directory, which might be changed by the test.
             os.chdir(invocation_dir)
- BoostBuild.flush_annotations();
+ if not xml:
+ BoostBuild.flush_annotations();
             continue
- print "PASSED"
- BoostBuild.flush_annotations();
+ if not xml:
+ if passed:
+ print "PASSED"
+ else:
+ print "FAILED"
+ BoostBuild.flush_annotations();
+ else:
+ rs = "succeed"
+ if not passed:
+ rs = "fail"
+ print """
+<test-log library="build" test-name="%s" test-type="run" toolset="%s">
+<run result="%s"/>
+</test-log>
+""" % (i, toolset, rs)
+
+
         pass_count = pass_count + 1
         sys.stdout.flush() # Makes testing under emacs more entertaining.
 
@@ -63,11 +85,12 @@
     if failures_count == 0:
         open('test_results.txt', 'w')
 
- print """
- === Test summary ===
- PASS: %d
- FAIL: %d
- """ % (pass_count, failures_count)
+ if not xml:
+ print """
+ === Test summary ===
+ PASS: %d
+ FAIL: %d
+ """ % (pass_count, failures_count)
 
 
 def last_failed_test():
@@ -202,7 +225,7 @@
     # Requires gettext tools.
     tests.append("example_gettext")
 
-else:
+elif not xml:
     print 'Note: skipping extra tests'
 
 run_tests(critical_tests, tests)


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