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

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/port/base.py

Issue 18603012: Make BaselineOptimizer virtual test suite aware. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 def baseline_platform_dir(self): 206 def baseline_platform_dir(self):
207 """Return the absolute path to the default (version-independent) platfor m-specific results.""" 207 """Return the absolute path to the default (version-independent) platfor m-specific results."""
208 return self._filesystem.join(self.layout_tests_dir(), 'platform', self.p ort_name) 208 return self._filesystem.join(self.layout_tests_dir(), 'platform', self.p ort_name)
209 209
210 def baseline_version_dir(self): 210 def baseline_version_dir(self):
211 """Return the absolute path to the platform-and-version-specific results .""" 211 """Return the absolute path to the platform-and-version-specific results ."""
212 baseline_search_paths = self.baseline_search_path() 212 baseline_search_paths = self.baseline_search_path()
213 return baseline_search_paths[0] 213 return baseline_search_paths[0]
214 214
215 def virtual_baseline_search_path(self, test_name):
216 suite = self.lookup_virtual_suite(test_name)
217 if not suite:
218 return None
219 return [self._filesystem.join(path, suite.name) for path in self.default _baseline_search_path()]
220
215 def baseline_search_path(self): 221 def baseline_search_path(self):
216 return self.get_option('additional_platform_directory', []) + self._comp are_baseline() + self.default_baseline_search_path() 222 return self.get_option('additional_platform_directory', []) + self._comp are_baseline() + self.default_baseline_search_path()
217 223
218 def default_baseline_search_path(self): 224 def default_baseline_search_path(self):
219 """Return a list of absolute paths to directories to search under for 225 """Return a list of absolute paths to directories to search under for
220 baselines. The directories are searched in order.""" 226 baselines. The directories are searched in order."""
221 search_paths = [] 227 search_paths = []
222 search_paths.append(self.name()) 228 search_paths.append(self.name())
223 if self.name() != self.port_name: 229 if self.name() != self.port_name:
224 search_paths.append(self.port_name) 230 search_paths.append(self.port_name)
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 virtual_tests = list() 1352 virtual_tests = list()
1347 for suite in suites: 1353 for suite in suites:
1348 if paths: 1354 if paths:
1349 for test in suite.tests: 1355 for test in suite.tests:
1350 if any(test.startswith(p) for p in paths): 1356 if any(test.startswith(p) for p in paths):
1351 virtual_tests.append(test) 1357 virtual_tests.append(test)
1352 else: 1358 else:
1353 virtual_tests.extend(suite.tests.keys()) 1359 virtual_tests.extend(suite.tests.keys())
1354 return virtual_tests 1360 return virtual_tests
1355 1361
1356 def lookup_virtual_test_base(self, test_name): 1362 def is_virtual_test(self, test_name):
1363 return bool(self.lookup_virtual_suite(test_name))
1364
1365 def lookup_virtual_suite(self, test_name):
1357 for suite in self.populated_virtual_test_suites(): 1366 for suite in self.populated_virtual_test_suites():
1358 if test_name.startswith(suite.name): 1367 if test_name.startswith(suite.name):
1359 return test_name.replace(suite.name, suite.base, 1) 1368 return suite
1360 return None 1369 return None
1361 1370
1371 def lookup_virtual_test_base(self, test_name):
1372 suite = self.lookup_virtual_suite(test_name)
1373 if not suite:
1374 return None
1375 return test_name.replace(suite.name, suite.base, 1)
1376
1362 def lookup_virtual_test_args(self, test_name): 1377 def lookup_virtual_test_args(self, test_name):
1363 for suite in self.populated_virtual_test_suites(): 1378 for suite in self.populated_virtual_test_suites():
1364 if test_name.startswith(suite.name): 1379 if test_name.startswith(suite.name):
1365 return suite.args 1380 return suite.args
1366 return [] 1381 return []
1367 1382
1368 def should_run_as_pixel_test(self, test_input): 1383 def should_run_as_pixel_test(self, test_input):
1369 if not self._options.pixel_tests: 1384 if not self._options.pixel_tests:
1370 return False 1385 return False
1371 if self._options.pixel_test_directories: 1386 if self._options.pixel_test_directories:
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 1444
1430 class VirtualTestSuite(object): 1445 class VirtualTestSuite(object):
1431 def __init__(self, name, base, args, tests=None): 1446 def __init__(self, name, base, args, tests=None):
1432 self.name = name 1447 self.name = name
1433 self.base = base 1448 self.base = base
1434 self.args = args 1449 self.args = args
1435 self.tests = tests or set() 1450 self.tests = tests or set()
1436 1451
1437 def __repr__(self): 1452 def __repr__(self):
1438 return "VirtualTestSuite('%s', '%s', %s)" % (self.name, self.base, self. args) 1453 return "VirtualTestSuite('%s', '%s', %s)" % (self.name, self.base, self. args)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698