def report_skip(test, reason): skip_message = ' SKIP: %s' % test if reason: skip_message += ' (Reason: %s)' % reason console.log(skip_message, console.TERMINAL_YELLOW)
def print_command(cwd, cmd, args): ''' Helper function to print commands. ''' rpath = relpath(cwd, paths.PROJECT_ROOT) # Resolve the current folder character to the appropriate folder name. if rpath == os.curdir: rpath = basename(abspath(os.curdir)) cmd_info = [ '%s[%s]' % (console.TERMINAL_YELLOW, rpath), '%s%s' % (console.TERMINAL_GREEN, cmd), '%s%s' % (console.TERMINAL_EMPTY, ' '.join(args)) ] console.log(' '.join(cmd_info))
def create_result(self): ''' Create a final JSON result file from the build and test information. ''' result = {'bin': {}, 'date': {}, 'tests': {}, 'submodules': {}} labels = { 'profiles/minimal-profile-build': 'minimal-profile', 'profiles/target-es5.1-profile-build': 'target-es5_1-profile', 'profiles/target-es2015subset-profile-build': 'target-es2015subset-profile' } for job_id, build_path in self.results.iteritems(): # Append the binary information. if 'test-build' in job_id: filename = utils.join(build_path, 'testresults.json') # Do not save the testresults if there is no available data. if not utils.exists(filename): continue result.update(utils.read_json_file(filename)) else: filename = utils.join(build_path, 'build.json') # Do not save build info if there is no available data. if not utils.exists(filename): continue bin_data = utils.read_json_file(filename) # Translate job_id to database schema name. label = labels[job_id] result['bin'][label] = bin_data['bin'] result['submodules'] = bin_data['submodules'] result['date'] = bin_data['last-commit-date'] filepath = utils.join(paths.RESULT_PATH, self.options.app, self.options.device) filename = utils.join(filepath, utils.current_date() + '.json') # Save the content info a result file. utils.write_json_file(filename, result) console.log() console.log('The results are written into:', console.TERMINAL_BLUE) console.log(' {json_file}'.format(json_file=filename)) console.log() return result
def report_coverage(coverage_info): console.log() console.log('Finished with the coverage measurement:', console.TERMINAL_BLUE) for src_name, value in coverage_info.iteritems(): # Check that the number of inspected rows are greater than zero. if value['coverage'][1] > 0: # Calculate the percentage and show the covered line information. percentage = round( float(value['coverage'][0]) / value['coverage'][1], 2) * 100 console.log( "\t {} : {}%, Lines {} / {} are covered".format( src_name + '.js', percentage, value['coverage'][0], value['coverage'][1]), console.TERMINAL_GREEN) else: console.log("\t %s.js was not reached by the tests" % src_name, console.TERMINAL_YELLOW)
def report_final(testresults): results = {} results['pass'] = 0 results['fail'] = 0 results['skip'] = 0 results['timeout'] = 0 for test in testresults: results[test['result']] += 1 console.log() console.log('Finished with all tests:', console.TERMINAL_BLUE) console.log(' PASS: %d' % results['pass'], console.TERMINAL_GREEN) console.log(' FAIL: %d' % results['fail'], console.TERMINAL_RED) console.log(' TIMEOUT: %d' % results['timeout'], console.TERMINAL_RED) console.log(' SKIP: %d' % results['skip'], console.TERMINAL_YELLOW)
def report_configuration(env): console.log() console.log('Test configuration:') console.log(' app: %s' % env.options.app) console.log(' device: %s' % env.options.device) console.log(' timeout: %s sec' % env.options.timeout) if env.options.device in ['rpi2', 'artik530']: console.log(' ip: %s' % env.options.ip) console.log(' port: %s' % env.options.port) console.log(' username: %s' % env.options.username) console.log(' remote workdir: %s' % env.options.remote_workdir) elif env.options.device in ['stm32f4dis', 'artik053']: console.log(' device-id: %s' % env.options.device_id) console.log(' baud: %d' % env.options.baud)
def report_timeout(test): console.log(' TIMEOUT: %s' % test, console.TERMINAL_RED)
def report_fail(test): console.log(' FAIL: %s' % test, console.TERMINAL_RED)
def report_pass(test): console.log(' PASS: %s' % test, console.TERMINAL_GREEN)
def report_testset(testset): console.log() console.log('Testset: %s' % testset, console.TERMINAL_BLUE)
def print_message(**params): ''' Print a message to the screen. ''' console.log(params['args'][0])
def report_configuration(env): info = env['info'] console.log() console.log('Test configuration:') console.log(' app: %s' % info['app']) console.log(' device: %s' % info['device']) console.log(' timeout: %s sec' % info['timeout']) if info['device'] in ['rpi2', 'artik530']: console.log(' ip: %s' % info['ip']) console.log(' port: %s' % info['port']) console.log(' username: %s' % info['username']) console.log(' remote workdir: %s' % info['remote_workdir']) elif info['device'] in ['stm32f4dis', 'artik053']: console.log(' device-id: %s' % info['device_id']) console.log(' baud: %d' % info['baud'])