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 _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