def __init__(self, parser, args): """Initialize executor based on the current script environment Args: parser: argparse.ArgumentParser for handling improper inputs. args: Dictionary of arguments passed into the calling script. """ self.dry_run = args['dry_run'] self.verbose = args['verbose'] llvm_cov = self.determine_proper_llvm_cov() if not llvm_cov: print 'Unable to find appropriate llvm-cov to use' sys.exit(1) self.lcov_env = os.environ self.lcov_env['LLVM_COV_BIN'] = llvm_cov self.lcov = self.determine_proper_lcov() if not self.lcov: print 'Unable to find appropriate lcov to use' sys.exit(1) self.coverage_files = set() self.source_directory = args['source_directory'] if not os.path.isdir(self.source_directory): parser.error("'%s' needs to be a directory" % self.source_directory) self.build_directory = args['build_directory'] if not os.path.isdir(self.build_directory): parser.error("'%s' needs to be a directory" % self.build_directory) self.coverage_tests = self.calculate_coverage_tests(args) if not self.coverage_tests: parser.error( 'No valid tests in set to be run. This is likely due to bad command ' 'line arguments') if not GetBooleanGnArg('use_coverage', self.build_directory, self.verbose): parser.error( 'use_coverage does not appear to be set to true for build, but is ' 'needed') self.use_goma = GetBooleanGnArg('use_goma', self.build_directory, self.verbose) self.output_directory = args['output_directory'] if not os.path.exists(self.output_directory): if not self.dry_run: os.makedirs(self.output_directory) elif not os.path.isdir(self.output_directory): parser.error('%s exists, but is not a directory' % self.output_directory) self.coverage_totals_path = os.path.join(self.output_directory, 'pdfium_totals.info')
def __init__(self, parser, args): """Initialize executor based on the current script environment Args: parser: argparse.ArgumentParser for handling improper inputs. args: Dictionary of arguments passed into the calling script. """ self.dry_run = args['dry_run'] self.verbose = args['verbose'] self.source_directory = args['source_directory'] if not os.path.isdir(self.source_directory): parser.error("'%s' needs to be a directory" % self.source_directory) self.llvm_directory = os.path.join(self.source_directory, 'third_party', 'llvm-build', 'Release+Asserts', 'bin') if not os.path.isdir(self.llvm_directory): parser.error( "Cannot find LLVM bin directory , expected it to be in '%s'" % self.llvm_directory) self.build_directory = args['build_directory'] if not os.path.isdir(self.build_directory): parser.error("'%s' needs to be a directory" % self.build_directory) (self.coverage_tests, self.build_targets) = self.calculate_coverage_tests(args) if not self.coverage_tests: parser.error( 'No valid tests in set to be run. This is likely due to bad command ' 'line arguments') if not GetBooleanGnArg('use_clang_coverage', self.build_directory, self.verbose): parser.error( 'use_clang_coverage does not appear to be set to true for build, but ' 'is needed') self.use_goma = GetBooleanGnArg('use_goma', self.build_directory, self.verbose) self.output_directory = args['output_directory'] if not os.path.exists(self.output_directory): if not self.dry_run: os.makedirs(self.output_directory) elif not os.path.isdir(self.output_directory): parser.error('%s exists, but is not a directory' % self.output_directory) elif len(os.listdir(self.output_directory)) > 0: parser.error('%s is not empty, cowardly refusing to continue' % self.output_directory) self.prof_data = os.path.join(self.output_directory, 'pdfium.profdata')