def execute(testcase_id, current, build): """Execute the reproduce command.""" print 'Reproduce %s (current=%s)' % (testcase_id, current) print 'Downloading testcase information...' response = get_testcase_info(testcase_id) goma_dir = ensure_goma() current_testcase = testcase.Testcase(response) definition = get_binary_definition(current_testcase.job_type, build) maybe_warn_unreproducible(current_testcase) if build == 'download': if definition.binary_name: binary_name = definition.binary_name else: binary_name = common.get_binary_name( current_testcase.stacktrace_lines) binary_provider = binary_providers.DownloadedBinary( current_testcase.id, current_testcase.build_url, binary_name) else: binary_provider = definition.builder( # pylint: disable=redefined-variable-type current_testcase, definition, current, goma_dir) reproduce_crash(binary_provider.get_binary_path(), binary_provider.symbolizer_path, current_testcase, definition.sanitizer) maybe_warn_unreproducible(current_testcase)
def test_parameter_already_set(self): """Tests functionality when the build_directory parameter is already set.""" provider = binary_providers.DownloadedBinary(12345, self.build_url, 'd8') provider.build_directory = 'dir/already/set' result = provider.get_build_directory() self.assertEqual(result, 'dir/already/set') self.assert_n_calls(0, [self.mock.download_build_data])
def test_parameter_not_set(self): """Tests functionality when build has never been downloaded.""" provider = binary_providers.DownloadedBinary(12345, self.build_url, 'd8') build_dir = os.path.join(common.CLUSTERFUZZ_BUILDS_DIR, '12345_build') result = provider.get_build_directory() self.assertEqual(result, build_dir) self.assert_exact_calls(self.mock.download_build_data, [mock.call(provider)])
def test_call(self): """Tests calling the method.""" build_dir = os.path.expanduser(os.path.join('~', 'chrome_src', 'out', '12345_build')) self.mock.get_build_directory.return_value = build_dir provider = binary_providers.DownloadedBinary(12345, 'build_url', 'd8') result = provider.get_binary_path() self.assertEqual(result, os.path.join(build_dir, 'd8'))
def setUp(self): helpers.patch(self, [ 'clusterfuzz.binary_providers.download_build', 'clusterfuzz.common.get_source_directory' ]) self.build_url = 'https://storage.cloud.google.com/abc.zip' self.build_dir = os.path.join(common.CLUSTERFUZZ_BUILDS_DIR, '12345_build') self.provider = binary_providers.DownloadedBinary( 12345, self.build_url, 'd8') self.provider.source_directory = ''
def setUp(self): helpers.patch(self, [ 'clusterfuzz.binary_providers.download_build_if_needed', 'clusterfuzz.binary_providers.get_or_ask_for_source_location', 'clusterfuzz.binary_providers.BinaryProvider.get_binary_path', ]) self.definition = libs.make_definition(binary_name='d8') self.testcase = libs.make_testcase( testcase_id=12345, build_url='https://storage.cloud.google.com/abc.zip') self.provider = binary_providers.DownloadedBinary( testcase=self.testcase, definition=self.definition, options=libs.make_options())
def execute(testcase_id, current, build, disable_goma, j, iterations, disable_xvfb, target_args, edit_mode): """Execute the reproduce command.""" logger.info('----- START -----') logger.info('Reproducing testcase %s', testcase_id) logger.debug( ' testcase_id: %s\n current: %s\n build: %s\n disable_goma: %s', testcase_id, current, build, disable_goma) logger.info('Downloading testcase information...') response = get_testcase_info(testcase_id) current_testcase = testcase.Testcase(response) if 'gestures' in response['testcase']: logger.info( ('Warning: testcases using gestures are still in development ' 'and are not guaranteed to reproduce correctly.')) definition = get_binary_definition(current_testcase.job_type, build) maybe_warn_unreproducible(current_testcase) if build == 'download': if definition.binary_name: binary_name = definition.binary_name else: binary_name = common.get_binary_name( current_testcase.stacktrace_lines) binary_provider = binary_providers.DownloadedBinary( current_testcase.id, current_testcase.build_url, binary_name) else: goma_dir = None if disable_goma else ensure_goma() binary_provider = definition.builder( # pylint: disable=redefined-variable-type current_testcase, definition, current, goma_dir, j, edit_mode) reproducer = definition.reproducer(binary_provider, current_testcase, definition.sanitizer, disable_xvfb, target_args, edit_mode) try: reproducer.reproduce(iterations) finally: maybe_warn_unreproducible(current_testcase)
def execute(testcase_id, current, build, disable_goma, goma_threads, iterations, disable_xvfb, target_args, edit_mode, disable_gclient, enable_debug, goma_dir=None): """Execute the reproduce command.""" options = common.Options(testcase_id=testcase_id, current=current, build=build, disable_goma=disable_goma, goma_threads=goma_threads, iterations=iterations, disable_xvfb=disable_xvfb, target_args=target_args, edit_mode=edit_mode, disable_gclient=disable_gclient, enable_debug=enable_debug, goma_dir=goma_dir) logger.info('Reproducing testcase %s', testcase_id) logger.debug('%s', str(options)) logger.info('Downloading testcase information...') response = get_testcase_info(testcase_id) current_testcase = testcase.Testcase(response) if 'gestures' in response['testcase']: logger.info( common.colorize( 'Warning: the testcase is using gestures and inherently flaky. ' "Therefore, we cannot guaranteed that it'll reproduce correctly.", common.BASH_YELLOW_MARKER)) definition = get_definition(current_testcase.job_type, build) maybe_warn_unreproducible(current_testcase) if build == 'download': if definition.binary_name: binary_name = definition.binary_name else: binary_name = common.get_binary_name( current_testcase.stacktrace_lines) binary_provider = binary_providers.DownloadedBinary( testcase_id=current_testcase.id, build_url=current_testcase.build_url, binary_name=binary_name) else: options.goma_dir = None if options.disable_goma else ensure_goma() binary_provider = definition.builder(testcase=current_testcase, definition=definition, options=options) reproducer = definition.reproducer(definition=definition, binary_provider=binary_provider, testcase=current_testcase, sanitizer=definition.sanitizer, options=options) try: reproducer.reproduce(iterations) finally: maybe_warn_unreproducible(current_testcase)
def execute(testcase_id, current, build, disable_goma, goma_threads, goma_load, iterations, disable_xvfb, target_args, edit_mode, skip_deps, enable_debug, goma_dir=None): """Execute the reproduce command.""" options = common.Options(testcase_id=testcase_id, current=current, build=build, disable_goma=disable_goma, goma_threads=goma_threads, goma_load=goma_load, iterations=iterations, disable_xvfb=disable_xvfb, target_args=target_args, edit_mode=edit_mode, skip_deps=skip_deps, enable_debug=enable_debug, goma_dir=goma_dir) logger.info('Reproducing testcase %s', testcase_id) logger.debug('%s', str(options)) logger.info('Downloading testcase information...') response = get_testcase_info(testcase_id) current_testcase = testcase.Testcase(response) definition = get_definition(current_testcase.job_type, build) warn_unreproducible_if_needed(current_testcase) if build == 'download': if definition.binary_name: binary_name = definition.binary_name else: binary_name = common.get_binary_name( current_testcase.stacktrace_lines) binary_provider = binary_providers.DownloadedBinary( testcase_id=current_testcase.id, build_url=current_testcase.build_url, binary_name=binary_name) else: options.goma_dir = None if options.disable_goma else ensure_goma() binary_provider = definition.builder(testcase=current_testcase, definition=definition, options=options) reproducer = definition.reproducer(definition=definition, binary_provider=binary_provider, testcase=current_testcase, sanitizer=definition.sanitizer, options=options) try: reproducer.reproduce(iterations) finally: warn_unreproducible_if_needed(current_testcase)