def main(): global _webkit_root configure_logging(logger=_log) up = os.path.dirname _webkit_root = up(up(up(up(up(os.path.abspath(__file__)))))) tester = Tester() tester.add_tree(os.path.join(_webkit_root, 'Tools', 'Scripts'), 'webkitpy') tester.add_tree( os.path.join(_webkit_root, 'Tools', 'Scripts', 'libraries', 'webkitcorepy'), 'webkitcorepy') tester.add_tree( os.path.join(_webkit_root, 'Tools', 'Scripts', 'libraries', 'webkitscmpy'), 'webkitscmpy') # There is no WebKit2 on Windows, so we don't need to run WebKit2 unittests on it. if not (sys.platform.startswith('win') or sys.platform == 'cygwin'): tester.add_tree( os.path.join(_webkit_root, 'Source', 'WebKit', 'Scripts'), 'webkit') tester.skip(('webkitpy.common.checkout.scm.scm_unittest', ), 'are really, really, slow', 31818) if sys.platform.startswith('win'): tester.skip(('webkitpy.common.checkout', 'webkitpy.common.config', 'webkitpy.tool'), 'fail horribly on win32', 54526) return not tester.run()
def main(): global _webkit_root configure_logging(logger=_log) up = os.path.dirname _webkit_root = up(up(up(up(up(os.path.abspath(__file__)))))) tester = Tester() tester.add_tree(os.path.join(_webkit_root, 'Tools', 'Scripts'), 'webkitpy') # There is no WebKit2 on Windows, so we don't need to run WebKit2 unittests on it. if not (sys.platform.startswith('win') or sys.platform == 'cygwin'): tester.add_tree( os.path.join(_webkit_root, 'Source', 'WebKit', 'Scripts'), 'webkit') lldb_python_directory = _host.path_to_lldb_python_directory() if not _supports_building_and_running_lldb_tests(): _log.info( "Skipping lldb_webkit tests; not yet supported on macOS Catalina.") will_run_lldb_webkit_tests = False elif not os.path.isdir(lldb_python_directory): _log.info( "Skipping lldb_webkit tests; could not find path to lldb.py '{}'.". format(lldb_python_directory)) will_run_lldb_webkit_tests = False else: if lldb_python_directory not in sys.path: sys.path.append(lldb_python_directory) tester.add_tree(os.path.join(_webkit_root, 'Tools', 'lldb')) will_run_lldb_webkit_tests = True tester.skip(('webkitpy.common.checkout.scm.scm_unittest', ), 'are really, really, slow', 31818) if sys.platform.startswith('win'): tester.skip(('webkitpy.common.checkout', 'webkitpy.common.config', 'webkitpy.tool'), 'fail horribly on win32', 54526) # This only needs to run on Unix, so don't worry about win32 for now. appengine_sdk_path = '/usr/local/google_appengine' if os.path.exists(appengine_sdk_path): if not appengine_sdk_path in sys.path: sys.path.append(appengine_sdk_path) import dev_appserver from google.appengine.dist import use_library use_library('django', '1.2') dev_appserver.fix_sys_path() tester.add_tree( os.path.join(_webkit_root, 'Tools', 'QueueStatusServer')) else: _log.info( 'Skipping QueueStatusServer tests; the Google AppEngine Python SDK is not installed.' ) return not tester.run( will_run_lldb_webkit_tests=will_run_lldb_webkit_tests)
def main(script_name, argv): options, args = parse_args(argv) configure_logging(logging.DEBUG if options.verbose else logging.INFO) # Determine Port for the specified platform. host = Host() try: port = host.port_factory.get(options.platform, options) except NotImplementedError, e: _log.error(str(e)) sys.exit(-1)
def main(script_name, argv): options, args = parse_args(argv) configure_logging(logging.DEBUG if options.verbose else logging.INFO) # Determine Port for the specified platform. host = Host() try: port = host.port_factory.get(options.platform, options) except NotImplementedError as e: _log.error(str(e)) sys.exit(-1) runner = WPTRunner(port, port.host, script_name, options) # If necessary, inject the jhbuild wrapper or re-run in flatpak sandbox. if port.name() in ['gtk', 'wpe']: filesystem = host.filesystem top_level_directory = filesystem.normpath(filesystem.join(filesystem.dirname(__file__), '..', '..', '..', '..')) sys.path.insert(0, filesystem.join(top_level_directory, 'Tools', 'flatpak')) import flatpakutils if not flatpakutils.is_sandboxed() and flatpakutils.check_flatpak(verbose=False): flatpak_runner = flatpakutils.WebkitFlatpak.load_from_args(sys.argv) if flatpak_runner.clean_args() and flatpak_runner.has_environment(): if not runner.prepare_wpt_checkout(): sys.exit(1) hostfilename = os.path.join(flatpak_runner.build_path, "wpt_etc_hosts") with open(hostfilename, "w") as stdout: flatpak_runner.run_in_sandbox(os.path.join(options.wpt_checkout, "wpt"), "make-hosts-file", stdout=stdout) sys.exit(flatpak_runner.run_in_sandbox(*sys.argv, extra_flatpak_args=['--bind-mount=/etc/hosts=%s' % hostfilename])) sys.path.insert(0, filesystem.join(top_level_directory, 'Tools', 'jhbuild')) import jhbuildutils if not flatpakutils.is_sandboxed() and not jhbuildutils.enter_jhbuild_environment_if_available(port.name()): _log.warning('jhbuild environment not present. Run update-webkitgtk-libs before build-webkit to ensure proper testing.') # Create the Port-specific driver. display_driver = port.create_driver(worker_number=0, no_timeout=True)._make_driver(pixel_tests=False) if not display_driver.check_driver(port): raise RuntimeError("Failed to check driver %s" % display_driver.__class__.__name__) os.environ.update(display_driver._setup_environ_for_test()) if not options.child_processes: options.child_processes = os.environ.get("WEBKIT_TEST_CHILD_PROCESSES", str(port.default_child_processes())) if not runner.run(args): sys.exit(1)
def clean_args(self): if self.user_repo: os.environ["FLATPAK_USER_DIR"] = FLATPAK_USER_DIR_PATH + ".Local" else: os.environ["FLATPAK_USER_DIR"] = os.environ.get( "WEBKIT_FLATPAK_USER_DIR", FLATPAK_USER_DIR_PATH) self.flatpak_build_path = os.environ["FLATPAK_USER_DIR"] try: os.makedirs(self.flatpak_build_path) except OSError as e: pass configure_logging(logging.DEBUG if self.verbose else logging.INFO) _log.debug("Using flatpak user dir: %s" % self.flatpak_build_path) if not self.debug and not self.release: factory = PortFactory(SystemHost()) port = factory.get(self.platform) self.debug = port.default_configuration() == "Debug" self.build_type = "Debug" if self.debug else "Release" self.platform = self.platform.upper() if self.gdb is None and '--gdb' in sys.argv: self.gdb = True self.build_root = os.path.join(self.source_root, 'WebKitBuild') self.build_path = os.path.join(self.build_root, self.platform, self.build_type) self.config_file = os.path.join(self.flatpak_build_path, 'webkit_flatpak_config.json') Console.quiet = self.quiet if not check_flatpak(): return False self._reset_repository() try: with open(self.config_file) as config: json_config = json.load(config) self.icc_version = json_config['icecc_version'] except IOError as e: pass return True
def main(): global _webkit_root configure_logging(logger=_log) up = os.path.dirname _webkit_root = up(up(up(up(up(os.path.abspath(__file__)))))) tester = Tester() tester.add_tree(os.path.join(_webkit_root, 'Tools', 'Scripts'), 'webkitpy') # There is no WebKit2 on Windows, so we don't need to run WebKit2 unittests on it. if not (sys.platform.startswith('win') or sys.platform == 'cygwin'): tester.add_tree( os.path.join(_webkit_root, 'Source', 'WebKit', 'Scripts'), 'webkit') tester.skip(('webkitpy.common.checkout.scm.scm_unittest', ), 'are really, really, slow', 31818) if sys.platform.startswith('win'): tester.skip(('webkitpy.common.checkout', 'webkitpy.common.config', 'webkitpy.tool'), 'fail horribly on win32', 54526) # This only needs to run on Unix, so don't worry about win32 for now. appengine_sdk_path = '/usr/local/google_appengine' if os.path.exists(appengine_sdk_path): if not appengine_sdk_path in sys.path: sys.path.append(appengine_sdk_path) import dev_appserver from google.appengine.dist import use_library use_library('django', '1.2') dev_appserver.fix_sys_path() tester.add_tree( os.path.join(_webkit_root, 'Tools', 'QueueStatusServer')) else: _log.info( 'Skipping QueueStatusServer tests; the Google AppEngine Python SDK is not installed.' ) return not tester.run()
def setUp(self): log_stream = TestLogStream(self) # Use a logger other than the root logger or one prefixed with # "webkitpy." so as not to conflict with test-webkitpy logging. logger = logging.getLogger("unittest") # Configure the test logger not to pass messages along to the # root logger. This prevents test messages from being # propagated to loggers used by test-webkitpy logging (e.g. # the root logger). logger.propagate = False logging_level = self._logging_level() self._handlers = configure_logging(logging_level=logging_level, logger=logger, stream=log_stream) self._log = logger self._log_stream = log_stream
def setUp(self): log_stream = TestLogStream(self) # Use a logger other than the root logger or one prefixed with # "webkitpy." so as not to conflict with test-webkitpy logging. logger = logging.getLogger("unittest") # Configure the test logger not to pass messages along to the # root logger. This prevents test messages from being # propagated to loggers used by test-webkitpy logging (e.g. # the root logger). logger.propagate = False logging_level = self._logging_level() self._handlers = logutils.configure_logging( logging_level=logging_level, logger=logger, stream=log_stream) self._log = logger self._log_stream = log_stream
def clean_args(self): configure_logging(logging.DEBUG if self.verbose else logging.INFO) if not self.debug and not self.release: factory = PortFactory(SystemHost()) port = factory.get(self.platform) self.debug = port.default_configuration() == "Debug" self.build_type = "Debug" if self.debug else "Release" self.platform = self.platform.upper() if self.gdb is None and '--gdb' in sys.argv: self.gdb = "" self.command = "%s %s %s" % (os.path.join( self.sandbox_source_root, "Tools/Scripts/run-minibrowser"), "--" + self.platform.lower(), " --debug" if self.debug else " --release") self.name = "org.webkit.%s" % self.platform self.manifest_path = os.path.abspath( os.path.join(scriptdir, '../flatpak/org.webkit.WebKit.yaml')) self.build_name = self.name + "-generated" build_root = os.path.join(self.source_root, 'WebKitBuild') self.flatpak_build_path = os.path.join(build_root, self.platform, "FlatpakTree" + self.build_type) self.cache_path = os.path.join(build_root, "FlatpakCache") self.build_path = os.path.join(build_root, self.platform, self.build_type) try: os.makedirs(self.build_path) except OSError as e: if e.errno != errno.EEXIST: raise e Console.quiet = self.quiet if not check_flatpak(): return False repos = FlatpakRepos() self.sdk_repo = repos.add( FlatpakRepo( "flathub", url="https://dl.flathub.org/repo/", repo_file="https://dl.flathub.org/repo/flathub.flatpakrepo")) manifest = load_manifest(self.manifest_path) if not manifest: return False self.sdk_branch = manifest["runtime-version"] self.finish_args = manifest.get("finish-args", []) self.finish_args = remove_extension_points(self.finish_args) self.runtime = FlatpakPackage("org.gnome.Platform", self.sdk_branch, self.sdk_repo, "x86_64", hash=manifest.get("runtime-hash"), assumeyes=self.assumeyes) self.locale = FlatpakPackage("org.gnome.Platform.Locale", self.sdk_branch, self.sdk_repo, "x86_64", assumeyes=self.assumeyes) self.sdk = FlatpakPackage("org.gnome.Sdk", self.sdk_branch, self.sdk_repo, "x86_64", hash=manifest.get("sdk-hash"), assumeyes=self.assumeyes) self.packs = [self.runtime, self.locale, self.sdk] if self.debug: self.sdk_debug = FlatpakPackage("org.gnome.Sdk.Debug", self.sdk_branch, self.sdk_repo, "x86_64", assumeyes=self.assumeyes) self.packs.append(self.sdk_debug) self.manifest_generated_path = os.path.join(self.cache_path, self.build_name + ".json") return True
def clean_args(self): os.environ["FLATPAK_USER_DIR"] = os.environ.get("WEBKIT_FLATPAK_USER_DIR", os.path.realpath(os.path.join(scriptdir, "../../WebKitBuild", "UserFlatpak"))) try: os.makedirs(os.environ["FLATPAK_USER_DIR"]) except OSError as e: pass configure_logging(logging.DEBUG if self.verbose else logging.INFO) _log.debug("Using flatpak user dir: %s" % os.environ["FLATPAK_USER_DIR"]) if not self.debug and not self.release: factory = PortFactory(SystemHost()) port = factory.get(self.platform) self.debug = port.default_configuration() == "Debug" self.build_type = "Debug" if self.debug else "Release" self.platform = self.platform.upper() if self.gdb is None and '--gdb' in sys.argv: self.gdb = "" self.command = "%s %s %s" % (os.path.join(self.sandbox_source_root, "Tools/Scripts/run-minibrowser"), "--" + self.platform.lower(), " --debug" if self.debug else " --release") self.name = "org.webkit.%s" % self.platform if self.wpe_extension: manifest_filename = WPE_MANIFEST_MAP[self.wpe_extension] else: manifest_filename = "org.webkit.WebKit.yaml" self.manifest_path = os.path.abspath(os.path.join(scriptdir, '../flatpak/') + manifest_filename) self.build_name = self.name + "-generated" build_root = os.path.join(self.source_root, 'WebKitBuild') self.flatpak_build_path = os.path.join(build_root, self.platform, "FlatpakTree" + self.build_type) self.cache_path = os.path.join(build_root, "FlatpakCache") self.build_path = os.path.join(build_root, self.platform, self.build_type) try: os.makedirs(self.build_path) except OSError as e: if e.errno != errno.EEXIST: raise e self.config_file = os.path.join(self.build_path, 'webkit_flatpak_config.json') Console.quiet = self.quiet if not check_flatpak(): return False repos = FlatpakRepos() self.sdk_repo = repos.add( FlatpakRepo("flathub", url="https://dl.flathub.org/repo/", repo_file="https://dl.flathub.org/repo/flathub.flatpakrepo")) manifest = load_manifest(self.manifest_path, port_name=self.name) if not manifest: return False self.app = manifest['app-id'] self.sdk_branch = manifest["runtime-version"] self.finish_args = manifest.get("finish-args", []) self.finish_args = remove_extension_points(self.finish_args) self.runtime = FlatpakPackage(manifest['runtime'], self.sdk_branch, self.sdk_repo, "x86_64", hash=manifest.get("runtime-hash")) self.locale = FlatpakPackage(manifest['runtime'] + '.Locale', self.sdk_branch, self.sdk_repo, "x86_64") self.sdk = FlatpakPackage(manifest['sdk'], self.sdk_branch, self.sdk_repo, "x86_64", hash=manifest.get("sdk-hash")) self.packs = [self.runtime, self.locale, self.sdk] if self.debug: self.sdk_debug = FlatpakPackage(manifest['sdk'] + '.Debug', self.sdk_branch, self.sdk_repo, "x86_64") self.packs.append(self.sdk_debug) self.manifest_generated_path = os.path.join(self.cache_path, self.build_name + ".json") try: with open(self.config_file) as config: json_config = json.load(config) self.icc_version = json_config['icecc_version'] except IOError as e: pass return True
def load_from_args(args=None, add_help=True): self = WebkitFlatpak() parser = argparse.ArgumentParser(prog="webkit-flatpak", add_help=add_help) general = parser.add_argument_group("General") general.add_argument('--verbose', action='store_true', help='Show debug messages') general.add_argument('--version', action='store_true', help='Show SDK version', dest="show_version") type_group = parser.add_mutually_exclusive_group() type_group.add_argument("--debug", help="Compile with Debug configuration, also installs Sdk debug symbols.", dest='build_type', action="store_const", const="Debug") type_group.add_argument("--release", help="Compile with Release configuration.", dest='build_type', action="store_const", const="Release") general.add_argument('--gtk', action='store_const', dest='platform', const='gtk', help='Setup build directory for the GTK port') general.add_argument('--wpe', action='store_const', dest='platform', const='wpe', help=('Setup build directory for the WPE port')) general.add_argument("-u", "--update", dest="update", action="store_true", help="Update the SDK") general.add_argument("-bgst", "--build-gst", dest="build_gst", action="store_true", help="Force rebuilding gst-build, repository path is defined by the `GST_BUILD_PATH` environment variable.") general.add_argument("-q", "--quiet", dest="quiet", action="store_true", help="Do not print anything") general.add_argument("-c", "--command", nargs=argparse.REMAINDER, help="The command to run in the sandbox", dest="user_command") general.add_argument('--available', action='store_true', dest="check_available", help='Check if required dependencies are available.'), general.add_argument("--repo", help="Filesystem absolute path to the Flatpak repository to use", dest="user_repo") distributed_build_options = parser.add_argument_group("Distributed building") distributed_build_options.add_argument("--use-icecream", dest="use_icecream", help="Use the distributed icecream (icecc) compiler.", action="store_true") distributed_build_options.add_argument("-r", "--regenerate-toolchains", dest="regenerate_toolchains", action="store_true", help="Regenerate IceCC/SCCache standalone toolchain archives") distributed_build_options.add_argument("-t", "--sccache-token", dest="sccache_token", help="sccache authentication token") distributed_build_options.add_argument("-s", "--sccache-scheduler", dest="sccache_scheduler", help="sccache scheduler URL (default: %s)" % DEFAULT_SCCACHE_SCHEDULER) debugoptions = parser.add_argument_group("Debugging") debugoptions.add_argument("--gdb", nargs="?", help="Activate gdb, passing extra args to it if wanted.") debugoptions.add_argument("--gdb-stack-trace", dest="gdb_stack_trace", nargs="?", help="Dump the stacktrace to stdout. The argument is a timestamp to be parsed by coredumpctl.") debugoptions.add_argument("-m", "--coredumpctl-matches", default="", help='Arguments to pass to gdb.') buildoptions = parser.add_argument_group("Extra build arguments") buildoptions.add_argument("--cmakeargs", help="One or more optional CMake flags (e.g. --cmakeargs=\"-DFOO=bar -DCMAKE_PREFIX_PATH=/usr/local\")") _, self.args = parser.parse_known_args(args=args, namespace=self) if not self.build_type: self.build_type = "Release" if os.environ.get('CCACHE_PREFIX') == 'icecc': self.use_icecream = True verbose = os.environ.get('WEBKIT_FLATPAK_SDK_VERBOSE') if (not self.verbose) and (verbose is not None): self.verbose = verbose != '0' configure_logging(logging.DEBUG if self.verbose else logging.INFO) if self.user_repo: if not os.path.exists(self.user_repo): _log.error('User repo at %s is not accessible\n' % self.user_repo) sys.exit(1) return self
def main(): global _webkit_root configure_logging(logger=_log) up = os.path.dirname _webkit_root = up(up(up(up(up(os.path.abspath(__file__)))))) tester = Tester() tester.add_tree(os.path.join(_webkit_root, 'Tools', 'Scripts'), 'webkitpy') tester.add_tree( os.path.join(_webkit_root, 'Tools', 'Scripts', 'libraries', 'webkitcorepy'), 'webkitcorepy') tester.add_tree( os.path.join(_webkit_root, 'Tools', 'Scripts', 'libraries', 'webkitscmpy'), 'webkitscmpy') tester.add_tree( os.path.join(_webkit_root, 'Tools', 'Scripts', 'libraries', 'webkitflaskpy'), 'webkitflaskpy') # AppleWin is the only platform that does not support Modern WebKit # FIXME: Find a better way to detect this currently assuming cygwin means AppleWin if sys.platform != 'cygwin': tester.add_tree( os.path.join(_webkit_root, 'Source', 'WebKit', 'Scripts'), 'webkit') tester.skip(('webkitpy.common.checkout.scm.scm_unittest', ), 'are really, really, slow', 31818) if sys.platform.startswith('win'): tester.skip(('webkitpy.common.checkout', 'webkitpy.tool'), 'fail horribly on win32', 54526) # Tests that are platform specific mac_only_tests = ( 'webkitpy.xcode', 'webkitpy.port.ios_device_unittest', 'webkitpy.port.ios_simulator_unittest', 'webkitpy.port.mac_unittest', 'webkitpy.port.watch_simulator_unittest', ) linux_only_tests = ( 'webkitpy.port.gtk_unittest', 'webkitpy.port.headlessdriver_unittest', 'webkitpy.port.linux_get_crash_log_unittest', 'webkitpy.port.waylanddriver_unittest', 'webkitpy.port.westondriver_unittest', 'webkitpy.port.wpe_unittest', 'webkitpy.port.xorgdriver_unittest', 'webkitpy.port.xvfbdriver_unittest', ) windows_only_tests = ('webkitpy.port.win_unittest', ) # Skip platform specific tests on Windows and Linux # The webkitpy EWS is run on Mac so only skip tests that won't run on it if sys.platform.startswith('darwin'): skip_tests = None elif sys.platform.startswith('win'): skip_tests = mac_only_tests + linux_only_tests + \ ('webkitpy.port.leakdetector_unittest', 'webkitpy.port.leakdetector_valgrind_unittest') else: skip_tests = mac_only_tests + windows_only_tests if skip_tests is not None: tester.skip(skip_tests, 'are not relevant for the platform running tests', 222066) return not tester.run()
def clean_args(self): os.environ["FLATPAK_USER_DIR"] = os.environ.get( "WEBKIT_FLATPAK_USER_DIR", FLATPAK_USER_DIR_PATH) try: os.makedirs(os.environ["FLATPAK_USER_DIR"]) except OSError as e: pass configure_logging(logging.DEBUG if self.verbose else logging.INFO) _log.debug("Using flatpak user dir: %s" % os.environ["FLATPAK_USER_DIR"]) if not self.debug and not self.release: factory = PortFactory(SystemHost()) port = factory.get(self.platform) self.debug = port.default_configuration() == "Debug" self.build_type = "Debug" if self.debug else "Release" self.platform = self.platform.upper() if self.gdb is None and '--gdb' in sys.argv: self.gdb = True self.command = "%s %s %s" % (os.path.join( self.sandbox_source_root, "Tools/Scripts/run-minibrowser"), "--" + self.platform.lower(), " --debug" if self.debug else " --release") self.flatpak_build_path = os.environ["FLATPAK_USER_DIR"] build_root = os.path.join(self.source_root, 'WebKitBuild') self.build_path = os.path.join(build_root, self.platform, self.build_type) try: os.makedirs(self.build_path) except OSError as e: if e.errno != errno.EEXIST: raise e self.config_file = os.path.join(self.flatpak_build_path, 'webkit_flatpak_config.json') Console.quiet = self.quiet if not check_flatpak(): return False self.finish_args = [] self.repos = FlatpakRepos() self.sdk_repo = self.repos.add( FlatpakRepo( "webkit-sdk", url="https://software.igalia.com/webkit-sdk-repo/", repo_file= "https://software.igalia.com/flatpak-refs/webkit-sdk.flatpakrepo" )) try: with open(self.config_file) as config: json_config = json.load(config) self.icc_version = json_config['icecc_version'] except IOError as e: pass return True