def execute(self, options, args, tool): self._touched_test_names = set([]) for port_name in factory.all_port_names(): self._rebaseline_port(port_name) for port_name in factory.all_port_names(): self._update_expectations_file(port_name) for test_name in self._touched_test_names: print "Optimizing baselines for %s." % test_name self._run_webkit_patch(['optimize-baselines', test_name])
def _baseline_search_hypergraph(fs): hypergraph = {} # These edges in the hypergraph aren't visible on build.webkit.org, # but they impose constraints on how we optimize baselines. hypergraph['mac-future'] = [ 'LayoutTests/platform/mac-future', 'LayoutTests/platform/mac', 'LayoutTests' ] hypergraph['qt-unknown'] = [ 'LayoutTests/platform/qt-unknown', 'LayoutTests/platform/qt', 'LayoutTests' ] # FIXME: Should we get this constant from somewhere? fallback_path = ['LayoutTests'] for port_name in port_factory.all_port_names(): port = port_factory.get(port_name) webkit_base = port.webkit_base() search_path = port.baseline_search_path() if search_path: hypergraph[port_name] = [ fs.relpath(path, webkit_base) for path in search_path ] + fallback_path return hypergraph
def _baseline_search_hypergraph(fs): hypergraph = {} # These edges in the hypergraph aren't visible on build.webkit.org, # but they impose constraints on how we optimize baselines. hypergraph['mac-future'] = ['LayoutTests/platform/mac-future', 'LayoutTests/platform/mac', 'LayoutTests'] hypergraph['qt-unknown'] = ['LayoutTests/platform/qt-unknown', 'LayoutTests/platform/qt', 'LayoutTests'] # FIXME: Should we get this constant from somewhere? fallback_path = ['LayoutTests'] for port_name in port_factory.all_port_names(): port = port_factory.get(port_name) webkit_base = port.webkit_base() search_path = port.baseline_search_path() if search_path: hypergraph[port_name] = [fs.relpath(path, webkit_base) for path in search_path] + fallback_path return hypergraph
def port_fallbacks(): """Get the port fallback information. Returns: A dictionary mapping platform name to a list of other platforms to fall back on. All platforms fall back on 'base'. """ fallbacks = {_BASE_PLATFORM: []} for port_name in port_factory.all_port_names(): try: platforms = port_factory.get(port_name).baseline_search_path() except NotImplementedError: _log.error("'%s' lacks baseline_search_path(), please fix." % port_name) fallbacks[port_name] = [_BASE_PLATFORM] continue fallbacks[port_name] = [os.path.basename(p) for p in platforms][1:] fallbacks[port_name].append(_BASE_PLATFORM) return fallbacks
def find_dups(hashes, port_fallbacks, relative_to): """Yields info about redundant test expectations. Args: hashes: a list of hashes as returned by cluster_file_hashes. port_fallbacks: a list of fallback information as returned by get_port_fallbacks. relative_to: the directory that we want the results relative to Returns: a tuple containing (test, platform, fallback, platforms) """ for (test, hash), cluster in hashes.items(): if len(cluster) < 2: continue # Common case: only one file with that hash. # Compute the list of platforms we have this particular hash for. platforms = extract_platforms(cluster) if len(platforms) == 1: continue # See if any of the platforms are redundant with each other. for platform in platforms.keys(): if platform not in port_factory.all_port_names(): continue for dirname in port_fallbacks[platform]: fallback = dirname_to_platform(dirname) if fallback not in platforms.keys(): continue # We have to verify that there isn't an intermediate result # that causes this duplicate hash to exist. if has_intermediate_results(test, port_fallbacks[platform], fallback): continue # We print the relative path so it's easy to pipe the results # to xargs rm. path = get_relative_test_path(platforms[platform], relative_to) if not path: continue yield { 'test': test, 'platform': platform, 'fallback': dirname, 'path': path, }