def _run_tests(self, names): # 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 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
def _run_tests(self, dirs, args): if self._options.coverage: try: import webkitpy.thirdparty.autoinstalled.coverage as coverage except ImportError, e: _log.error("Failed to import 'coverage'; can't generate coverage numbers.") return False cov = coverage.coverage() cov.start()
def _run_tests(self, names): if self._options.coverage: try: import webkitpy.thirdparty.autoinstalled.coverage as coverage except ImportError, e: _log.error( "Failed to import 'coverage'; can't generate coverage numbers." ) return False cov = coverage.coverage() cov.start()
def _run_tests(self, names): # 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 installed_something = autoinstall_everything() # FIXME: There appears to be a bug in Python 2.6.1 that is causing multiprocessing # to hang after we install the packages in a clean checkout. if installed_something: _log.warning( "We installed new packages, so running things serially at first" ) self._options.child_processes = 1 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.coverage: cov.stop() cov.save() cov.report(show_missing=False) return not self.printer.num_errors and not self.printer.num_failures
def _run_tests(self, names): # 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 installed_something = autoinstall_everything() # FIXME: There appears to be a bug in Python 2.6.1 that is causing multiprocessing # to hang after we install the packages in a clean checkout. if installed_something: _log.warning("We installed new packages, so running things serially at first") self._options.child_processes = 1 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.coverage: cov.stop() cov.save() cov.report(show_missing=False) return not self.printer.num_errors and not self.printer.num_failures
def _run_tests(self, names): # 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 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.coverage: cov.stop() cov.save() cov.report(show_missing=False) return not self.printer.num_errors and not self.printer.num_failures
def _run_tests(self, names): if self._options.coverage: try: import webkitpy.thirdparty.autoinstalled.coverage as coverage except ImportError: _log.error( "Failed to import 'coverage'; can't generate coverage numbers." ) return False cov = coverage.coverage() cov.start() # Make sure PYTHONPATH is set up properly. sys.path = self.finder.additional_paths(sys.path) + sys.path _log.debug("Loading the tests...") loader = unittest.defaultTestLoader suites = [] for name in names: if self.finder.is_module(name): # if we failed to load a name and it looks like a module, # try importing it directly, because loadTestsFromName() # produces lousy error messages for bad modules. try: __import__(name) except ImportError: _log.fatal('Failed to import %s:' % name) self._log_exception() return False suites.append(loader.loadTestsFromName(name, None)) test_suite = unittest.TestSuite(suites) test_runner = Runner(self.printer, self._options, loader) _log.debug("Running the tests.") result = test_runner.run(test_suite) if self._options.coverage: cov.stop() cov.save() cov.report(show_missing=False) return result.wasSuccessful()
def _run_tests(self, names): # 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() if getattr(self._options, 'coverage', False): _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", "*/webkitpy/thirdparty/BeautifulSoup_legacy.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, getattr(self._options, 'child_processes', 1)) test_runner.run(serial_tests, 1) end_time = time.time() self.printer.print_result(time.time() - start) if getattr(self._options, 'json', False): _print_results_as_json( sys.stdout, itertools.chain(parallel_tests, serial_tests), test_runner.failures, test_runner.errors) if getattr(self._options, 'json_file_name', None): 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 getattr(self._options, 'coverage', False): cov.stop() cov.save() failed_uploads = 0 if getattr(self._options, 'report_urls', None): 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=self.upload_style, 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 getattr(self._options, 'coverage', False): 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() 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