def update(self): utils.log('Merging "%s" with expected results...' % shorten(self.source_)) utils.libxslt( utils.log, self.source_, xsl_path('add_expected_results.xsl'), os.path.join(self.file_path_), { "expected_results_file": self.expected_results_file_, "failures_markup_file": self.failures_markup_file_ })
def update( self ): utils.log( 'Merging "%s" with expected results...' % shorten( self.source_ ) ) utils.libxslt( utils.log , self.source_ , xsl_path( 'add_expected_results.xsl' ) , os.path.join( self.file_path_ ) , { "expected_results_file" : self.expected_results_file_ , "failures_markup_file": self.failures_markup_file_ } )
def update( self ): utils.makedirs( os.path.join( os.path.dirname( self.links_file_path_ ), "output" ) ) utils.makedirs( os.path.join( os.path.dirname( self.links_file_path_ ), "developer", "output" ) ) utils.makedirs( os.path.join( os.path.dirname( self.links_file_path_ ), "user", "output" ) ) utils.log( ' Making test output files...' ) utils.libxslt( utils.log , self.source_ , xsl_path( 'links_page.xsl' ) , self.links_file_path_ , { 'source': self.tag_ , 'run_date': self.run_date_ , 'comment_file': self.comment_file_ , 'explicit_markup_file': self.failures_markup_file_ } ) open( self.file_path_, "w" ).close()
def update( self ): utils.makedirs( os.path.join( os.path.dirname( self.links_file_path_ ), "output" ) ) utils.makedirs( os.path.join( os.path.dirname( self.links_file_path_ ), "developer", "output" ) ) utils.makedirs( os.path.join( os.path.dirname( self.links_file_path_ ), "user", "output" ) ) utils.log( ' Making test output files...' ) try: utils.libxslt( utils.log , self.source_ , xsl_path( 'links_page.xsl' ) , self.links_file_path_ , { 'source': self.tag_ , 'run_date': self.run_date_ , 'comment_file': self.comment_file_ , 'explicit_markup_file': self.failures_markup_file_ } ) except Exception, msg: utils.log( ' Skipping "%s" due to errors (%s)' % ( self.source_, msg ) )
def update(self): utils.makedirs( os.path.join(os.path.dirname(self.links_file_path_), "output")) utils.makedirs( os.path.join(os.path.dirname(self.links_file_path_), "developer", "output")) utils.makedirs( os.path.join(os.path.dirname(self.links_file_path_), "user", "output")) utils.log(' Making test output files...') utils.libxslt( utils.log, self.source_, xsl_path('links_page.xsl'), self.links_file_path_, { 'source': self.tag_, 'run_date': self.run_date_, 'comment_file': self.comment_file_, 'explicit_markup_file': self.failures_markup_file_ }) open(self.file_path_, "w").close()
def make_result_pages( extended_test_results , expected_results_file , failures_markup_file , tag , run_date , comment_file , output_dir , reports , warnings ): utils.log( 'Producing the reports...' ) __log__ = 1 warnings_text = '+'.join( warnings ) if comment_file != '': comment_file = os.path.abspath( comment_file ) links = os.path.join( output_dir, 'links.html' ) utils.makedirs( os.path.join( output_dir, 'output' ) ) for mode in ( 'developer', 'user' ): utils.makedirs( os.path.join( output_dir, mode , 'output' ) ) issues = os.path.join( output_dir, 'developer', 'issues.html' ) if 'i' in reports: utils.log( ' Making issues list...' ) utils.libxslt( utils.log , extended_test_results , xsl_path( 'issues_page.xsl' ) , issues , { 'source': tag , 'run_date': run_date , 'warnings': warnings_text , 'comment_file': comment_file , 'expected_results_file': expected_results_file , 'explicit_markup_file': failures_markup_file , 'release': "yes" } ) for mode in ( 'developer', 'user' ): if mode[0] + 'd' in reports: utils.log( ' Making detailed %s report...' % mode ) utils.libxslt( utils.log , extended_test_results , xsl_path( 'result_page.xsl' ) , os.path.join( output_dir, mode, 'index.html' ) , { 'links_file': 'links.html' , 'mode': mode , 'source': tag , 'run_date': run_date , 'warnings': warnings_text , 'comment_file': comment_file , 'expected_results_file': expected_results_file , 'explicit_markup_file' : failures_markup_file } ) for mode in ( 'developer', 'user' ): if mode[0] + 's' in reports: utils.log( ' Making summary %s report...' % mode ) utils.libxslt( utils.log , extended_test_results , xsl_path( 'summary_page.xsl' ) , os.path.join( output_dir, mode, 'summary.html' ) , { 'mode' : mode , 'source': tag , 'run_date': run_date , 'warnings': warnings_text , 'comment_file': comment_file , 'explicit_markup_file' : failures_markup_file } ) for mode in ( 'developer', 'user' ): if mode[0] + 'dr' in reports: utils.log( ' Making detailed %s release report...' % mode ) utils.libxslt( utils.log , extended_test_results , xsl_path( 'result_page.xsl' ) , os.path.join( output_dir, mode, 'index_release.html' ) , { 'links_file': 'links.html' , 'mode': mode , 'source': tag , 'run_date': run_date , 'warnings': warnings_text , 'comment_file': comment_file , 'expected_results_file': expected_results_file , 'explicit_markup_file' : failures_markup_file , 'release': "yes" } ) for mode in ( 'developer', 'user' ): if mode[0] + 'sr' in reports: utils.log( ' Making summary %s release report...' % mode ) utils.libxslt( utils.log , extended_test_results , xsl_path( 'summary_page.xsl' ) , os.path.join( output_dir, mode, 'summary_release.html' ) , { 'mode' : mode , 'source': tag , 'run_date': run_date , 'warnings': warnings_text , 'comment_file': comment_file , 'explicit_markup_file' : failures_markup_file , 'release': 'yes' } ) if 'e' in reports: utils.log( ' Generating expected_results ...' ) utils.libxslt( utils.log , extended_test_results , xsl_path( 'produce_expected_results.xsl' ) , os.path.join( output_dir, 'expected_results.xml' ) ) if 'n' in reports: utils.log( ' Making runner comment files...' ) utils.libxslt( utils.log , extended_test_results , xsl_path( 'runners.xsl' ) , os.path.join( output_dir, 'runners.html' ) ) shutil.copyfile( xsl_path( 'html/master.css' ) , os.path.join( output_dir, 'master.css' ) ) fix_file_names( output_dir )
def update( self ): def filter_xml( src, dest ): class xmlgen( xml.sax.saxutils.XMLGenerator ): def __init__( self, writer ): xml.sax.saxutils.XMLGenerator.__init__( self, writer ) self.trimmed = 0 self.character_content = "" def startElement( self, name, attrs): self.flush() xml.sax.saxutils.XMLGenerator.startElement( self, name, attrs ) def endElement( self, name ): self.flush() xml.sax.saxutils.XMLGenerator.endElement( self, name ) def flush( self ): content = self.character_content self.character_content = "" self.trimmed = 0 xml.sax.saxutils.XMLGenerator.characters( self, content ) def characters( self, content ): if not self.trimmed: max_size = pow( 2, 16 ) self.character_content += content if len( self.character_content ) > max_size: self.character_content = self.character_content[ : max_size ] + "...\n\n[The content has been trimmed by the report system because it exceeds %d bytes]" % max_size self.trimmed = 1 o = open( dest, "w" ) try: gen = xmlgen( o ) xml.sax.parse( src, gen ) finally: o.close() return dest utils.log( 'Merging "%s" with expected results...' % shorten( self.source_ ) ) try: trimmed_source = filter_xml( self.source_, '%s-trimmed.xml' % os.path.splitext( self.source_ )[0] ) utils.libxslt( utils.log , trimmed_source , xsl_path( 'add_expected_results.xsl' ) , self.file_path_ , { "expected_results_file" : self.expected_results_file_ , "failures_markup_file": self.failures_markup_file_ , "source" : self.tag_ } ) os.unlink( trimmed_source ) except Exception, msg: utils.log( ' Skipping "%s" due to errors (%s)' % ( self.source_, msg ) ) if os.path.exists( self.file_path_ ): os.unlink( self.file_path_ )
def boostbook_report( options ): site = 'fx.meta-comm.com' site_path = '/boost-regression/%s' % options.tag utils.log( 'Opening %s ...' % site ) f = ftplib.FTP( site ) f.login() utils.log( ' cd %s ...' % site_path ) f.cwd( site_path ) utils.log( ' dir' ) lines = [] f.dir( lambda x: lines.append( x ) ) word_lines = [ x.split( None, 8 ) for x in lines ] boostbook_info = [ ( l[-1], get_date( l ) ) for l in word_lines if l[-1] == "BoostBook.zip" ] if len( boostbook_info ) > 0: boostbook_info = boostbook_info[0] utils.log( 'BoostBook found! (%s)' % ( boostbook_info, ) ) local_copy = os.path.join( options.destination,'BoostBook-%s.zip' % options.tag ) if 1: if os.path.exists( local_copy ): utils.log( 'Local copy exists. Checking if it is older than uploaded one...' ) uploaded_mtime = time.mktime( boostbook_info[1] ) local_mtime = os.path.getmtime( local_copy ) utils.log( ' uploaded: %s %s, local: %s %s' % ( uploaded_mtime , boostbook_info[1] , local_mtime , time.localtime( local_mtime )) ) modtime = time.localtime( os.path.getmtime( local_copy ) ) if uploaded_mtime <= local_mtime: utils.log( 'Local copy is newer: exiting' ) sys.exit() if 1: temp = os.path.join( options.destination,'BoostBook.zip' ) result = open( temp, 'wb' ) f.retrbinary( 'RETR %s' % boostbook_info[0], result.write ) result.close() if os.path.exists( local_copy ): os.unlink( local_copy ) os.rename( temp, local_copy ) m = time.mktime( boostbook_info[1] ) os.utime( local_copy, ( m, m ) ) docs_name = os.path.splitext( os.path.basename( local_copy ) )[0] if 1: unpacked_docs_dir = os.path.join( options.destination, docs_name ) utils.log( 'Dir %s ' % unpacked_docs_dir ) if os.path.exists( unpacked_docs_dir ): utils.log( 'Cleaning up...' ) shutil.rmtree( unpacked_docs_dir ) os.makedirs( unpacked_docs_dir ) unzip( local_copy, unpacked_docs_dir ) utils.system( [ 'cd %s' % unpacked_docs_dir , 'tar -c -f ../%s.tar.gz -z --exclude=tarball *' % docs_name ] ) process_boostbook_build_log( os.path.join( unpacked_docs_dir, 'boostbook.log' ), read_timestamp( unpacked_docs_dir ) ) utils.libxslt( log , os.path.abspath( os.path.join( unpacked_docs_dir, 'boostbook.log.xml' ) ) , os.path.abspath( os.path.join( os.path.dirname( __file__ ), 'xsl', 'v2', 'boostbook_log.xsl' ) ) , os.path.abspath( os.path.join( unpacked_docs_dir, 'boostbook.log.html' ) ) )
def boostbook_report(options): site = 'fx.meta-comm.com' site_path = '/boost-regression/%s' % options.tag utils.log('Opening %s ...' % site) f = ftplib.FTP(site) f.login() utils.log(' cd %s ...' % site_path) f.cwd(site_path) utils.log(' dir') lines = [] f.dir(lambda x: lines.append(x)) word_lines = [x.split(None, 8) for x in lines] boostbook_info = [(l[-1], get_date(l)) for l in word_lines if l[-1] == "BoostBook.zip"] if len(boostbook_info) > 0: boostbook_info = boostbook_info[0] utils.log('BoostBook found! (%s)' % (boostbook_info, )) local_copy = os.path.join(options.destination, 'BoostBook-%s.zip' % options.tag) if 1: if os.path.exists(local_copy): utils.log( 'Local copy exists. Checking if it is older than uploaded one...' ) uploaded_mtime = time.mktime(boostbook_info[1]) local_mtime = os.path.getmtime(local_copy) utils.log(' uploaded: %s %s, local: %s %s' % (uploaded_mtime, boostbook_info[1], local_mtime, time.localtime(local_mtime))) modtime = time.localtime(os.path.getmtime(local_copy)) if uploaded_mtime <= local_mtime: utils.log('Local copy is newer: exiting') sys.exit() if 1: temp = os.path.join(options.destination, 'BoostBook.zip') result = open(temp, 'wb') f.retrbinary('RETR %s' % boostbook_info[0], result.write) result.close() if os.path.exists(local_copy): os.unlink(local_copy) os.rename(temp, local_copy) m = time.mktime(boostbook_info[1]) os.utime(local_copy, (m, m)) docs_name = os.path.splitext(os.path.basename(local_copy))[0] if 1: unpacked_docs_dir = os.path.join(options.destination, docs_name) utils.log('Dir %s ' % unpacked_docs_dir) if os.path.exists(unpacked_docs_dir): utils.log('Cleaning up...') shutil.rmtree(unpacked_docs_dir) os.makedirs(unpacked_docs_dir) unzip(local_copy, unpacked_docs_dir) utils.system([ 'cd %s' % unpacked_docs_dir, 'tar -c -f ../%s.tar.gz -z --exclude=tarball *' % docs_name ]) process_boostbook_build_log( os.path.join(unpacked_docs_dir, 'boostbook.log'), read_timestamp(unpacked_docs_dir)) utils.libxslt( log, os.path.abspath( os.path.join(unpacked_docs_dir, 'boostbook.log.xml')), os.path.abspath( os.path.join(os.path.dirname(__file__), 'xsl', 'v2', 'boostbook_log.xsl')), os.path.abspath( os.path.join(unpacked_docs_dir, 'boostbook.log.html')))
def make_result_pages( test_results_file , expected_results_file , failures_markup_file , tag , run_date , comment_file , results_dir , result_prefix , reports , v2 ): utils.log( 'Producing the reports...' ) __log__ = 1 output_dir = os.path.join( results_dir, result_prefix ) utils.makedirs( output_dir ) if comment_file != '': comment_file = os.path.abspath( comment_file ) if expected_results_file != '': expected_results_file = os.path.abspath( expected_results_file ) else: expected_results_file = os.path.abspath( map_path( 'empty_expected_results.xml' ) ) extended_test_results = os.path.join( output_dir, 'extended_test_results.xml' ) if 'x' in reports: utils.log( ' Merging with expected results...' ) utils.libxslt( utils.log , test_results_file , xsl_path( 'add_expected_results.xsl', v2 ) , extended_test_results , { 'expected_results_file': expected_results_file, 'failures_markup_file' : failures_markup_file } ) links = os.path.join( output_dir, 'links.html' ) utils.makedirs( os.path.join( output_dir, 'output' ) ) for mode in ( 'developer', 'user' ): utils.makedirs( os.path.join( output_dir, mode , 'output' ) ) if 'l' in reports: utils.log( ' Making test output files...' ) utils.libxslt( utils.log , extended_test_results , xsl_path( 'links_page.xsl', v2 ) , links , { 'source': tag , 'run_date': run_date , 'comment_file': comment_file , 'explicit_markup_file': failures_markup_file } ) issues = os.path.join( output_dir, 'developer', 'issues.html' ) if 'i' in reports: utils.log( ' Making issues list...' ) utils.libxslt( utils.log , extended_test_results , xsl_path( 'issues_page.xsl', v2 ) , issues , { 'source': tag , 'run_date': run_date , 'comment_file': comment_file , 'explicit_markup_file': failures_markup_file } ) for mode in ( 'developer', 'user' ): if mode[0] + 'd' in reports: utils.log( ' Making detailed %s report...' % mode ) utils.libxslt( utils.log , extended_test_results , xsl_path( 'result_page.xsl', v2 ) , os.path.join( output_dir, mode, 'index.html' ) , { 'links_file': 'links.html' , 'mode': mode , 'source': tag , 'run_date': run_date , 'comment_file': comment_file , 'expected_results_file': expected_results_file , 'explicit_markup_file' : failures_markup_file } ) for mode in ( 'developer', 'user' ): if mode[0] + 's' in reports: utils.log( ' Making summary %s report...' % mode ) utils.libxslt( utils.log , extended_test_results , xsl_path( 'summary_page.xsl', v2 ) , os.path.join( output_dir, mode, 'summary.html' ) , { 'mode' : mode , 'source': tag , 'run_date': run_date , 'comment_file': comment_file , 'explicit_markup_file' : failures_markup_file } ) if v2 and "ddr" in reports: utils.log( ' Making detailed %s release report...' % mode ) utils.libxslt( utils.log , extended_test_results , xsl_path( 'result_page.xsl', v2 ) , os.path.join( output_dir, "developer", 'index_release.html' ) , { 'links_file': 'links.html' , 'mode': "developer" , 'source': tag , 'run_date': run_date , 'comment_file': comment_file , 'expected_results_file': expected_results_file , 'explicit_markup_file' : failures_markup_file , 'release': "yes" } ) if v2 and "dsr" in reports: utils.log( ' Making summary %s release report...' % mode ) utils.libxslt( utils.log , extended_test_results , xsl_path( 'summary_page.xsl', v2 ) , os.path.join( output_dir, "developer", 'summary_release.html' ) , { 'mode' : "developer" , 'source': tag , 'run_date': run_date , 'comment_file': comment_file , 'explicit_markup_file' : failures_markup_file , 'release': 'yes' } ) if 'e' in reports: utils.log( ' Generating expected_results ...' ) utils.libxslt( utils.log , extended_test_results , xsl_path( 'produce_expected_results.xsl', v2 ) , os.path.join( output_dir, 'expected_results.xml' ) ) if v2 and 'n' in reports: utils.log( ' Making runner comment files...' ) utils.libxslt( utils.log , extended_test_results , xsl_path( 'runners.xsl', v2 ) , os.path.join( output_dir, 'runners.html' ) ) shutil.copyfile( xsl_path( 'html/master.css', v2 ) , os.path.join( output_dir, 'master.css' ) )
def make_result_pages(test_results_file, expected_results_file, failures_markup_file, tag, run_date, comment_file, results_dir, result_prefix, reports, v2): utils.log('Producing the reports...') __log__ = 1 output_dir = os.path.join(results_dir, result_prefix) utils.makedirs(output_dir) if comment_file != '': comment_file = os.path.abspath(comment_file) if expected_results_file != '': expected_results_file = os.path.abspath(expected_results_file) else: expected_results_file = os.path.abspath( map_path('empty_expected_results.xml')) extended_test_results = os.path.join(output_dir, 'extended_test_results.xml') if 'x' in reports: utils.log(' Merging with expected results...') utils.libxslt( utils.log, test_results_file, xsl_path('add_expected_results.xsl', v2), extended_test_results, { 'expected_results_file': expected_results_file, 'failures_markup_file': failures_markup_file }) links = os.path.join(output_dir, 'links.html') utils.makedirs(os.path.join(output_dir, 'output')) for mode in ('developer', 'user'): utils.makedirs(os.path.join(output_dir, mode, 'output')) if 'l' in reports: utils.log(' Making test output files...') utils.libxslt( utils.log, extended_test_results, xsl_path('links_page.xsl', v2), links, { 'source': tag, 'run_date': run_date, 'comment_file': comment_file, 'explicit_markup_file': failures_markup_file }) issues = os.path.join(output_dir, 'developer', 'issues.html') if 'i' in reports: utils.log(' Making issues list...') utils.libxslt( utils.log, extended_test_results, xsl_path('issues_page.xsl', v2), issues, { 'source': tag, 'run_date': run_date, 'comment_file': comment_file, 'explicit_markup_file': failures_markup_file }) for mode in ('developer', 'user'): if mode[0] + 'd' in reports: utils.log(' Making detailed %s report...' % mode) utils.libxslt( utils.log, extended_test_results, xsl_path('result_page.xsl', v2), os.path.join(output_dir, mode, 'index.html'), { 'links_file': 'links.html', 'mode': mode, 'source': tag, 'run_date': run_date, 'comment_file': comment_file, 'expected_results_file': expected_results_file, 'explicit_markup_file': failures_markup_file }) for mode in ('developer', 'user'): if mode[0] + 's' in reports: utils.log(' Making summary %s report...' % mode) utils.libxslt( utils.log, extended_test_results, xsl_path('summary_page.xsl', v2), os.path.join(output_dir, mode, 'summary.html'), { 'mode': mode, 'source': tag, 'run_date': run_date, 'comment_file': comment_file, 'explicit_markup_file': failures_markup_file }) if v2 and "ddr" in reports: utils.log(' Making detailed %s release report...' % mode) utils.libxslt( utils.log, extended_test_results, xsl_path('result_page.xsl', v2), os.path.join(output_dir, "developer", 'index_release.html'), { 'links_file': 'links.html', 'mode': "developer", 'source': tag, 'run_date': run_date, 'comment_file': comment_file, 'expected_results_file': expected_results_file, 'explicit_markup_file': failures_markup_file, 'release': "yes" }) if v2 and "dsr" in reports: utils.log(' Making summary %s release report...' % mode) utils.libxslt( utils.log, extended_test_results, xsl_path('summary_page.xsl', v2), os.path.join(output_dir, "developer", 'summary_release.html'), { 'mode': "developer", 'source': tag, 'run_date': run_date, 'comment_file': comment_file, 'explicit_markup_file': failures_markup_file, 'release': 'yes' }) if 'e' in reports: utils.log(' Generating expected_results ...') utils.libxslt(utils.log, extended_test_results, xsl_path('produce_expected_results.xsl', v2), os.path.join(output_dir, 'expected_results.xml')) if v2 and 'n' in reports: utils.log(' Making runner comment files...') utils.libxslt(utils.log, extended_test_results, xsl_path('runners.xsl', v2), os.path.join(output_dir, 'runners.html')) shutil.copyfile(xsl_path('html/master.css', v2), os.path.join(output_dir, 'master.css'))