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)
"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. port._display_server = options.display_server 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(