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/testrunner/local/testsuite.py

Issue 85733003: Make test runner more flexible for running fast tests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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/testrunner/local/statusfile.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 2012 the V8 project authors. All rights reserved. 1 # Copyright 2012 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 (self.rules, self.wildcards) = \ 86 (self.rules, self.wildcards) = \
87 statusfile.ReadStatusFile(self.status_file(), variables) 87 statusfile.ReadStatusFile(self.status_file(), variables)
88 88
89 def ReadTestCases(self, context): 89 def ReadTestCases(self, context):
90 self.tests = self.ListTests(context) 90 self.tests = self.ListTests(context)
91 91
92 @staticmethod 92 @staticmethod
93 def _FilterFlaky(flaky, mode): 93 def _FilterFlaky(flaky, mode):
94 return (mode == "run" and not flaky) or (mode == "skip" and flaky) 94 return (mode == "run" and not flaky) or (mode == "skip" and flaky)
95 95
96 def FilterTestCasesByStatus(self, warn_unused_rules, flaky_tests="dontcare"): 96 @staticmethod
97 def _FilterSlow(slow, mode):
98 return (mode == "run" and not slow) or (mode == "skip" and slow)
99
100 @staticmethod
101 def _FilterPassFail(pass_fail, mode):
102 return (mode == "run" and not pass_fail) or (mode == "skip" and pass_fail)
103
104 def FilterTestCasesByStatus(self, warn_unused_rules,
105 flaky_tests="dontcare",
106 slow_tests="dontcare",
107 pass_fail_tests="dontcare"):
97 filtered = [] 108 filtered = []
98 used_rules = set() 109 used_rules = set()
99 for t in self.tests: 110 for t in self.tests:
100 flaky = False 111 flaky = False
112 slow = False
113 pass_fail = False
101 testname = self.CommonTestName(t) 114 testname = self.CommonTestName(t)
102 if testname in self.rules: 115 if testname in self.rules:
103 used_rules.add(testname) 116 used_rules.add(testname)
104 # Even for skipped tests, as the TestCase object stays around and 117 # Even for skipped tests, as the TestCase object stays around and
105 # PrintReport() uses it. 118 # PrintReport() uses it.
106 t.outcomes = self.rules[testname] 119 t.outcomes = self.rules[testname]
107 if statusfile.DoSkip(t.outcomes): 120 if statusfile.DoSkip(t.outcomes):
108 continue # Don't add skipped tests to |filtered|. 121 continue # Don't add skipped tests to |filtered|.
109 flaky = statusfile.IsFlaky(t.outcomes) 122 flaky = statusfile.IsFlaky(t.outcomes)
123 slow = statusfile.IsSlow(t.outcomes)
124 pass_fail = statusfile.IsPassOrFail(t.outcomes)
110 skip = False 125 skip = False
111 for rule in self.wildcards: 126 for rule in self.wildcards:
112 assert rule[-1] == '*' 127 assert rule[-1] == '*'
113 if testname.startswith(rule[:-1]): 128 if testname.startswith(rule[:-1]):
114 used_rules.add(rule) 129 used_rules.add(rule)
115 t.outcomes = self.wildcards[rule] 130 t.outcomes = self.wildcards[rule]
116 if statusfile.DoSkip(t.outcomes): 131 if statusfile.DoSkip(t.outcomes):
117 skip = True 132 skip = True
118 break # "for rule in self.wildcards" 133 break # "for rule in self.wildcards"
119 flaky = flaky or statusfile.IsFlaky(t.outcomes) 134 flaky = flaky or statusfile.IsFlaky(t.outcomes)
120 if skip or self._FilterFlaky(flaky, flaky_tests): 135 slow = slow or statusfile.IsSlow(t.outcomes)
136 pass_fail = pass_fail or statusfile.IsPassOrFail(t.outcomes)
137 if (skip or self._FilterFlaky(flaky, flaky_tests)
138 or self._FilterSlow(slow, slow_tests)
139 or self._FilterPassFail(pass_fail, pass_fail_tests)):
121 continue # "for t in self.tests" 140 continue # "for t in self.tests"
122 filtered.append(t) 141 filtered.append(t)
123 self.tests = filtered 142 self.tests = filtered
124 143
125 if not warn_unused_rules: 144 if not warn_unused_rules:
126 return 145 return
127 146
128 for rule in self.rules: 147 for rule in self.rules:
129 if rule not in used_rules: 148 if rule not in used_rules:
130 print("Unused rule: %s -> %s" % (rule, self.rules[rule])) 149 print("Unused rule: %s -> %s" % (rule, self.rules[rule]))
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 def StripOutputForTransmit(self, testcase): 206 def StripOutputForTransmit(self, testcase):
188 if not self.HasUnexpectedOutput(testcase): 207 if not self.HasUnexpectedOutput(testcase):
189 testcase.output.stdout = "" 208 testcase.output.stdout = ""
190 testcase.output.stderr = "" 209 testcase.output.stderr = ""
191 210
192 def CalculateTotalDuration(self): 211 def CalculateTotalDuration(self):
193 self.total_duration = 0.0 212 self.total_duration = 0.0
194 for t in self.tests: 213 for t in self.tests:
195 self.total_duration += t.duration 214 self.total_duration += t.duration
196 return self.total_duration 215 return self.total_duration
OLDNEW
« no previous file with comments | « tools/testrunner/local/statusfile.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698