def run( self, options=None ): ''' Performs the action. ''' print 'Uploading results for ' + config.SOFTWARE_SHORT + '...' # check which submission type submissiontype = 'Experimental' if options.continuous: submissiontype = 'Continuous' elif options.nightly: submissiontype = 'Nightly' # now we create a dashboard submission file cdasher = CDash() # # build # print Colors.CYAN + 'Loading Build Report..' + Colors._CLEAR buildReport = os.path.join( config.TEMP_PATH, config.SOFTWARE_SHORT + '_Build.xml' ) if os.path.isfile( buildReport ): # found a build report print Colors.ORANGE + 'Found Build Report!' + Colors._CLEAR with open( buildReport, 'r' ) as f: cdasher.submit( f.read(), submissiontype ) print Colors.ORANGE + '..Successfully uploaded as ' + Colors.CYAN + submissiontype + Colors.ORANGE + '.' + Colors._CLEAR else: # not found print Colors.ORANGE + 'Not Found!' + Colors._CLEAR buildReport = None # # test # delete old reports if buildReport: os.unlink( buildReport )
def run( self, options=None ): ''' Performs the action. ''' print 'Testing ' + config.SOFTWARE_SHORT + '...' # TODO run tests and parse output log = [] log.append( ['Test1', 'passed', 'All worked!Yay!', 200, None, None] ) log.append( ['Test2', 'failed', 'Failure :( :( :(Failure!', 123, None, None] ) # now we create a dashboard submission file cdasher = CDash() xmlfile = cdasher.run( ['Testing', log] ) with open( os.path.join( config.TEMP_PATH, config.SOFTWARE_SHORT + '_Test.xml' ), 'w' ) as f: f.write( xmlfile ) print Colors.ORANGE + 'Testing done.'
def run(self, options=None): """ Performs the action. """ print "Building " + config.SOFTWARE_SHORT + "..." # grab all js files filefinder = JSFileFinder() jsfiles = filefinder.run() arguments = [] # add js files for j in jsfiles: arguments.extend(["-i", j]) # add the project root arguments.extend(["--root", config.SOFTWARE_PATH]) # set the output mode to compiled arguments.extend(["-o", "compiled"]) # configure the compiler path arguments.extend(["-c", config.CLOSURECOMPILER_PATH]) # configure the output file arguments.extend(["--output_file", config.BUILD_OUTPUT_PATH]) # configure additional compiler arguments arguments.extend(["-f", "--warning_level=VERBOSE"]) # verbose arguments.extend(["-f", "--compilation_level=ADVANCED_OPTIMIZATIONS"]) # advanced compilation arguments.extend(["-f", "--jscomp_warning=missingProperties"]) # enable strict mode 1 arguments.extend(["-f", "--jscomp_warning=checkTypes"]) # enable strict mode 2 arguments.extend(["-f", "--summary_detail_level=3"]) # always show summary arguments.extend(["-f", "--define=goog.DEBUG=false"]) # turn of closure library debugging # add the goog/deps.js file from closure according to # https://code.google.com/p/closure-library/wiki/FrequentlyAskedQuestions#When_I_compile_with_type-checking_on,_I_get_warnings_about_unkno arguments.extend(["-f", "--js=" + config.CLOSURELIBRARY_DEPS_PATH]) # if enabled, set debug options if options.debug: arguments.extend(["-f", "--debug"]) arguments.extend(["-f", "--formatting=PRETTY_PRINT"]) # # call the compiler (through the closure builder) # # make sure the closurebuilder is executable st = os.stat(config.CLOSUREBUILDER_PATH) os.chmod(config.CLOSUREBUILDER_PATH, st.st_mode | stat.S_IEXEC) command = ["python", config.CLOSUREBUILDER_PATH] command.extend(arguments) process = subprocess.Popen(command, bufsize=0, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # ignore the next X lines ignoreNext = 0 # save warnings and errors in a log logActive = False log = [] # fancy displaying using ANSI colors for line in process.stdout: if ignoreNext > 0: # we ignore this line ignoreNext -= 1 continue line = line.strip("\n") color = Colors._CLEAR # default is no color # colorize depending on line content if line.find("Scanning") != -1: color = Colors.YELLOW elif line.find("scanned") != -1: color = Colors.YELLOW elif line.find("Building") != -1: color = Colors.PURPLE elif line.find("Compiling") != -1: color = Colors.PURPLE # start logging now logActive = True elif line.find("ERROR") != -1: color = Colors.RED elif line.find("WARNING") != -1: # this is a warning, only display these if verbose mode is on if not options.verbose: ignoreNext = 3 # and ignore the next 2 lines continue color = Colors.ORANGE if logActive: # log this line if we are in logging mode log.append(line) # print colored line print color + line + Colors._CLEAR # we have errors and warnings logged now log = log[1:-1] # remove first and last log entries since they are additional information # now we create a dashboard submission file cdasher = CDash() xmlfile = cdasher.run(["Build", log, True]) with open(os.path.join(config.TEMP_PATH, config.SOFTWARE_SHORT + "_Build.xml"), "w") as f: f.write(xmlfile) # and add a timestamp to the compiled file with open(config.BUILD_OUTPUT_PATH, "r") as f: content = f.read() # read everything in the file now = datetime.datetime.now() content_with_timestamp = content.replace("###TIMESTAMP###", now.strftime("%Y-%m-%d %H:%M:%S")) with open(config.BUILD_OUTPUT_PATH, "w") as f: f.write(content_with_timestamp) # write the new stuff # and attach the license licenser = Licenser() licenser.run() print Colors.ORANGE + "Compiled file " + Colors.CYAN + config.BUILD_OUTPUT_PATH + Colors.ORANGE + " written. " + Colors._CLEAR
def run( self, options=None ): ''' Performs the action. ''' print 'Testing ' + config.SOFTWARE_SHORT + '...' browser = 'chrome' if options.firefox: browser = 'firefox' # sanity check when testing against the build if options.build: # make sure there is xtk.js if not os.path.exists(config.BUILD_OUTPUT_PATH): print Colors.RED + 'Could not find ' + Colors.ORANGE + 'xtk.js' + Colors.RED + '!' print Colors.RED + 'Make sure to run ' + Colors.CYAN + './build.py' + Colors.RED + ' before!' + Colors._CLEAR sys.exit(2) # setup environment self.setupEnvironment( browser ) # # UNIT TESTS # # run the unit tests if options.build: # against the build self.visit( config.UNIT_TESTS_BUILD ) else: # against the dev tree self.visit( config.UNIT_TESTS ) # wait for unit tests time.sleep( 3 ) # .. grab the result result_unit = self.__browser.execute_script( 'return window.G_testRunner.getReport(true);' ) # .. and fill our log log = self.parse_unit_results( result_unit ) # # VISUAL TESTS # if not options.novisual: for t in config.VISUAL_TESTS: _test = config.VISUAL_TESTS_BASEPATH + t testId = os.path.splitext( t )[0] testFileId = testId + '_' + browser # clock it start_time = time.time() if options.build: # if we test against the build tree, append ?build to the url self.visit( _test + '?build' ) else: self.visit( _test ) # wait until loading fully completed timer = 0 while not self.__browser.execute_script( 'return test_renderer.loadingCompleted' ) and timer < 5: time.sleep( 1 ) # loading did not complete yet timer += 1 time.sleep( 1 ) # # perform some interaction # press some keys self.interact_keyboard() # compare a screenshot vs. the baseline screenshot_file = self.screenshot( testFileId ) baseline_file = self.baseline( testFileId ) # check if the baseline exists if not os.path.exists(baseline_file): # if not, copy the current screnshot over shutil.copy(screenshot_file, baseline_file); result_image = self.compare_images( screenshot_file, baseline_file ) # grab the FPS and the startup time fps = self.__browser.execute_script( 'return 1000/frameTime;' ) startup_time = self.__browser.execute_script( 'return startup;' ) # # add log entry # end_time = time.time() execution_time = end_time - start_time test_result = 'failed' test_log = 'Comparison of ' + screenshot_file + ' and ' + baseline_file + ' failed!' if result_image: # this means the test passed test_result = 'passed' test_log = '' log.append( ['Visualization' + testFileId, test_result, test_log, execution_time, screenshot_file, baseline_file, startup_time, fps] ) # use the mouse but only in chrome (firefox might crash) # this is just to increase testing coverage of interactors if browser == 'chrome': self.interact_mouse() # teardown environment self.teardownEnvironment( browser ) # print the results in verbose mode if options.verbose: self.print_log( log ) # but always print the summary self.print_summary( log ) # parse the coverage analysis coverage_log = self.parse_coverage() # now we create a dashboard submission file cdasher = CDash() xmlfile = cdasher.run( ['Testing', log, options.build] ) with open( os.path.join( config.TEMP_PATH, config.SOFTWARE_SHORT + '_Test.xml' ), 'w' ) as f: f.write( xmlfile ) # .. and two coverage submission files, but only in dev mode if not options.build: # first is the summary cdasher = CDash() xmlfile = cdasher.run( ['Coverage', coverage_log, options.build] ) with open( os.path.join( config.TEMP_PATH, config.SOFTWARE_SHORT + '_Coverage.xml' ), 'w' ) as f: f.write( xmlfile ) # second is the log for each LOC cdasher = CDash() xmlfile = cdasher.run( ['CoverageLog', coverage_log, options.build] ) with open( os.path.join( config.TEMP_PATH, config.SOFTWARE_SHORT + '_CoverageLog.xml' ), 'w' ) as f: f.write( xmlfile ) print Colors.ORANGE + 'Testing done.' + Colors._CLEAR
def run(self, options=None): ''' Performs the action. ''' print 'Building ' + config.SOFTWARE_SHORT + '...' # grab all js files filefinder = JSFileFinder() jsfiles = filefinder.run() arguments = [] # add js files for j in jsfiles: arguments.extend(['-i', j]) # add the project root arguments.extend(['--root', config.SOFTWARE_PATH]) # set the output mode to compiled arguments.extend(['-o', 'compiled']) # configure the compiler path arguments.extend(['-c', config.CLOSURECOMPILER_PATH]) # configure the output file arguments.extend(['--output_file', config.BUILD_OUTPUT_PATH]) # configure additional compiler arguments arguments.extend(['-f', '--warning_level=VERBOSE']) # verbose arguments.extend(['-f', '--jscomp_warning=missingProperties' ]) # enable strict mode 1 arguments.extend(['-f', '--jscomp_warning=checkTypes' ]) # enable strict mode 2 arguments.extend(['-f', '--summary_detail_level=3']) # always show summary arguments.extend(['-f', '--define=goog.DEBUG=false' ]) # turn of closure library debugging # add the goog/deps.js file from closure according to # https://code.google.com/p/closure-library/wiki/FrequentlyAskedQuestions#When_I_compile_with_type-checking_on,_I_get_warnings_about_unkno arguments.extend(['-f', '--js=' + config.CLOSURELIBRARY_DEPS_PATH]) # if enabled, set debug options if options.debug: arguments.extend(['-f', '--debug']) arguments.extend(['-f', '--formatting=PRETTY_PRINT']) if options.simpleoptimizations: arguments.extend([ '-f', '--compilation_level=SIMPLE_OPTIMIZATIONS' ]) # advanced compilation else: arguments.extend([ '-f', '--compilation_level=ADVANCED_OPTIMIZATIONS' ]) # advanced compilation # # call the compiler (through the closure builder) # # make sure the closurebuilder is executable st = os.stat(config.CLOSUREBUILDER_PATH) os.chmod(config.CLOSUREBUILDER_PATH, st.st_mode | stat.S_IEXEC) command = ['python', config.CLOSUREBUILDER_PATH] command.extend(arguments) process = subprocess.Popen(command, bufsize=0, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # ignore the next X lines ignoreNext = 0 # save warnings and errors in a log logActive = False log = [] # fancy displaying using ANSI colors for line in process.stdout: if ignoreNext > 0: # we ignore this line ignoreNext -= 1 continue line = line.strip('\n') color = Colors._CLEAR # default is no color # colorize depending on line content if line.find('Scanning') != -1: color = Colors.YELLOW elif line.find('scanned') != -1: color = Colors.YELLOW elif line.find('Building') != -1: color = Colors.PURPLE elif line.find('Compiling') != -1: color = Colors.PURPLE # start logging now logActive = True elif line.find('ERROR') != -1: color = Colors.RED elif line.find('WARNING') != -1: # this is a warning, only display these if verbose mode is on if not options.verbose: ignoreNext = 3 # and ignore the next 2 lines continue color = Colors.ORANGE if logActive: # log this line if we are in logging mode log.append(line) # print colored line print color + line + Colors._CLEAR # we have errors and warnings logged now log = log[ 1: -1] # remove first and last log entries since they are additional information # now we create a dashboard submission file cdasher = CDash() xmlfile = cdasher.run(['Build', log, True]) with open( os.path.join(config.TEMP_PATH, config.SOFTWARE_SHORT + '_Build.xml'), 'w') as f: f.write(xmlfile) # and add a timestamp to the compiled file with open(config.BUILD_OUTPUT_PATH, 'r') as f: content = f.read() # read everything in the file now = datetime.datetime.now() content_with_timestamp = content.replace( '###TIMESTAMP###', now.strftime('%Y-%m-%d %H:%M:%S')) with open(config.BUILD_OUTPUT_PATH, 'w') as f: f.write(content_with_timestamp) # write the new stuff # and attach the license licenser = Licenser() licenser.run() print Colors.ORANGE + 'Compiled file ' + Colors.CYAN + config.BUILD_OUTPUT_PATH + Colors.ORANGE + ' written. ' + Colors._CLEAR
def run(self, options=None): ''' Performs the action. ''' print 'Uploading results for ' + config.SOFTWARE_SHORT + '...' # check which submission type submissiontype = 'Experimental' if options.continuous: submissiontype = 'Continuous' elif options.nightly: submissiontype = 'Nightly' # now we create a dashboard submission file cdasher = CDash() # # build # print Colors.CYAN + 'Loading Build Report..' + Colors._CLEAR buildReport = os.path.join(config.TEMP_PATH, config.SOFTWARE_SHORT + '_Build.xml') if os.path.isfile(buildReport): # found a build report print Colors.ORANGE + 'Found Build Report!' + Colors._CLEAR with open(buildReport, 'r') as f: cdasher.submit(f.read(), submissiontype) print Colors.ORANGE + '..Successfully uploaded as ' + Colors.CYAN + submissiontype + Colors.ORANGE + '.' + Colors._CLEAR else: # not found print Colors.ORANGE + 'Not Found!' + Colors._CLEAR buildReport = None # # test # print Colors.CYAN + 'Loading Testing Report..' + Colors._CLEAR testReport = os.path.join(config.TEMP_PATH, config.SOFTWARE_SHORT + '_Test.xml') if os.path.isfile(testReport): # found a build report print Colors.ORANGE + 'Found Testing Report!' + Colors._CLEAR with open(testReport, 'r') as f: cdasher.submit(f.read(), submissiontype) print Colors.ORANGE + '..Successfully uploaded as ' + Colors.CYAN + submissiontype + Colors.ORANGE + '.' + Colors._CLEAR else: # not found print Colors.ORANGE + 'Not Found!' + Colors._CLEAR testReport = None # # coverage summary # print Colors.CYAN + 'Loading Coverage Summary..' + Colors._CLEAR coverageReport = os.path.join(config.TEMP_PATH, config.SOFTWARE_SHORT + '_Coverage.xml') if os.path.isfile(coverageReport): # found a build report print Colors.ORANGE + 'Found Coverage Summary!' + Colors._CLEAR with open(coverageReport, 'r') as f: cdasher.submit(f.read(), submissiontype) print Colors.ORANGE + '..Successfully uploaded as ' + Colors.CYAN + submissiontype + Colors.ORANGE + '.' + Colors._CLEAR else: # not found print Colors.ORANGE + 'Not Found!' + Colors._CLEAR coverageReport = None # # coverage log # print Colors.CYAN + 'Loading Coverage Log..' + Colors._CLEAR coverageLog = os.path.join(config.TEMP_PATH, config.SOFTWARE_SHORT + '_CoverageLog.xml') if os.path.isfile(coverageLog): # found a build report print Colors.ORANGE + 'Found Coverage Log!' + Colors._CLEAR with open(coverageLog, 'r') as f: cdasher.submit(f.read(), submissiontype) print Colors.ORANGE + '..Successfully uploaded as ' + Colors.CYAN + submissiontype + Colors.ORANGE + '.' + Colors._CLEAR else: # not found print Colors.ORANGE + 'Not Found!' + Colors._CLEAR coverageLog = None # delete old reports if buildReport: os.unlink(buildReport) if testReport: os.unlink(testReport) if coverageReport: os.unlink(coverageReport) if coverageLog: os.unlink(coverageLog)
def run( self, options=None ): ''' Performs the action. ''' print 'Building ' + config.SOFTWARE_SHORT + '...' # grab all js files filefinder = JSFileFinder() jsfiles = filefinder.run() arguments = [] # add js files for j in jsfiles: arguments.extend( ['-i', j] ) # add the project root arguments.extend( ['--root', config.SOFTWARE_PATH] ) # set the output mode to compiled arguments.extend( ['-o', 'compiled'] ) # configure the compiler path arguments.extend( ['-c', config.CLOSURECOMPILER_PATH] ) # configure the output file arguments.extend( ['--output_file', config.BUILD_OUTPUT_PATH] ) # configure additional compiler arguments arguments.extend( [ '-f', '--warning_level=VERBOSE'] ) # verbose arguments.extend( [ '-f', '--compilation_level=ADVANCED_OPTIMIZATIONS'] ) # advanced compilation arguments.extend( [ '-f', '--jscomp_warning=missingProperties'] ) # enable strict mode 1 arguments.extend( [ '-f', '--jscomp_warning=checkTypes'] ) # enable strict mode 2 arguments.extend( ['-f', '--summary_detail_level=3'] ) # always show summary arguments.extend( [ '-f', '--define=goog.DEBUG=false'] ) # turn of closure library debugging # if enabled, set debug options if options.debug: arguments.extend( ['-f', '--debug'] ) arguments.extend( ['-f', '--formatting=PRETTY_PRINT'] ) # # call the compiler (through the closure builder) # command = [config.CLOSUREBUILDER_PATH] command.extend( arguments ) process = subprocess.Popen( command, bufsize=0, stdout=subprocess.PIPE, stderr=subprocess.STDOUT ) # ignore the next X lines ignoreNext = 0 # save warnings and errors in a log logActive = False log = [] # fancy displaying using ANSI colors for line in process.stdout: if ignoreNext > 0: # we ignore this line ignoreNext -= 1 continue line = line.strip( '\n' ) color = Colors._CLEAR # default is no color # colorize depending on line content if line.find( 'Scanning' ) != -1: color = Colors.YELLOW elif line.find( 'scanned' ) != -1: color = Colors.YELLOW elif line.find( 'Building' ) != -1: color = Colors.PURPLE elif line.find( 'Compiling' ) != -1: color = Colors.PURPLE # start logging now logActive = True elif line.find( 'ERROR' ) != -1: color = Colors.RED elif line.find( 'WARNING' ) != -1: # this is a warning, only display these if verbose mode is on if not options.verbose: ignoreNext = 3 # and ignore the next 2 lines continue color = Colors.ORANGE if logActive: # log this line if we are in logging mode log.append( line ) # print colored line print color + line + Colors._CLEAR # we have errors and warnings logged now log = log[1:-1] # remove first and last log entries since they are additional information # now we create a dashboard submission file cdasher = CDash() xmlfile = cdasher.run( ['Build', log, True] ) with open( os.path.join( config.TEMP_PATH, config.SOFTWARE_SHORT + '_Build.xml' ), 'w' ) as f: f.write( xmlfile ) # and add a timestamp to the compiled file with open( config.BUILD_OUTPUT_PATH, 'r' ) as f: content = f.read() # read everything in the file now = datetime.datetime.now() content_with_timestamp = content.replace( '###TIMESTAMP###', now.strftime( '%Y-%m-%d %H:%M:%S' ) ) with open( config.BUILD_OUTPUT_PATH, 'w' ) as f: f.write( content_with_timestamp ) # write the new stuff # and attach the license licenser = Licenser() licenser.run() print Colors.ORANGE + 'Compiled file ' + Colors.CYAN + config.BUILD_OUTPUT_PATH + Colors.ORANGE + ' written. ' + Colors._CLEAR
def run( self, options=None ): ''' Performs the action. ''' print 'Building ' + config.SOFTWARE_SHORT + '...' # grab all js files filefinder = JSFileFinder() jsfiles = filefinder.run() arguments = [] # add js files for j in jsfiles: arguments.extend( ['-i', j] ) # add the project root arguments.extend( ['--root', config.SOFTWARE_PATH] ) # set the output mode to compiled arguments.extend( ['-o', 'compiled'] ) # configure the compiler path arguments.extend( ['-c', config.CLOSURECOMPILER_PATH] ) # configure the output file arguments.extend( ['--output_file', config.BUILD_OUTPUT_PATH] ) # configure additional compiler arguments arguments.extend( [ '-f', '--warning_level=VERBOSE'] ) # verbose arguments.extend( [ '-f', '--compilation_level=ADVANCED_OPTIMIZATIONS'] ) # advanced compilation arguments.extend( [ '-f', '--jscomp_warning=missingProperties'] ) # enable strict mode 1 arguments.extend( [ '-f', '--jscomp_warning=checkTypes'] ) # enable strict mode 2 arguments.extend( ['-f', '--summary_detail_level=3'] ) # always show summary arguments.extend( [ '-f', '--define=goog.DEBUG=false'] ) # turn of closure library debugging # if enabled, set debug options if options.debug: arguments.extend( ['-f', '--debug'] ) arguments.extend( ['-f', '--formatting=PRETTY_PRINT'] ) # # call the compiler (through the closure builder) # command = [config.CLOSUREBUILDER_PATH] command.extend( arguments ) process = subprocess.Popen( command, bufsize=0, stdout=subprocess.PIPE, stderr=subprocess.STDOUT ) # ignore the next X lines ignoreNext = 0 # save warnings and errors in a log logActive = False log = [] # fancy displaying using ANSI colors for line in process.stdout: if ignoreNext > 0: # we ignore this line ignoreNext -= 1 continue line = line.strip( '\n' ) color = Colors._CLEAR # default is no color # colorize depending on line content if line.find( 'Scanning' ) != -1: color = Colors.YELLOW elif line.find( 'scanned' ) != -1: color = Colors.YELLOW elif line.find( 'Building' ) != -1: color = Colors.PURPLE elif line.find( 'Compiling' ) != -1: color = Colors.PURPLE # start logging now logActive = True elif line.find( 'ERROR' ) != -1: color = Colors.RED elif line.find( 'WARNING' ) != -1: # this is a warning, only display these if verbose mode is on if not options.verbose: ignoreNext = 3 # and ignore the next 2 lines continue color = Colors.ORANGE if logActive: # log this line if we are in logging mode log.append( line ) # print colored line print color + line + Colors._CLEAR # we have errors and warnings logged now log = log[1:-1] # remove first and last log entries since they are additional information # now we create a dashboard submission file cdasher = CDash() xmlfile = cdasher.run( ['Build', log] ) with open( os.path.join( config.TEMP_PATH, config.SOFTWARE_SHORT + '_Build.xml' ), 'w' ) as f: f.write( xmlfile ) # and attach the license licenser = Licenser() licenser.run() print Colors.ORANGE + 'Compiled file ' + Colors.CYAN + config.BUILD_OUTPUT_PATH + Colors.ORANGE + ' written. ' + Colors._CLEAR