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

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

Issue 1766583002: Added update_test_expectations script to remove non-flaky test expectations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mock out builders and specifiers, dont remove lines if bot results arent available Created 4 years, 9 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
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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 426
427 def is_invalid(self): 427 def is_invalid(self):
428 return bool(self.warnings and self.warnings != [TestExpectationParser.MI SSING_BUG_WARNING]) 428 return bool(self.warnings and self.warnings != [TestExpectationParser.MI SSING_BUG_WARNING])
429 429
430 def is_flaky(self): 430 def is_flaky(self):
431 return len(self.parsed_expectations) > 1 431 return len(self.parsed_expectations) > 1
432 432
433 def is_whitespace_or_comment(self): 433 def is_whitespace_or_comment(self):
434 return bool(re.match("^\s*$", self.original_string.split('#')[0])) 434 return bool(re.match("^\s*$", self.original_string.split('#')[0]))
435 435
436 def is_whitespace(self):
437 return self.is_whitespace_or_comment() and self.original_string.strip() == ""
438
439 def is_comment(self):
440 return self.is_whitespace_or_comment() and not self.is_whitespace()
441
436 @staticmethod 442 @staticmethod
437 def create_passing_expectation(test): 443 def create_passing_expectation(test):
438 expectation_line = TestExpectationLine() 444 expectation_line = TestExpectationLine()
439 expectation_line.name = test 445 expectation_line.name = test
440 expectation_line.path = test 446 expectation_line.path = test
441 expectation_line.parsed_expectations = set([PASS]) 447 expectation_line.parsed_expectations = set([PASS])
442 expectation_line.expectations = set(['PASS']) 448 expectation_line.expectations = set(['PASS'])
443 expectation_line.matching_tests = [test] 449 expectation_line.matching_tests = [test]
444 return expectation_line 450 return expectation_line
445 451
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 1008
1003 self._has_warnings = False 1009 self._has_warnings = False
1004 self._report_warnings() 1010 self._report_warnings()
1005 self._process_tests_without_expectations() 1011 self._process_tests_without_expectations()
1006 1012
1007 # TODO(ojan): Allow for removing skipped tests when getting the list of 1013 # TODO(ojan): Allow for removing skipped tests when getting the list of
1008 # tests to run, but not when getting metrics. 1014 # tests to run, but not when getting metrics.
1009 def model(self): 1015 def model(self):
1010 return self._model 1016 return self._model
1011 1017
1018 def expectations(self):
1019 return self._expectations
1020
1012 def get_needs_rebaseline_failures(self): 1021 def get_needs_rebaseline_failures(self):
1013 return self._model.get_test_set(NEEDS_REBASELINE) 1022 return self._model.get_test_set(NEEDS_REBASELINE)
1014 1023
1015 def get_rebaselining_failures(self): 1024 def get_rebaselining_failures(self):
1016 return self._model.get_test_set(REBASELINE) 1025 return self._model.get_test_set(REBASELINE)
1017 1026
1018 # FIXME: Change the callsites to use TestExpectationsModel and remove. 1027 # FIXME: Change the callsites to use TestExpectationsModel and remove.
1019 def get_expectations(self, test): 1028 def get_expectations(self, test):
1020 return self._model.get_expectations(test) 1029 return self._model.get_expectations(test)
1021 1030
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 # If reconstitute_only_these is an empty list, we want to return ori ginal_string. 1165 # If reconstitute_only_these is an empty list, we want to return ori ginal_string.
1157 # So we need to compare reconstitute_only_these to None, not just ch eck if it's falsey. 1166 # So we need to compare reconstitute_only_these to None, not just ch eck if it's falsey.
1158 if reconstitute_only_these is None or expectation_line in reconstitu te_only_these: 1167 if reconstitute_only_these is None or expectation_line in reconstitu te_only_these:
1159 return expectation_line.to_string(test_configuration_converter) 1168 return expectation_line.to_string(test_configuration_converter)
1160 return expectation_line.original_string 1169 return expectation_line.original_string
1161 1170
1162 def nones_out(expectation_line): 1171 def nones_out(expectation_line):
1163 return expectation_line is not None 1172 return expectation_line is not None
1164 1173
1165 return "\n".join(filter(nones_out, map(serialize, expectation_lines))) 1174 return "\n".join(filter(nones_out, map(serialize, expectation_lines)))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698