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

Side by Side Diff: Tools/Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py

Issue 423553004: Fix baselineoptimizer issue when deleting a virtual baseline not controlled by scm (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add test Created 6 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « Tools/Scripts/webkitpy/common/checkout/baselineoptimizer.py ('k') | no next file » | 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 self.assertEqual(baseline_optimizer._files_to_delete, [ 94 self.assertEqual(baseline_optimizer._files_to_delete, [
95 '/mock-checkout/third_party/WebKit/LayoutTests/platform/win/another/ test-expected.txt', 95 '/mock-checkout/third_party/WebKit/LayoutTests/platform/win/another/ test-expected.txt',
96 ]) 96 ])
97 97
98 self.assertEqual(baseline_optimizer._files_to_add, [ 98 self.assertEqual(baseline_optimizer._files_to_add, [
99 '/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected .txt', 99 '/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected .txt',
100 '/mock-checkout/third_party/WebKit/LayoutTests/platform/linux/anothe r/test-expected.txt', 100 '/mock-checkout/third_party/WebKit/LayoutTests/platform/linux/anothe r/test-expected.txt',
101 ]) 101 ])
102 102
103 def _assertOptimization(self, results_by_directory, expected_new_results_by_ directory, baseline_dirname='', expected_files_to_delete=None): 103 def _assertOptimization(self, results_by_directory, expected_new_results_by_ directory, baseline_dirname='', expected_files_to_delete=None, host=None):
104 host = MockHost() 104 if not host:
105 host = MockHost()
105 fs = host.filesystem 106 fs = host.filesystem
106 webkit_base = WebKitFinder(fs).webkit_base() 107 webkit_base = WebKitFinder(fs).webkit_base()
107 baseline_name = 'mock-baseline-expected.txt' 108 baseline_name = 'mock-baseline-expected.txt'
108 109
109 for dirname, contents in results_by_directory.items(): 110 for dirname, contents in results_by_directory.items():
110 path = fs.join(webkit_base, 'LayoutTests', dirname, baseline_name) 111 path = fs.join(webkit_base, 'LayoutTests', dirname, baseline_name)
111 fs.write_binary_file(path, contents) 112 fs.write_binary_file(path, contents)
112 113
113 baseline_optimizer = BaselineOptimizer(host, host.port_factory.all_port_ names(), skip_scm_commands=expected_files_to_delete is not None) 114 baseline_optimizer = BaselineOptimizer(host, host.port_factory.all_port_ names(), skip_scm_commands=expected_files_to_delete is not None)
114 self.assertTrue(baseline_optimizer.optimize(fs.join(baseline_dirname, ba seline_name))) 115 self.assertTrue(baseline_optimizer.optimize(fs.join(baseline_dirname, ba seline_name)))
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 'virtual/softwarecompositing': None, 247 'virtual/softwarecompositing': None,
247 'compositing': '2', 248 'compositing': '2',
248 }, 249 },
249 baseline_dirname='virtual/softwarecompositing', 250 baseline_dirname='virtual/softwarecompositing',
250 expected_files_to_delete=[ 251 expected_files_to_delete=[
251 '/mock-checkout/third_party/WebKit/LayoutTests/virtual/softwarecompo siting/mock-baseline-expected.txt', 252 '/mock-checkout/third_party/WebKit/LayoutTests/virtual/softwarecompo siting/mock-baseline-expected.txt',
252 '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/composit ing/mock-baseline-expected.txt', 253 '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/composit ing/mock-baseline-expected.txt',
253 '/mock-checkout/third_party/WebKit/LayoutTests/platform/win/composit ing/mock-baseline-expected.txt', 254 '/mock-checkout/third_party/WebKit/LayoutTests/platform/win/composit ing/mock-baseline-expected.txt',
254 ]) 255 ])
255 256
257 def test_virtual_root_redundant_with_ancestors_skip_scm_commands_with_file_n ot_in_scm(self):
258 self._assertOptimization({
259 'virtual/softwarecompositing': '2',
260 'platform/mac/compositing': '2',
261 'platform/win/compositing': '2',
262 }, {
263 'virtual/softwarecompositing': None,
264 'compositing': '2',
265 },
266 baseline_dirname='virtual/softwarecompositing',
267 expected_files_to_delete=[
268 '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/composit ing/mock-baseline-expected.txt',
269 '/mock-checkout/third_party/WebKit/LayoutTests/platform/win/composit ing/mock-baseline-expected.txt',
270 ],
271 host=MockHost(scm=ExcludingMockSCM(['/mock-checkout/third_party/WebKit/L ayoutTests/virtual/softwarecompositing/mock-baseline-expected.txt'])))
272
256 def test_virtual_root_not_redundant_with_ancestors(self): 273 def test_virtual_root_not_redundant_with_ancestors(self):
257 self._assertOptimization({ 274 self._assertOptimization({
258 'virtual/softwarecompositing': '2', 275 'virtual/softwarecompositing': '2',
259 'platform/mac/compositing': '1', 276 'platform/mac/compositing': '1',
260 }, { 277 }, {
261 'virtual/softwarecompositing': '2', 278 'virtual/softwarecompositing': '2',
262 'platform/mac/compositing': '1', 279 'platform/mac/compositing': '1',
263 }, baseline_dirname='virtual/softwarecompositing') 280 }, baseline_dirname='virtual/softwarecompositing')
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/common/checkout/baselineoptimizer.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698