Пример #1
0
    def __init__(self, new_path, filename, reference_support_info, host=Host(), convert_test_harness_links=True, webkit_test_runner_options=''):
        HTMLParser.__init__(self)

        self._host = host
        self._filesystem = self._host.filesystem
        self._webkit_root = WebKitFinder(self._filesystem).webkit_base()

        self.converted_data = []
        self.converted_properties = []
        self.converted_property_values = []
        self.in_style_tag = False
        self.style_data = []
        self.filename = filename
        self.reference_support_info = reference_support_info
        self.webkit_test_runner_options = webkit_test_runner_options
        self.has_started = False

        resources_path = self.path_from_webkit_root('LayoutTests', 'resources')
        resources_relpath = self._filesystem.relpath(resources_path, new_path)
        self.new_test_harness_path = resources_relpath
        self.convert_test_harness_links = convert_test_harness_links

        # These settings might vary between WebKit and Blink
        css_property_file = self.path_from_webkit_root('Source', 'WebCore', 'css', 'CSSProperties.json')
        css_property_value_file = self.path_from_webkit_root('Source', 'WebCore', 'css', 'CSSValueKeywords.in')

        self.test_harness_re = re.compile('/resources/testharness')

        self.prefixed_properties = self.read_webkit_prefixed_css_property_list(css_property_file)
        prop_regex = '([\s{]|^)(' + "|".join(prop.replace('-webkit-', '') for prop in self.prefixed_properties) + ')(\s+:|:)'
        self.prop_re = re.compile(prop_regex)

        self.prefixed_property_values = self.legacy_read_webkit_prefixed_css_property_list(css_property_value_file)
        prop_value_regex = '(:\s*|^\s*)(' + "|".join(value.replace('-webkit-', '') for value in self.prefixed_property_values) + ')(\s*;|\s*}|\s*$)'
        self.prop_value_re = re.compile(prop_value_regex)
Пример #2
0
    def __init__(self, host, source_repo_path, dest_dir_name='external'):
        """Initializes variables to prepare for copying and converting files.

        Args:
            host: An instance of Host.
            source_repo_path: Path to the local checkout of a
                web-platform-tests or csswg-test repository.
            dest_dir_name: The name of the directory under the layout tests
                directory where imported tests should be copied to.
                TODO(qyearsley): This can be made into a constant.
        """
        self.host = host

        assert self.host.filesystem.exists(source_repo_path)
        self.source_repo_path = source_repo_path
        self.dest_dir_name = dest_dir_name

        self.filesystem = self.host.filesystem
        self.webkit_finder = WebKitFinder(self.filesystem)
        self._webkit_root = self.webkit_finder.webkit_base()
        self.layout_tests_dir = self.webkit_finder.path_from_webkit_base('LayoutTests')
        self.destination_directory = self.filesystem.normpath(
            self.filesystem.join(
                self.layout_tests_dir,
                dest_dir_name,
                self.filesystem.basename(self.source_repo_path)))
        self.import_in_place = (self.source_repo_path == self.destination_directory)
        self.dir_above_repo = self.filesystem.dirname(self.source_repo_path)
        self.is_wpt = self.filesystem.basename(self.source_repo_path) == 'wpt'

        self.import_list = []

        # This is just a FYI list of CSS properties that still need to be prefixed,
        # which may be output after importing.
        self._prefixed_properties = {}
Пример #3
0
    def __init__(self, host, source_repo_path, dest_dir_name='external'):
        """Initializes variables to prepare for copying and converting files.

        Args:
            source_repo_path: Path to the local checkout of a WPT
        """
        self.host = host

        assert self.host.filesystem.exists(source_repo_path)
        self.source_repo_path = source_repo_path
        self.dest_dir_name = dest_dir_name

        self.filesystem = self.host.filesystem
        self.webkit_finder = WebKitFinder(self.filesystem)
        self._webkit_root = self.webkit_finder.webkit_base()
        self.layout_tests_dir = self.webkit_finder.path_from_webkit_base(
            'LayoutTests')
        self.destination_directory = self.filesystem.normpath(
            self.filesystem.join(
                self.layout_tests_dir, dest_dir_name,
                self.filesystem.basename(self.source_repo_path)))
        self.import_in_place = (
            self.source_repo_path == self.destination_directory)
        self.dir_above_repo = self.filesystem.dirname(self.source_repo_path)

        self.import_list = []

        # This is just a FYI list of CSS properties that still need to be prefixed,
        # which may be output after importing.
        self._prefixed_properties = {}
Пример #4
0
    def __init__(self,
                 host,
                 bugzilla_id,
                 is_bug_id=True,
                 is_attachment_platform_specific=False,
                 attachment_fetcher=bugzilla.Bugzilla(),
                 unzip=None):
        self.host = host
        self.filesystem = self.host.filesystem
        self.unzip = unzip if unzip else lambda content: zipfile.ZipFile(
            io.BytesIO(content))
        if is_bug_id:
            self.platform_specific_attachments = {}
            for attachment in attachment_fetcher.fetch_bug(
                    bugzilla_id).attachments():
                bot_type = self._bot_type(attachment)
                if bot_type:
                    self.platform_specific_attachments[bot_type] = attachment
            self.generic_attachment = self.platform_specific_attachments.pop(
                "mac-wk2"
            ) if "mac-wk2" in self.platform_specific_attachments else None
        else:
            attachment = attachment_fetcher.fetch_attachment(bugzilla_id)
            self.platform_specific_attachments = {
                self._bot_type(attachment): attachment
            } if is_attachment_platform_specific else {}
            self.generic_attachment = attachment if not is_attachment_platform_specific else None

        webkit_finder = WebKitFinder(self.filesystem)
        self.layout_test_repository = webkit_finder.path_from_webkit_base(
            "LayoutTests")
Пример #5
0
    def start(self):
        assert not self._pid, '%s server is already running' % self._name

        # Stop any stale servers left over from previous instances.
        if self._port.host.filesystem.exists(self._pid_file):
            try:
                self._pid = int(
                    self._port.host.filesystem.read_text_file(self._pid_file))
                self.stop()
            except (ValueError, UnicodeDecodeError):
                # These could be raised if the pid file is corrupt.
                self._port.host.filesystem.remove(self._pid_file)
                self._pid = None

        _log.debug('Copying WebDriver WPT server config.json')
        doc_root = os.path.join(
            WebKitFinder(self._port.host.filesystem).path_from_webkit_base(
                'WebDriverTests'), 'imported', 'w3c')
        config_filename = os.path.join(doc_root, 'config.json')
        config = json.loads(
            self._port.host.filesystem.read_text_file(config_filename))
        config['doc_root'] = doc_root
        config['ssl']['openssl']['base_path'] = os.path.join(
            self._runtime_path, '_wpt_certs')
        self._port.host.filesystem.write_text_file(
            os.path.join(self._layout_doc_root, 'config.json'),
            json.dumps(config))
        self._server_host = config['browser_host']
        self._server_http_port = config['ports']['http'][0]
        self._server_https_port = config['ports']['https'][0]

        self._wsout = self._port.host.filesystem.open_text_file_for_writing(
            self._output_log_path)
        wpt_file = os.path.join(self._layout_doc_root, "wpt.py")
        cmd = [
            "python", wpt_file, "serve", "--config",
            os.path.join(self._layout_doc_root, 'config.json')
        ]
        self._process = self._port._executive.popen(
            cmd,
            cwd=self._layout_doc_root,
            shell=False,
            stdin=self._port._executive.PIPE,
            stdout=self._wsout,
            stderr=self._wsout)
        self._pid = self._process.pid
        self._port.host.filesystem.write_text_file(self._pid_file,
                                                   str(self._pid))

        if not self._wait_for_server():
            _log.error(
                'WPT Server process exited prematurely with status code %s' %
                self._process.returncode)
            self.stop()
            raise RuntimeError

        _log.info(
            'WebDriver WPT server listening at http://%s:%s/ and https://%s:%s/'
            % (self._server_host, self._server_http_port, self._server_host,
               self._server_https_port))
Пример #6
0
    def _test_prefix_list(self, issue_number, only_changed_tests):
        """Returns a collection of test, builder and file extensions to get new baselines for.

        Args:
            issue_number: The CL number of the change which needs new baselines.
            only_changed_tests: Whether to only include baselines for tests that
               are changed in this CL. If False, all new baselines for failing
               tests will be downloaded, even for tests that were not modified.

        Returns:
            A dict containing information about which new baselines to download.
        """
        builds_to_tests = self._builds_to_tests(issue_number)
        if only_changed_tests:
            files_in_cl = self.rietveld.changed_files(issue_number)
            finder = WebKitFinder(self._tool.filesystem)
            tests_in_cl = [finder.layout_test_name(f) for f in files_in_cl]
        result = {}
        for build, tests in builds_to_tests.iteritems():
            for test in tests:
                if only_changed_tests and test not in tests_in_cl:
                    continue
                if test not in result:
                    result[test] = {}
                result[test][build] = BASELINE_SUFFIX_LIST
        return result
Пример #7
0
 def do_POST(self):
     json_raw_data = self.rfile.read(
         int(self.headers.getheader('content-length')))
     json_data = json.loads(json_raw_data)
     test_list = ''
     for each in json_data['tests']:
         test_list += each + ' '
     filesystem = FileSystem()
     webkit_finder = WebKitFinder(filesystem)
     script_dir = webkit_finder.path_from_webkit_base('Tools', 'Scripts')
     executable_path = script_dir + "/run-webkit-tests"
     cmd = "python " + executable_path + " --no-show-results "
     cmd += test_list
     process = subprocess.Popen(cmd,
                                shell=True,
                                cwd=script_dir,
                                env=None,
                                stdout=subprocess.PIPE,
                                stderr=STDOUT)
     self.send_response(200)
     self.send_header('Access-Control-Allow-Origin', '*')
     self.send_header("Content-type", "text/html")
     self.end_headers()
     while process.poll() is None:
         html_output = '<br>' + str(process.stdout.readline())
         self.wfile.write(html_output)
         self.wfile.flush()
         time.sleep(0.05)
     process.wait()
Пример #8
0
    def start(self):
        assert not self._pid, '%s server is already running' % self._name

        # Stop any stale servers left over from previous instances.
        if self._port.host.filesystem.exists(self._pid_file):
            try:
                self._pid = int(self._port.host.filesystem.read_text_file(self._pid_file))
                self.stop()
            except (ValueError, UnicodeDecodeError):
                # These could be raised if the pid file is corrupt.
                self._port.host.filesystem.remove(self._pid_file)
                self._pid = None

        _log.debug('Copying WebDriver WPT server config.json')
        doc_root = os.path.join(WebKitFinder(self._port.host.filesystem).path_from_webkit_base('WebDriverTests'), 'imported', 'w3c')
        config_filename = os.path.join(doc_root, 'config.json')
        config_json = self._port.host.filesystem.read_text_file(config_filename).replace("%DOC_ROOT%", doc_root)
        self._port.host.filesystem.write_text_file(os.path.join(self._layout_doc_root, 'config.json'), config_json)
        config = json.loads(config_json)
        self._server_host = config['host']
        self._server_port = config['ports']['http'][0]

        self._wsout = self._port.host.filesystem.open_text_file_for_writing(self._output_log_path)
        launcher = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'layout_tests', 'servers', 'web_platform_test_launcher.py'))
        cmd = ['python', launcher, self._servers_file]
        self._process = self._port._executive.popen(cmd, cwd=self._layout_doc_root, shell=False, stdin=self._port._executive.PIPE, stdout=self._wsout, stderr=self._wsout)
        self._pid = self._process.pid
        self._port.host.filesystem.write_text_file(self._pid_file, str(self._pid))

        if not self._wait_for_server():
            _log.error('WPT Server process exited prematurely with status code %s' % self._process.returncode)
            self.stop()
            raise RuntimeError

        _log.info('WebDriver WPT server listening at http://%s:%s/' % (self._server_host, self._server_port))
Пример #9
0
def _read_configuration_from_gn(fs, options):
    """Return the configuration to used based on args.gn, if possible."""

    # We should really default to 'out' everywhere at this point, but
    # that's a separate cleanup CL.
    build_directory = getattr(options, 'build_directory', None) or 'out'

    target = options.target
    finder = WebKitFinder(fs)
    path = fs.join(finder.chromium_base(), build_directory, target, 'args.gn')
    if not fs.exists(path):
        path = fs.join(finder.chromium_base(), build_directory, target,
                       'toolchain.ninja')
        if not fs.exists(path):
            # This does not appear to be a GN-based build directory, so we don't know
            # how to interpret it.
            return None

        # toolchain.ninja exists, but args.gn does not; this can happen when
        # `gn gen` is run with no --args.
        return 'Debug'

    args = fs.read_text_file(path)
    for l in args.splitlines():
        if re.match(r'^\s*is_debug\s*=\s*false(\s*$|\s*#.*$)', l):
            return 'Release'

    # if is_debug is set to anything other than false, or if it
    # does not exist at all, we should use the default value (True).
    return 'Debug'
Пример #10
0
    def __init__(self, port, options, printer):
        """Initialize test runner data structures.

        Args:
          port: An object implementing platform-specific functionality.
          options: An options argument which contains command line options.
          printer: A Printer object to record updates to.
        """
        self._port = port
        self._filesystem = port.host.filesystem
        self._options = options
        self._printer = printer
        self._expectations = None

        self.HTTP_SUBDIR = 'http' + port.TEST_PATH_SEPARATOR
        self.INSPECTOR_SUBDIR = 'inspector' + port.TEST_PATH_SEPARATOR
        self.PERF_SUBDIR = 'perf'
        self.WEBSOCKET_SUBDIR = 'websocket' + port.TEST_PATH_SEPARATOR
        self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests'
        self.ARCHIVED_RESULTS_LIMIT = 25
        self._http_server_started = False
        self._wptserve_started = False
        self._websockets_server_started = False

        self._results_directory = self._port.results_directory()
        self._finder = LayoutTestFinder(self._port, self._options)
        self._webkit_finder = WebKitFinder(port.host.filesystem)
        self._runner = LayoutTestRunner(self._options, self._port,
                                        self._printer, self._results_directory,
                                        self._test_is_slow)
Пример #11
0
    def __init__(self, new_path, filename, reference_support_info,
                 host=Host()):
        HTMLParser.__init__(self)

        self._host = host
        self._filesystem = self._host.filesystem
        self._webkit_root = WebKitFinder(self._filesystem).webkit_base()

        self.converted_data = []
        self.converted_properties = []
        self.in_style_tag = False
        self.style_data = []
        self.filename = filename
        self.reference_support_info = reference_support_info
        resources_path = self.path_from_webkit_root('LayoutTests', 'resources')
        resources_relpath = self._filesystem.relpath(resources_path, new_path)
        self.resources_relpath = resources_relpath

        # These settings might vary between WebKit and Blink.
        # Only -webkit-text-emphasis is currently needed. See:
        # https://bugs.chromium.org/p/chromium/issues/detail?id=614955#c1
        self.prefixed_properties = [
            '-webkit-text-emphasis',
            '-webkit-text-emphasis-color',
            '-webkit-text-emphasis-position',
            '-webkit-text-emphasis-style',
        ]
        prop_regex = r'([\s{]|^)(' + '|'.join(
            prop.replace('-webkit-', '')
            for prop in self.prefixed_properties) + r')(\s+:|:)'
        self.prop_re = re.compile(prop_regex)
Пример #12
0
 def __init__(self, host):
     self.host = host
     self.executive = host.executive
     self.fs = host.filesystem
     self.finder = WebKitFinder(self.fs)
     self.verbose = False
     self.git_cl = None
Пример #13
0
    def __init__(self, new_path, filename, host=Host()):
        HTMLParser.__init__(self)

        self._host = host
        self._filesystem = self._host.filesystem
        self._webkit_root = WebKitFinder(self._filesystem).webkit_base()

        self.converted_data = []
        self.converted_properties = []
        self.in_style_tag = False
        self.style_data = []
        self.filename = filename

        resources_path = self.path_from_webkit_root('tests', 'resources')
        resources_relpath = self._filesystem.relpath(resources_path, new_path)
        self.resources_relpath = resources_relpath

        # These settings might vary between WebKit and Blink
        self._css_property_file = self.path_from_webkit_root(
            'Source', 'core', 'css', 'CSSProperties.in')

        self.prefixed_properties = self.read_webkit_prefixed_css_property_list(
        )

        self.prefixed_properties = self.read_webkit_prefixed_css_property_list(
        )
        prop_regex = '([\s{]|^)(' + "|".join(
            prop.replace('-webkit-', '')
            for prop in self.prefixed_properties) + ')(\s+:|:)'
        self.prop_re = re.compile(prop_regex)
Пример #14
0
    def _assertOptimization(self,
                            results_by_directory,
                            expected_new_results_by_directory,
                            baseline_dirname=''):
        host = MockHost()
        fs = host.filesystem
        webkit_base = WebKitFinder(fs).webkit_base()
        baseline_name = 'mock-baseline-expected.txt'

        for dirname, contents in results_by_directory.items():
            path = fs.join(webkit_base, 'LayoutTests', dirname, baseline_name)
            fs.write_binary_file(path, contents)

        baseline_optimizer = BaselineOptimizer(
            host, host.port_factory.all_port_names())
        self.assertTrue(
            baseline_optimizer.optimize(
                fs.join(baseline_dirname, baseline_name)))

        for dirname, contents in expected_new_results_by_directory.items():
            path = fs.join(webkit_base, 'LayoutTests', dirname, baseline_name)
            if contents is None:
                self.assertFalse(fs.exists(path))
            else:
                self.assertEqual(fs.read_binary_file(path), contents)

        # Check that the files that were in the original set have been deleted where necessary.
        for dirname in results_by_directory:
            path = fs.join(webkit_base, 'LayoutTests', dirname, baseline_name)
            if not dirname in expected_new_results_by_directory:
                self.assertFalse(fs.exists(path))
Пример #15
0
 def __init__(self, filesystem=None, webkit_finder=None):
     self.filesystem = filesystem or FileSystem()
     self.executive = Executive()
     self.finder = Finder(self.filesystem)
     self.printer = Printer(sys.stderr)
     self.webkit_finder = webkit_finder or WebKitFinder(self.filesystem)
     self._options = None
Пример #16
0
    def __init__(self, host, test_paths, options):
        self.host = host
        self.source_directory = options.source
        self.options = options
        self.test_paths = test_paths if test_paths else []

        self.filesystem = self.host.filesystem

        webkit_finder = WebKitFinder(self.filesystem)
        self._webkit_root = webkit_finder.webkit_base()

        self.destination_directory = webkit_finder.path_from_webkit_base("LayoutTests", options.destination)
        self.tests_w3c_relative_path = self.filesystem.join('imported', 'w3c')
        self.layout_tests_path = webkit_finder.path_from_webkit_base('LayoutTests')
        self.layout_tests_w3c_path = self.filesystem.join(self.layout_tests_path, self.tests_w3c_relative_path)
        self.tests_download_path = webkit_finder.path_from_webkit_base('WebKitBuild', 'w3c-tests')

        self._test_downloader = None

        self._potential_test_resource_files = []

        self.import_list = []
        self._importing_downloaded_tests = self.source_directory is None

        self._test_resource_files_json_path = self.filesystem.join(self.layout_tests_w3c_path, "resources", "resource-files.json")
        self._test_resource_files = json.loads(self.filesystem.read_text_file(self._test_resource_files_json_path)) if self.filesystem.exists(self._test_resource_files_json_path) else None

        self._tests_options_json_path = self.filesystem.join(self.layout_tests_path, 'tests-options.json')
        self._tests_options = json.loads(self.filesystem.read_text_file(self._tests_options_json_path)) if self.filesystem.exists(self._tests_options_json_path) else None
        self._slow_tests = []

        if self.options.clean_destination_directory and self._test_resource_files:
            self._test_resource_files["files"] = []
            if self._tests_options:
                self.remove_slow_from_w3c_tests_options()
    def _assertOptimization(self, results_by_directory, expected_new_results_by_directory, baseline_dirname='', expected_files_to_delete=None, host=None):
        if not host:
            host = MockHost()
        fs = host.filesystem
        webkit_base = WebKitFinder(fs).webkit_base()
        baseline_name = 'mock-baseline-expected.txt'
        fs.write_text_file(fs.join(webkit_base, 'LayoutTests', 'VirtualTestSuites'),
                           '[{"prefix": "gpu", "base": "fast/canvas", "args": ["--foo"]}]')

        for dirname, contents in results_by_directory.items():
            path = fs.join(webkit_base, 'LayoutTests', dirname, baseline_name)
            fs.write_binary_file(path, contents)

        baseline_optimizer = BaselineOptimizer(host, host.port_factory.get(), host.port_factory.all_port_names(), skip_scm_commands=expected_files_to_delete is not None)
        self.assertTrue(baseline_optimizer.optimize(fs.join(baseline_dirname, baseline_name)))

        for dirname, contents in expected_new_results_by_directory.items():
            path = fs.join(webkit_base, 'LayoutTests', dirname, baseline_name)
            if contents is None:
                self.assertTrue(not fs.exists(path) or path in baseline_optimizer._files_to_delete)
            else:
                self.assertEqual(fs.read_binary_file(path), contents)

        # Check that the files that were in the original set have been deleted where necessary.
        for dirname in results_by_directory:
            path = fs.join(webkit_base, 'LayoutTests', dirname, baseline_name)
            if not dirname in expected_new_results_by_directory:
                self.assertTrue(not fs.exists(path) or path in baseline_optimizer._files_to_delete)

        if expected_files_to_delete:
            self.assertEqual(sorted(baseline_optimizer._files_to_delete), sorted(expected_files_to_delete))
Пример #18
0
    def __init__(self, host, options, gitClass=Git, bugzillaClass=Bugzilla, WPTGitHubClass=WPTGitHub, WPTLinterClass=WPTLinter):
        self._host = host
        self._filesystem = host.filesystem
        self._options = options

        self._host.initialize_scm()

        self._WPTGitHubClass = WPTGitHubClass
        self._gitClass = gitClass
        self._bugzilla = bugzillaClass()
        self._bug_id = options.bug_id
        if not self._bug_id:
            if options.attachment_id:
                self._bug_id = self._bugzilla.bug_id_for_attachment_id(options.attachment_id)
            elif options.git_commit:
                self._bug_id = self._host.checkout().bug_id_for_this_commit(options.git_commit)

        if not self._options.repository_directory:
            webkit_finder = WebKitFinder(self._filesystem)
            self._options.repository_directory = WPTPaths.wpt_checkout_path(webkit_finder)

        self._linter = WPTLinterClass(self._options.repository_directory, host.filesystem)

        self._bugzilla_url = "https://bugs.webkit.org/show_bug.cgi?id=" + str(self._bug_id)
        self._commit_message = options.message
        if not self._commit_message:
            self._commit_message = 'WebKit export of ' + self._bugzilla_url if self._bug_id else 'Export made from a WebKit repository'
Пример #19
0
    def __init__(self, port):
        self._port = port
        _log.info('Using port %s' % self._port.name())
        _log.info('Test configuration: %s' % self._port.test_configuration())
        _log.info('Using display server %s' % (self._port._display_server))

        self._display_driver = self._port._driver_class()(self._port,
                                                          worker_number=0,
                                                          pixel_tests=False,
                                                          no_timeout=True)
        if not self._display_driver.check_driver(self._port):
            raise RuntimeError("Failed to check driver %s" %
                               self._display_driver.__class__.__name__)

        driver = create_driver(self._port)
        _log.info('Using driver at %s' % (driver.binary_path()))
        _log.info('Browser: %s' % (driver.browser_name()))

        _log.info('Parsing expectations')
        self._tests_dir = WebKitFinder(
            self._port.host.filesystem).path_from_webkit_base('WebDriverTests')
        expectations_file = os.path.join(self._tests_dir,
                                         'TestExpectations.json')
        build_type = 'Debug' if self._port.get_option('debug') else 'Release'
        self._expectations = TestExpectations(self._port.name(),
                                              expectations_file, build_type)

        env = self._display_driver._setup_environ_for_test()
        self._runners = [
            runner_cls(self._port, driver, env, self._expectations)
            for runner_cls in self.RUNNER_CLASSES
        ]
Пример #20
0
    def __init__(self, repository_directory, host, options):
        self._options = options
        self._host = host
        self._filesystem = host.filesystem
        self._test_suites = []

        self.repository_directory = repository_directory

        self.test_repositories = self.load_test_repositories(self._filesystem)

        self.paths_to_skip = []
        self.paths_to_import = []
        for test_repository in self.test_repositories:
            self.paths_to_skip.extend([
                self._filesystem.join(test_repository['name'], path)
                for path in test_repository['paths_to_skip']
            ])
            self.paths_to_import.extend([
                self._filesystem.join(test_repository['name'], path)
                for path in test_repository['paths_to_import']
            ])

        webkit_finder = WebKitFinder(self._filesystem)
        self.import_expectations_path = webkit_finder.path_from_webkit_base(
            'LayoutTests', 'imported', 'w3c', 'resources',
            'import-expectations.json')
        if not self._filesystem.isfile(self.import_expectations_path):
            _log.warning('Unable to read import expectation file: %s' %
                         self.import_expectations_path)
        if not self._options.import_all:
            self._init_paths_from_expectations()
 def __init__(self, port, driver, env, expectations):
     self._port = port
     self._driver = driver
     self._env = env
     self._expectations = expectations
     self._results = []
     self._tests_dir = WebKitFinder(self._port.host.filesystem).path_from_webkit_base('WebDriverTests')
Пример #22
0
    def _assertOptimization(self,
                            results_by_directory,
                            expected_new_results_by_directory,
                            baseline_dirname='',
                            host=None):
        if not host:
            host = MockHost()
        fs = host.filesystem
        webkit_base = WebKitFinder(fs).webkit_base()
        baseline_name = 'mock-baseline-expected.txt'
        fs.write_text_file(
            fs.join(webkit_base, 'LayoutTests', 'VirtualTestSuites'),
            '[{"prefix": "gpu", "base": "fast/canvas", "args": ["--foo"]}]')

        for dirname, contents in results_by_directory.items():
            path = fs.join(webkit_base, 'LayoutTests', dirname, baseline_name)
            fs.write_binary_file(path, contents)

        baseline_optimizer = BaselineOptimizer(
            host, host.port_factory.get(), host.port_factory.all_port_names())
        self.assertTrue(
            baseline_optimizer.optimize(
                fs.join(baseline_dirname, baseline_name)))

        for dirname, contents in expected_new_results_by_directory.items():
            path = fs.join(webkit_base, 'LayoutTests', dirname, baseline_name)
            if contents is not None:
                self.assertEqual(fs.read_binary_file(path), contents)
Пример #23
0
    def __init__(self, repository_directory, host, options):
        self._options = options
        self._host = host
        self._filesystem = host.filesystem
        self._test_suites = []

        self.repository_directory = repository_directory

        self.test_repositories = self.load_test_repositories()

        self.paths_to_skip = []
        self.paths_to_import = []
        for test_repository in self.test_repositories:
            self.paths_to_skip.extend([
                self._filesystem.join(test_repository['name'], path)
                for path in test_repository['paths_to_skip']
            ])
            self.paths_to_import.extend([
                self._filesystem.join(test_repository['name'], path)
                for path in test_repository['paths_to_import']
            ])

        if not self._options.import_all:
            webkit_finder = WebKitFinder(self._filesystem)
            import_expectations_path = webkit_finder.path_from_webkit_base(
                'LayoutTests', 'imported', 'w3c', 'resources',
                'ImportExpectations')
            self._init_paths_from_expectations(import_expectations_path)
Пример #24
0
def main():
    filesystem = FileSystem()
    wkf = WebKitFinder(filesystem)
    tester = Tester(filesystem, wkf)
    tester.add_tree(wkf.path_from_webkit_base('Tools', 'Scripts'), 'webkitpy')

    tester.skip(('webkitpy.common.checkout.scm.scm_unittest', ),
                'are really, really, slow', 31818)
    if sys.platform == 'win32':
        tester.skip(
            ('webkitpy.common.checkout', 'webkitpy.common.config',
             'webkitpy.tool', 'webkitpy.w3c',
             'webkitpy.layout_tests.layout_package.bot_test_expectations'),
            '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(wkf.path_from_webkit_base('Tools', 'TestResultServer'))
    else:
        _log.info(
            'Skipping TestResultServer tests; the Google AppEngine Python SDK is not installed.'
        )

    return not tester.run()
Пример #25
0
 def get_port(self, target=None, configuration=None, files=None):
     host = MockHost()
     wkf = WebKitFinder(host.filesystem)
     files = files or {}
     for path, contents in files.items():
         host.filesystem.write_text_file(wkf.path_from_chromium_base(path), contents)
     options = MockOptions(target=target, configuration=configuration)
     return factory.PortFactory(host).get(options=options)
Пример #26
0
 def __init__(self, host):
     self.host = host
     self.executive = host.executive
     self.fs = host.filesystem
     self.finder = WebKitFinder(self.fs)
     self.verbose = False
     self.allow_local_blink_commits = False
     self.keep_w3c_repos_around = False
Пример #27
0
 def __init__(self, executive, name, pid, newer_than, filesystem, path_to_driver, port_name, configuration):
     self.name = name
     self.pid = pid
     self.newer_than = newer_than
     self._filesystem = filesystem
     self._path_to_driver = path_to_driver
     self._executive = executive
     self._port_name = port_name
     self._configuration = configuration
     self._webkit_finder = WebKitFinder(filesystem)
Пример #28
0
    def __init__(self):
        self._host = Host()
        self._filesystem = self._host.filesystem
        self._webkit_root = WebKitFinder(self._filesystem).webkit_base()

        # These settings might vary between WebKit and Blink
        self._css_property_file = self.path_from_webkit_root('Source', 'WebCore', 'css', 'CSSPropertyNames.in')
        self._css_property_split_string = '='

        self.prefixed_properties = self.read_webkit_prefixed_css_property_list()
Пример #29
0
    def _add_base_manifest_to_mock_filesystem(self, filesystem):
        webkit_finder = WebKitFinder(filesystem)

        external_dir = webkit_finder.path_from_webkit_base(
            'LayoutTests', 'external')
        filesystem.maybe_make_directory(filesystem.join(external_dir, 'wpt'))

        manifest_base_path = filesystem.join(external_dir,
                                             'WPT_BASE_MANIFEST.json')
        filesystem.files[manifest_base_path] = '{}'
Пример #30
0
 def _run_pylint(self, path):
     wkf = WebKitFinder(FileSystem())
     executive = Executive()
     return executive.run_command([
         sys.executable,
         wkf.path_from_depot_tools_base('pylint.py'),
         '--output-format=parseable',
         '--errors-only', '--rcfile=' + wkf.path_from_webkit_base(
             'Tools', 'Scripts', 'webkitpy', 'pylintrc'), path
     ],
                                  error_handler=executive.ignore_error)