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

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

Issue 2829993002: webkitpy: Prevent the addition of duplicate virtual tests. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base_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) 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 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 # PhysicalTestSuite('svg', ['--force-compositing-mode']), 1474 # PhysicalTestSuite('svg', ['--force-compositing-mode']),
1475 PhysicalTestSuite('fast/text', ['--enable-direct-write', '--enable-f ont-antialiasing']), 1475 PhysicalTestSuite('fast/text', ['--enable-direct-write', '--enable-f ont-antialiasing']),
1476 ] 1476 ]
1477 1477
1478 def virtual_test_suites(self): 1478 def virtual_test_suites(self):
1479 if self._virtual_test_suites is None: 1479 if self._virtual_test_suites is None:
1480 path_to_virtual_test_suites = self._filesystem.join(self.layout_test s_dir(), 'VirtualTestSuites') 1480 path_to_virtual_test_suites = self._filesystem.join(self.layout_test s_dir(), 'VirtualTestSuites')
1481 assert self._filesystem.exists(path_to_virtual_test_suites), 'Layout Tests/VirtualTestSuites not found' 1481 assert self._filesystem.exists(path_to_virtual_test_suites), 'Layout Tests/VirtualTestSuites not found'
1482 try: 1482 try:
1483 test_suite_json = json.loads(self._filesystem.read_text_file(pat h_to_virtual_test_suites)) 1483 test_suite_json = json.loads(self._filesystem.read_text_file(pat h_to_virtual_test_suites))
1484 self._virtual_test_suites = [VirtualTestSuite(**d) for d in test _suite_json] 1484 self._virtual_test_suites = []
1485 for json_config in test_suite_json:
1486 vts = VirtualTestSuite(**json_config)
1487 if vts in self._virtual_test_suites:
1488 raise ValueError('LayoutTests/VirtualTestSuites contains duplicate definition: %r' % json_config)
1489 self._virtual_test_suites.append(vts)
1485 except ValueError as error: 1490 except ValueError as error:
1486 raise ValueError('LayoutTests/VirtualTestSuites is not a valid J SON file: %s' % error) 1491 raise ValueError('LayoutTests/VirtualTestSuites is not a valid J SON file: %s' % error)
1487 return self._virtual_test_suites 1492 return self._virtual_test_suites
1488 1493
1489 def _all_virtual_tests(self, suites): 1494 def _all_virtual_tests(self, suites):
1490 tests = [] 1495 tests = []
1491 for suite in suites: 1496 for suite in suites:
1492 self._populate_virtual_suite(suite) 1497 self._populate_virtual_suite(suite)
1493 tests.extend(suite.tests.keys()) 1498 tests.extend(suite.tests.keys())
1494 return tests 1499 return tests
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 assert '/' not in prefix, "Virtual test suites prefixes cannot contain / 's: %s" % prefix 1615 assert '/' not in prefix, "Virtual test suites prefixes cannot contain / 's: %s" % prefix
1611 self.name = 'virtual/' + prefix + '/' + base 1616 self.name = 'virtual/' + prefix + '/' + base
1612 self.base = base 1617 self.base = base
1613 self.args = args 1618 self.args = args
1614 self.reference_args = [] if references_use_default_args else args 1619 self.reference_args = [] if references_use_default_args else args
1615 self.tests = {} 1620 self.tests = {}
1616 1621
1617 def __repr__(self): 1622 def __repr__(self):
1618 return "VirtualTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, s elf.args, self.reference_args) 1623 return "VirtualTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, s elf.args, self.reference_args)
1619 1624
1625 def __eq__(self, other):
1626 return (
1627 self.name == other.name and
1628 self.base == other.base and
1629 self.args == other.args and
1630 self.reference_args == other.reference_args)
1631
1620 1632
1621 class PhysicalTestSuite(object): 1633 class PhysicalTestSuite(object):
1622 1634
1623 def __init__(self, base, args, reference_args=None): 1635 def __init__(self, base, args, reference_args=None):
1624 self.name = base 1636 self.name = base
1625 self.base = base 1637 self.base = base
1626 self.args = args 1638 self.args = args
1627 self.reference_args = args if reference_args is None else reference_args 1639 self.reference_args = args if reference_args is None else reference_args
1628 self.tests = set() 1640 self.tests = set()
1629 1641
1630 def __repr__(self): 1642 def __repr__(self):
1631 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args) 1643 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args)
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698