⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 regression.py

📁 Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work
💻 PY
📖 第 1 页 / 共 3 页
字号:
#!/usr/bin/python# Copyright MetaCommunications, Inc. 2003-2007# Copyright Redshift Software, Inc. 2007## Distributed under the Boost Software License, Version 1.0.# (See accompanying file LICENSE_1_0.txt or copy at# http://www.boost.org/LICENSE_1_0.txt)import globimport optparseimport osimport os.pathimport platformimport sysimport time#~ Place holder for xsl_reports/util moduleutils = Nonerepo_root = {    'anon'          : 'http://svn.boost.org/svn/boost/',    'user'          : 'https://svn.boost.org/svn/boost/'    }repo_path = {    'trunk'         : 'trunk',    'release'       : 'branches/release',    'build'         : 'trunk/tools/build/v2',    'jam'           : 'tags/tools/jam/Boost_Jam_3_1_15/src',    'regression'    : 'trunk/tools/regression',    'boost-build.jam'                    : 'trunk/boost-build.jam'    }class runner:        def __init__(self,root):        commands = map(            lambda m: m[8:].replace('_','-'),            filter(                lambda m: m.startswith('command_'),                runner.__dict__.keys())            )        commands.sort()        commands = "commands: %s" % ', '.join(commands)                opt = optparse.OptionParser(            usage="%prog [options] [commands]",            description=commands)                    #~ Base Options:        opt.add_option( '--runner',            help="runner ID (e.g. 'Metacomm')" )        opt.add_option( '--comment',            help="an HTML comment file to be inserted in the reports" )        opt.add_option( '--tag',            help="the tag for the results" )        opt.add_option( '--toolsets',            help="comma-separated list of toolsets to test with" )        opt.add_option( '--incremental',            help="do incremental run (do not remove previous binaries)",            action='store_true' )        opt.add_option( '--timeout',            help="specifies the timeout, in minutes, for a single test run/compilation",            type='int' )        opt.add_option( '--bjam-options',            help="options to pass to the regression test" )        opt.add_option( '--bjam-toolset',            help="bootstrap toolset for 'bjam' executable" )        opt.add_option( '--pjl-toolset',            help="bootstrap toolset for 'process_jam_log' executable" )        opt.add_option( '--platform' )        #~ Source Options:        opt.add_option( '--user',            help="Boost SVN user ID" )        opt.add_option( '--local',            help="the name of the boost tarball" )        opt.add_option( '--force-update',            help="do an SVN update (if applicable) instead of a clean checkout, even when performing a full run",            action='store_true' )        opt.add_option( '--have-source',            help="do neither a tarball download nor an SVN update; used primarily for testing script changes",            action='store_true' )        #~ Connection Options:        opt.add_option( '--proxy',            help="HTTP proxy server address and port (e.g.'http://www.someproxy.com:3128')" )        opt.add_option( '--ftp-proxy',            help="FTP proxy server (e.g. 'ftpproxy')" )        opt.add_option( '--dart-server',            help="the dart server to send results to" )        #~ Debug Options:        opt.add_option( '--debug-level',            help="debugging level; controls the amount of debugging output printed",            type='int' )        opt.add_option( '--send-bjam-log',            help="send full bjam log of the regression run",            action='store_true' )        opt.add_option( '--mail',            help="email address to send run notification to" )        opt.add_option( '--smtp-login',            help="STMP server address/login information, in the following form: <user>:<password>@<host>[:<port>]" )        opt.add_option( '--skip-tests',            help="do not run bjam; used for testing script changes",            action='store_true' )                #~ Defaults        self.runner = None        self.comment='comment.html'        self.tag='trunk'        self.toolsets=None        self.incremental=False        self.timeout=5        self.bjam_options=''        self.bjam_toolset=''        self.pjl_toolset=''        self.platform=self.platform_name()        self.user='anonymous'        self.local=None        self.force_update=False        self.have_source=False        self.proxy=None        self.ftp_proxy=None        self.dart_server=None        self.debug_level=0        self.send_bjam_log=False        self.mail=None        self.smtp_login=None        self.skip_tests=False        ( _opt_, self.actions ) = opt.parse_args(None,self)        if not self.actions or self.actions == []:            self.actions = [ 'regression' ]                #~ Initialize option dependent values.        self.regression_root = root        self.boost_root = os.path.join( self.regression_root, 'boost' )        self.regression_results = os.path.join( self.regression_root, 'results' )        self.regression_log = os.path.join( self.regression_results, 'bjam.log' )        self.tools_bb_root = os.path.join( self.regression_root,'tools_bb' )        self.tools_bjam_root = os.path.join( self.regression_root,'tools_bjam' )        self.tools_regression_root = os.path.join( self.regression_root,'tools_regression' )        self.xsl_reports_dir = os.path.join( self.tools_regression_root, 'xsl_reports' )        self.timestamp_path = os.path.join( self.regression_root, 'timestamp' )        if sys.platform == 'win32':            self.patch_boost = 'patch_boost.bat'            self.bjam = { 'name' : 'bjam.exe' }            self.process_jam_log = { 'name' : 'process_jam_log.exe' }        else:            self.patch_boost = 'patch_boost'            self.bjam = { 'name' : 'bjam' }            self.process_jam_log = { 'name' : 'process_jam_log' }        self.bjam = {            'name' : self.bjam['name'],            'build_cmd' : self.bjam_build_cmd,            'path' : os.path.join(self.regression_root,self.bjam['name']),            'source_dir' : self.tools_bjam_root,            'build_dir' : self.tools_bjam_root,            'build_args' : ''            }        self.process_jam_log = {            'name' : self.process_jam_log['name'],            'build_cmd' : self.bjam_cmd,            'path' : os.path.join(self.regression_root,self.process_jam_log['name']),            'source_dir' : os.path.join(self.tools_regression_root,'build'),            'build_dir' : os.path.join(self.tools_regression_root,'build'),            'build_args' : 'process_jam_log -d2'            }                if self.debug_level > 0:            self.log('Regression root =     %s'%self.regression_root)            self.log('Boost root =          %s'%self.boost_root)            self.log('Regression results =  %s'%self.regression_results)            self.log('Regression log =      %s'%self.regression_log)            self.log('BB root =             %s'%self.tools_bb_root)            self.log('Bjam root =           %s'%self.tools_bjam_root)            self.log('Tools root =          %s'%self.tools_regression_root)            self.log('XSL reports dir =     %s'%self.xsl_reports_dir)            self.log('Timestamp =           %s'%self.timestamp_path)            self.log('Patch Boost script =  %s'%self.patch_boost)                self.main()        #~ The various commands that make up the testing sequence...        def command_cleanup(self,*args):        if not args or args == None or args == []: args = [ 'source', 'bin' ]        if 'source' in args:            self.log( 'Cleaning up "%s" directory ...' % self.boost_root )            self.rmtree( self.boost_root )        if 'bin' in args:            boost_bin_dir = os.path.join( self.boost_root, 'bin' )            self.log( 'Cleaning up "%s" directory ...' % boost_bin_dir )            self.rmtree( boost_bin_dir )            boost_binv2_dir = os.path.join( self.boost_root, 'bin.v2' )            self.log( 'Cleaning up "%s" directory ...' % boost_binv2_dir )            self.rmtree( boost_binv2_dir )            self.log( 'Cleaning up "%s" directory ...' % self.regression_results )            self.rmtree( self.regression_results )        def command_get_tools(self):        #~ Get Boost.Build v2...        self.log( 'Getting Boost.Build v2...' )        if self.user and self.user != '':            os.chdir( os.path.dirname(self.tools_bb_root) )            self.svn_command( 'co %s %s' % (                self.svn_repository_url(repo_path['build']),                os.path.basename(self.tools_bb_root) ) )        else:            self.retry( lambda: self.download_tarball(                os.path.basename(self.tools_bb_root)+".tar.bz2",                self.tarball_url(repo_path['build']) ) )            self.unpack_tarball(                self.tools_bb_root+".tar.bz2",                os.path.basename(self.tools_bb_root) )        #~ Get Boost.Jam...        self.log( 'Getting Boost.Jam...' )        if self.user and self.user != '':            os.chdir( os.path.dirname(self.tools_bjam_root) )            self.svn_command( 'co %s %s' % (                self.svn_repository_url(repo_path['jam']),                os.path.basename(self.tools_bjam_root) ) )        else:            self.retry( lambda: self.download_tarball(                os.path.basename(self.tools_bjam_root)+".tar.bz2",                self.tarball_url(repo_path['jam']) ) )            self.unpack_tarball(                self.tools_bjam_root+".tar.bz2",                os.path.basename(self.tools_bjam_root) )        #~ Get the regression tools and utilities...        self.log( 'Getting regression tools an utilities...' )        if self.user and self.user != '':            os.chdir( os.path.dirname(self.tools_regression_root) )            self.svn_command( 'co %s %s' % (                self.svn_repository_url(repo_path['regression']),                os.path.basename(self.tools_regression_root) ) )        else:            self.retry( lambda: self.download_tarball(                os.path.basename(self.tools_regression_root)+".tar.bz2",                self.tarball_url(repo_path['regression']) ) )            self.unpack_tarball(                self.tools_regression_root+".tar.bz2",                os.path.basename(self.tools_regression_root) )                #~ We get a boost-build.jam to make the tool build work even if there's        #~ and existing boost-build.jam above the testing root.        self.log( 'Getting boost-build.jam...' )        self.http_get(            self.svn_repository_url(repo_path['boost-build.jam']),            os.path.join( self.regression_root, 'boost-build.jam' ) )        def command_get_source(self):        self.refresh_timestamp()        self.log( 'Getting sources (%s)...' % self.timestamp() )        if self.user and self.user != '':            self.retry( self.svn_checkout )        else:            self.retry( self.get_tarball )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -