ソースを参照

regression.py / --send-bjam-log option

[SVN r36746]
Aleksey Gurtovoy 19 年 前
コミット
bdc6683253

+ 39 - 24
tools/regression/xsl_reports/runner/collect_and_upload_logs.py

@@ -1,5 +1,5 @@
 
-# Copyright (c) MetaCommunications, Inc. 2003-2004
+# Copyright (c) MetaCommunications, Inc. 2003-2007
 #
 # Distributed under the Boost Software License, Version 1.0. 
 # (See accompanying file LICENSE_1_0.txt or copy at 
@@ -87,6 +87,31 @@ def copy_comments( results_xml, comment_file ):
     results_xml.endElement( 'comment' )
 
 
+def compress_file( file_path, archive_path ):
+    utils.log( 'Compressing "%s"...' % file_path )
+
+    try:
+        z = zipfile.ZipFile( archive_path, 'w', zipfile.ZIP_DEFLATED )
+        z.write( file_path, os.path.basename( file_path ) )
+        z.close()
+        utils.log( 'Done writing "%s".'% archive_path )
+    except Exception, msg:
+        utils.log( 'Warning: Compressing falied (%s)' % msg )
+        utils.log( '         Trying to compress using a platform-specific tool...' )
+        try: import zip_cmd
+        except ImportError:
+            script_dir = os.path.dirname( os.path.abspath( sys.argv[0] ) )
+            utils.log( 'Could not find \'zip_cmd\' module in the script directory (%s).' % script_dir )
+            raise Exception( 'Compressing failed!' )
+        else:
+            if os.path.exists( archive_path ):
+                os.unlink( archive_path )
+                utils.log( 'Removing stale "%s".' % archive_path )
+                
+            zip_cmd.main( file_path, archive_path )
+            utils.log( 'Done compressing "%s".' % archive_path )
+
+
 def collect_logs( 
           results_dir
         , runner_id
@@ -133,29 +158,10 @@ def collect_logs(
     results_writer.close()
     utils.log( 'Done writing "%s".' % results_file )
 
-    utils.log( 'Compressing "%s"...' % results_file )
-    archive_path = os.path.join( results_dir,'%s.zip' % runner_id )
-
-    try:
-        z = zipfile.ZipFile( archive_path, 'w', zipfile.ZIP_DEFLATED )
-        z.write( results_file, os.path.basename( results_file ) )
-        z.close()
-        utils.log( 'Done writing "%s".'% archive_path )
-    except Exception, msg:
-        utils.log( 'Warning: Compressing falied (%s)' % msg )
-        utils.log( '         Trying to compress using a platform-specific tool...' )
-        try: import zip_cmd
-        except ImportError:
-            script_dir = os.path.dirname( os.path.abspath( sys.argv[0] ) )
-            utils.log( 'Could not find \'zip_cmd\' module in the script directory (%s).' % script_dir )
-            raise Exception( 'Compressing failed!' )
-        else:
-            if os.path.exists( archive_path ):
-                os.unlink( archive_path )
-                utils.log( 'Removing stale "%s".' % archive_path )
-                
-            zip_cmd.main( results_file, archive_path )
-            utils.log( 'Done compressing "%s".' % archive_path )
+    compress_file(
+          results_file
+        , os.path.join( results_dir,'%s.zip' % runner_id )
+        )
 
 
 def upload_logs(
@@ -165,11 +171,16 @@ def upload_logs(
         , user
         , ftp_proxy
         , debug_level
+        , send_bjam_log
         , **unused
         ):
 
     logs_archive = os.path.join( results_dir, '%s.zip' % runner_id )
     upload_to_ftp( tag, logs_archive, ftp_proxy, debug_level )
+    if send_bjam_log:
+        logs_archive = os.path.join( results_dir, '%s.log.zip' % runner_id )
+        compress_file( os.path.join( results_dir, 'bjam.log' ), logs_archive )
+        upload_to_ftp( tag, logs_archive, ftp_proxy, debug_level )
 
 
 def collect_and_upload_logs( 
@@ -215,6 +226,7 @@ def accept_args( args ):
         , 'user='
         , 'ftp-proxy='
         , 'debug-level='
+        , 'send-bjam-log'
         , 'help'
         ]
     
@@ -244,6 +256,7 @@ def accept_args( args ):
         , 'run_type'        : options[ '--run-type' ]
         , 'ftp_proxy'       : options[ '--ftp-proxy' ]
         , 'debug_level'     : int(options[ '--debug-level' ])
+        , 'send_bjam_log'   : options.has_key( '--send-bjam-log' )
         }
 
 
@@ -271,6 +284,8 @@ Options:
 \t--source        where Boost sources came from (e.g. "CVS", "tarball",
 \t                "anonymous CVS"; "CVS" by default)
 \t--run-type      "incremental" or "full" ("full" by default)
+\t--send-bjam-log in addition to regular XML results, send in full bjam
+\t                log of the regression run
 \t--ftp-proxy     FTP proxy server (e.g. 'ftpproxy', optional)
 \t--debug-level   debugging level; controls the amount of debugging 
 \t                output printed; 0 by default (no debug output)

+ 9 - 3
tools/regression/xsl_reports/runner/regression.py

@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-# Copyright (c) MetaCommunications, Inc. 2003-2006
+# Copyright (c) MetaCommunications, Inc. 2003-2007
 #
 # Distributed under the Boost Software License, Version 1.0.
 # (See accompanying file LICENSE_1_0.txt or copy at
@@ -657,13 +657,14 @@ def upload_logs(
         , user
         , ftp_proxy
         , debug_level
+        , send_bjam_log
         , **unused
         ):
     import_utils()
     from runner import upload_logs
     retry(
           upload_logs
-        , ( regression_results, runner, tag, user, ftp_proxy, debug_level )
+        , ( regression_results, runner, tag, user, ftp_proxy, debug_level, send_bjam_log )
         )
 
 
@@ -719,6 +720,7 @@ def regression(
         , bjam_toolset
         , pjl_toolset
         , incremental
+        , send_bjam_log
         , force_update
         , monitored
         , timeout
@@ -763,7 +765,7 @@ def regression(
                v2, [] )
         test( toolsets, bjam_options, monitored, timeout, v2, [] )
         collect_logs( tag, runner, platform, user, comment, incremental, [] )
-        upload_logs( tag, runner, user, ftp_proxy, debug_level )
+        upload_logs( tag, runner, user, ftp_proxy, debug_level, send_bjam_log )
         update_itself( tag )
 
         if mail:
@@ -820,6 +822,7 @@ def accept_args( args ):
         , 'debug-level='
         , 'incremental'
         , 'force-update'
+        , 'send-bjam-log'
         , 'monitored'
         , 'help'
         , 'v2'
@@ -863,6 +866,7 @@ def accept_args( args ):
         , 'bjam_toolset'    : options[ '--bjam-toolset' ]
         , 'pjl_toolset'     : options[ '--pjl-toolset' ]
         , 'incremental'     : options.has_key( '--incremental' )
+        , 'send_bjam_log'   : options.has_key( '--send-bjam-log' )
         , 'force_update'    : options.has_key( '--force-update' )
         , 'monitored'       : options.has_key( '--monitored' )
         , 'timeout'         : options[ '--timeout' ]
@@ -903,6 +907,8 @@ Options:
 \t--comment       an HTML comment file to be inserted in the reports
 \t                ('comment.html' by default)
 \t--incremental   do incremental run (do not remove previous binaries)
+\t--send-bjam-log in addition to regular XML results, send in full bjam
+\t                log of the regression run
 \t--force-update  do a CVS update (if applicable) instead of a clean
 \t                checkout, even when performing a full run
 \t--monitored     do a monitored run

粤ICP备19079148号