Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer.py

Issue 2575383004: Don't duplicate virtual and non-virtual baselines. (Closed)
Patch Set: Unit test Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2011, Google Inc. All rights reserved. 1 # Copyright (C) 2011, Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 return port.virtual_baseline_search_path(baseline_name) 74 return port.virtual_baseline_search_path(baseline_name)
75 return port.baseline_search_path() 75 return port.baseline_search_path()
76 76
77 def _virtual_suite(self, baseline_name): 77 def _virtual_suite(self, baseline_name):
78 return self._default_port.lookup_virtual_suite(baseline_name) 78 return self._default_port.lookup_virtual_suite(baseline_name)
79 79
80 def _virtual_base(self, baseline_name): 80 def _virtual_base(self, baseline_name):
81 return self._default_port.lookup_virtual_test_base(baseline_name) 81 return self._default_port.lookup_virtual_test_base(baseline_name)
82 82
83 def _relative_baseline_search_paths(self, port, baseline_name): 83 def _relative_baseline_search_paths(self, port, baseline_name):
84 baseline_search_path = self._baseline_search_path(port, baseline_name) 84 directories = self._baseline_search_path(port, baseline_name)
85 baseline_root = self._baseline_root(baseline_name) 85 directories = [self._filesystem.relpath(path, self._webkit_base) for pat h in directories]
86 relative_paths = [self._filesystem.relpath(path, self._webkit_base) for path in baseline_search_path] 86 directories.append(self._baseline_root(baseline_name))
Dirk Pranke 2016/12/18 04:26:00 Stylistically, I don't tend to like repeatedly mod
87 return relative_paths + [baseline_root] 87
88 virtual_suite = self._virtual_suite(baseline_name)
89 if virtual_suite:
90 non_virtual_directories = port.baseline_search_path()
91 non_virtual_directories = [self._filesystem.relpath(path, self._webk it_base) for path in non_virtual_directories]
92 non_virtual_directories.append(self.ROOT_LAYOUT_TESTS_DIRECTORY)
93 non_virtual_directories = [self._filesystem.join(path, virtual_suite .base) for path in non_virtual_directories]
94 directories += non_virtual_directories
Dirk Pranke 2016/12/18 04:26:00 and similar.
95
96 return directories
88 97
89 def _join_directory(self, directory, baseline_name): 98 def _join_directory(self, directory, baseline_name):
90 # This code is complicated because both the directory name and the basel ine_name have the virtual 99 # This code is complicated because both the directory name and the basel ine_name have the virtual
91 # test suite in the name and the virtual baseline name is not a strict s uperset of the non-virtual name. 100 # test suite in the name and the virtual baseline name is not a strict s uperset of the non-virtual name.
92 # For example, virtual/gpu/fast/canvas/foo-expected.png corresponds to f ast/canvas/foo-expected.png and 101 # For example, virtual/gpu/fast/canvas/foo-expected.png corresponds to f ast/canvas/foo-expected.png and
93 # the baseline directories are like platform/mac/virtual/gpu/fast/canvas . So, to get the path 102 # the baseline directories are like platform/mac/virtual/gpu/fast/canvas . So, to get the path
94 # to the baseline in the platform directory, we need to append just foo- expected.png to the directory. 103 # to the baseline in the platform directory, we need to append just foo- expected.png to the directory.
95 virtual_suite = self._virtual_suite(baseline_name) 104 virtual_suite = self._virtual_suite(baseline_name)
96 if virtual_suite: 105 if virtual_suite:
97 baseline_name_without_virtual = baseline_name[len(virtual_suite.name ) + 1:] 106 baseline_name_without_virtual = baseline_name[len(virtual_suite.name ) + 1:]
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 result = self._optimize_subtree(baseline_name) 329 result = self._optimize_subtree(baseline_name)
321 non_virtual_baseline_name = self._virtual_base(baseline_name) 330 non_virtual_baseline_name = self._virtual_base(baseline_name)
322 if not non_virtual_baseline_name: 331 if not non_virtual_baseline_name:
323 return result 332 return result
324 333
325 self._optimize_virtual_root(baseline_name, non_virtual_baseline_name) 334 self._optimize_virtual_root(baseline_name, non_virtual_baseline_name)
326 335
327 _log.debug("Optimizing non-virtual fallback path.") 336 _log.debug("Optimizing non-virtual fallback path.")
328 result |= self._optimize_subtree(non_virtual_baseline_name) 337 result |= self._optimize_subtree(non_virtual_baseline_name)
329 return result 338 return result
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698