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

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py

Issue 302003009: Make rebaselining not use gigabytes of memory. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: cleanup style Created 6 years, 6 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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 1019
1020 def _process_tests_without_expectations(self): 1020 def _process_tests_without_expectations(self):
1021 if self._full_test_list: 1021 if self._full_test_list:
1022 for test in self._full_test_list: 1022 for test in self._full_test_list:
1023 if not self._model.has_test(test): 1023 if not self._model.has_test(test):
1024 self._model.add_expectation_line(TestExpectationLine.create_ passing_expectation(test)) 1024 self._model.add_expectation_line(TestExpectationLine.create_ passing_expectation(test))
1025 1025
1026 def has_warnings(self): 1026 def has_warnings(self):
1027 return self._has_warnings 1027 return self._has_warnings
1028 1028
1029 def remove_configuration_from_test(self, test, test_configuration): 1029 def remove_configurations(self, removals):
1030 expectations_to_remove = [] 1030 expectations_to_remove = []
1031 modified_expectations = [] 1031 modified_expectations = []
1032 1032
1033 for expectation in self._expectations: 1033 for removal in removals:
Dirk Pranke 2014/06/01 21:25:33 Nit: I'd probably change this to 'for test, test_c
ojan 2014/06/02 01:41:15 Indeed. It's clearly been a while since I've writt
1034 if expectation.name != test or not expectation.parsed_expectations: 1034 test = removal[0]
1035 continue 1035 test_configuration = removal[1]
1036 if test_configuration not in expectation.matching_configurations: 1036 for expectation in self._expectations:
1037 continue 1037 if expectation.name != test or not expectation.parsed_expectatio ns:
1038 continue
1039 if test_configuration not in expectation.matching_configurations :
1040 continue
1038 1041
1039 expectation.matching_configurations.remove(test_configuration) 1042 expectation.matching_configurations.remove(test_configuration)
1040 if expectation.matching_configurations: 1043 if expectation.matching_configurations:
1041 modified_expectations.append(expectation) 1044 modified_expectations.append(expectation)
1042 else: 1045 else:
1043 expectations_to_remove.append(expectation) 1046 expectations_to_remove.append(expectation)
1044 1047
1045 for expectation in expectations_to_remove: 1048 for expectation in expectations_to_remove:
1046 index = self._expectations.index(expectation) 1049 index = self._expectations.index(expectation)
1047 self._expectations.remove(expectation) 1050 self._expectations.remove(expectation)
1048 1051
1049 if index == len(self._expectations) or self._expectations[index].is_ whitespace_or_comment(): 1052 if index == len(self._expectations) or self._expectations[index].is_ whitespace_or_comment():
1050 while index and self._expectations[index - 1].is_whitespace_or_c omment(): 1053 while index and self._expectations[index - 1].is_whitespace_or_c omment():
1051 index = index - 1 1054 index = index - 1
1052 self._expectations.pop(index) 1055 self._expectations.pop(index)
1053 1056
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 # If reconstitute_only_these is an empty list, we want to return ori ginal_string. 1106 # If reconstitute_only_these is an empty list, we want to return ori ginal_string.
1104 # So we need to compare reconstitute_only_these to None, not just ch eck if it's falsey. 1107 # So we need to compare reconstitute_only_these to None, not just ch eck if it's falsey.
1105 if reconstitute_only_these is None or expectation_line in reconstitu te_only_these: 1108 if reconstitute_only_these is None or expectation_line in reconstitu te_only_these:
1106 return expectation_line.to_string(test_configuration_converter) 1109 return expectation_line.to_string(test_configuration_converter)
1107 return expectation_line.original_string 1110 return expectation_line.original_string
1108 1111
1109 def nones_out(expectation_line): 1112 def nones_out(expectation_line):
1110 return expectation_line is not None 1113 return expectation_line is not None
1111 1114
1112 return "\n".join(filter(nones_out, map(serialize, expectation_lines))) 1115 return "\n".join(filter(nones_out, map(serialize, expectation_lines)))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698