def setup(cls): LLDB_WEBKIT_TESTER_NAME = 'lldbWebKitTester' BREAK_FOR_TESTING_FUNCTION_NAME = 'breakForTestingSummaryProviders' cls.sbDebugger = lldb.SBDebugger.Create() cls.sbDebugger.SetAsync(False) host = SystemHost() config = Config(host.executive, host.filesystem) cls.lldbWebKitTesterExecutable = os.path.join(config.build_directory(config.default_configuration()), LLDB_WEBKIT_TESTER_NAME) cls.sbTarget = cls.sbDebugger.CreateTarget(str(cls.lldbWebKitTesterExecutable)) assert cls.sbTarget cls.sbTarget.BreakpointCreateByName(BREAK_FOR_TESTING_FUNCTION_NAME, cls.sbTarget.GetExecutable().GetFilename()) argv = None envp = None cls.sbProcess = cls.sbTarget.LaunchSimple(argv, envp, os.getcwd()) assert cls.sbProcess assert cls.sbProcess.GetState() == lldb.eStateStopped cls.sbThread = cls.sbProcess.GetThreadAtIndex(0) assert cls.sbThread # Frame 0 is the function with name BREAK_FOR_TESTING_FUNCTION_NAME. We want the frame of the caller of # BREAK_FOR_TESTING_FUNCTION_NAME because it has all the interesting local variables we want to test. cls.sbFrame = cls.sbThread.GetFrameAtIndex(1) assert cls.sbFrame
def setUpClass(cls): global debugger_instance if not debugger_instance: LLDB_WEBKIT_TESTER_NAME = 'lldbWebKitTester' config = Config(_host.executive, _host.filesystem) lldbWebKitTesterExecutable = os.path.join( config.build_directory(config.default_configuration()), LLDB_WEBKIT_TESTER_NAME) architecture = 'x86_64' debugger_instance = LLDBDebuggerInstance( lldbWebKitTesterExecutable, architecture) if not debugger_instance: print 'Failed to create lldb debugger instance for %s' % ( lldbWebKitTesterExecutable)
def _build_lldb_webkit_tester(): if not _host.platform.is_mac(): _log.error('lldbWebKitTester is not supported on this platform.') return False config = Config(_host.executive, _host.filesystem) build_lldbwebkittester = os.path.join(_webkit_root, 'Tools', 'Scripts', 'build-lldbwebkittester') try: _host.executive.run_and_throw_if_fail([ build_lldbwebkittester, config.flag_for_configuration(config.default_configuration()) ], quiet=True) except ScriptError as e: _log.error(e.message_with_output(output_limit=None)) return False return True
def _run_tests(self, names, will_run_lldb_webkit_tests): # Make sure PYTHONPATH is set up properly. sys.path = self.finder.additional_paths(sys.path) + sys.path # We autoinstall everything up so that we can run tests concurrently # and not have to worry about autoinstalling packages concurrently. self.printer.write_update("Checking autoinstalled packages ...") from webkitpy.thirdparty import autoinstall_everything autoinstall_everything() start_time = time.time() config = Config(_host.executive, self.finder.filesystem) configuration_to_use = self._options.configuration or config.default_configuration( ) if will_run_lldb_webkit_tests: self.printer.write_update('Building lldbWebKitTester ...') build_lldbwebkittester = self.finder.filesystem.join( _webkit_root, 'Tools', 'Scripts', 'build-lldbwebkittester') try: _host.executive.run_and_throw_if_fail( [ build_lldbwebkittester, config.flag_for_configuration(configuration_to_use) ], quiet=(not bool(self._options.verbose))) except ScriptError as e: _log.error(e.message_with_output(output_limit=None)) return False os.environ['LLDB_WEBKIT_TESTER_EXECUTABLE'] = str( self.finder.filesystem.join( config.build_directory(configuration_to_use), 'lldbWebKitTester')) if not self.finder.filesystem.exists( os.environ['LLDB_WEBKIT_TESTER_EXECUTABLE']): _log.error('Failed to find lldbWebKitTester.') return False if self._options.coverage: _log.warning("Checking code coverage, so running things serially") self._options.child_processes = 1 import webkitpy.thirdparty.autoinstalled.coverage as coverage cov = coverage.coverage(omit=[ "/usr/*", "*/webkitpy/thirdparty/autoinstalled/*", "*/webkitpy/thirdparty/BeautifulSoup.py" ]) cov.start() self.printer.write_update("Checking imports ...") if not self._check_imports(names): return False self.printer.write_update("Finding the individual test methods ...") loader = _Loader() parallel_tests, serial_tests = self._test_names(loader, names) self.printer.write_update("Running the tests ...") self.printer.num_tests = len(parallel_tests) + len(serial_tests) start = time.time() test_runner = Runner(self.printer, loader) test_runner.run(parallel_tests, self._options.child_processes) test_runner.run(serial_tests, 1) end_time = time.time() self.printer.print_result(time.time() - start) if self._options.json: _print_results_as_json( sys.stdout, itertools.chain(parallel_tests, serial_tests), test_runner.failures, test_runner.errors) if self._options.json_file_name: self._options.json_file_name = os.path.abspath( self._options.json_file_name) with open(self._options.json_file_name, 'w') as json_file: _print_results_as_json( json_file, itertools.chain(parallel_tests, serial_tests), test_runner.failures, test_runner.errors) if self._options.coverage: cov.stop() cov.save() failed_uploads = 0 if self._options.report_urls: self.printer.meter.writeln('\n') self.printer.write_update('Preparing upload data ...') # Empty test results indicate a PASS. results = {test: {} for test in test_runner.tests_run} for test, errors in test_runner.errors: results[test] = Upload.create_test_result( actual=Upload.Expectations.ERROR, log='/n'.join(errors)) for test, failures in test_runner.failures: results[test] = Upload.create_test_result( actual=Upload.Expectations.FAIL, log='/n'.join(failures)) _host.initialize_scm() upload = Upload( suite='webkitpy-tests', configuration=Upload.create_configuration( platform=_host.platform.os_name, version=str(_host.platform.os_version), version_name=_host.platform.os_version_name(), style='asan' if config.asan else configuration_to_use.lower(), sdk=_host.platform.build_version(), flavor=self._options.result_report_flavor, ), details=Upload.create_details(options=self._options), commits=[ Upload.create_commit( repository_id='webkit', id=_host.scm().native_revision(_webkit_root), branch=_host.scm().native_branch(_webkit_root), ) ], run_stats=Upload.create_run_stats( start_time=start_time, end_time=end_time, tests_skipped=len(test_runner.tests_run) - len(parallel_tests) - len(serial_tests), ), results=results, ) for url in self._options.report_urls: self.printer.write_update('Uploading to {} ...'.format(url)) failed_uploads = failed_uploads if upload.upload( url, log_line_func=self.printer.meter.writeln) else ( failed_uploads + 1) self.printer.meter.writeln('Uploads completed!') if self._options.coverage: cov.report(show_missing=False) return not self.printer.num_errors and not self.printer.num_failures and not failed_uploads
def __init__(self, *args, **kwargs): super(IPadSimulatorPort, self).__init__(*args, **kwargs) self._config = Config(self._executive, self._filesystem, IOSSimulatorPort.port_name)
def __init__(self, *args, **kwargs): super(MacCatalystPort, self).__init__(*args, **kwargs) self._config = Config(self._executive, self._filesystem, MacCatalystPort.port_name)
def _run_tests(self, names, will_run_lldb_webkit_tests): # Make sure PYTHONPATH is set up properly. sys.path = self.finder.additional_paths(sys.path) + sys.path # We autoinstall everything up so that we can run tests concurrently # and not have to worry about autoinstalling packages concurrently. self.printer.write_update("Checking autoinstalled packages ...") from webkitpy.thirdparty import autoinstall_everything autoinstall_everything() if will_run_lldb_webkit_tests: self.printer.write_update('Building lldbWebKitTester ...') build_lldbwebkittester = self.finder.filesystem.join( _webkit_root, 'Tools', 'Scripts', 'build-lldbwebkittester') config = Config(_host.executive, self.finder.filesystem) configuration_to_use = self._options.configuration or config.default_configuration( ) try: _host.executive.run_and_throw_if_fail( [ build_lldbwebkittester, config.flag_for_configuration(configuration_to_use) ], quiet=(not bool(self._options.verbose))) except ScriptError as e: _log.error(e.message_with_output(output_limit=None)) return False os.environ['LLDB_WEBKIT_TESTER_EXECUTABLE'] = str( self.finder.filesystem.join( config.build_directory(configuration_to_use), 'lldbWebKitTester')) if not self.finder.filesystem.exists( os.environ['LLDB_WEBKIT_TESTER_EXECUTABLE']): _log.error('Failed to find lldbWebKitTester.') return False if self._options.coverage: _log.warning("Checking code coverage, so running things serially") self._options.child_processes = 1 import webkitpy.thirdparty.autoinstalled.coverage as coverage cov = coverage.coverage(omit=[ "/usr/*", "*/webkitpy/thirdparty/autoinstalled/*", "*/webkitpy/thirdparty/BeautifulSoup.py" ]) cov.start() self.printer.write_update("Checking imports ...") if not self._check_imports(names): return False self.printer.write_update("Finding the individual test methods ...") loader = _Loader() parallel_tests, serial_tests = self._test_names(loader, names) self.printer.write_update("Running the tests ...") self.printer.num_tests = len(parallel_tests) + len(serial_tests) start = time.time() test_runner = Runner(self.printer, loader) test_runner.run(parallel_tests, self._options.child_processes) test_runner.run(serial_tests, 1) self.printer.print_result(time.time() - start) if self._options.json: _print_results_as_json( sys.stdout, itertools.chain(parallel_tests, serial_tests), test_runner.failures, test_runner.errors) if self._options.json_file_name: self._options.json_file_name = os.path.abspath( self._options.json_file_name) with open(self._options.json_file_name, 'w') as json_file: _print_results_as_json( json_file, itertools.chain(parallel_tests, serial_tests), test_runner.failures, test_runner.errors) if self._options.coverage: cov.stop() cov.save() cov.report(show_missing=False) return not self.printer.num_errors and not self.printer.num_failures