OLD | NEW |
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 return "d8" | 59 return "d8" |
60 | 60 |
61 def suffix(self): | 61 def suffix(self): |
62 return ".js" | 62 return ".js" |
63 | 63 |
64 def status_file(self): | 64 def status_file(self): |
65 return "%s/%s.status" % (self.root, self.name) | 65 return "%s/%s.status" % (self.root, self.name) |
66 | 66 |
67 # Used in the status file and for stdout printing. | 67 # Used in the status file and for stdout printing. |
68 def CommonTestName(self, testcase): | 68 def CommonTestName(self, testcase): |
69 if utils.IsWindows(): | 69 return testcase.path |
70 return testcase.path.replace("\\", "/") | |
71 else: | |
72 return testcase.path | |
73 | 70 |
74 def ListTests(self, context): | 71 def ListTests(self, context): |
75 raise NotImplementedError | 72 raise NotImplementedError |
76 | 73 |
77 def VariantFlags(self): | 74 def VariantFlags(self): |
78 return None | 75 return None |
79 | 76 |
80 def DownloadData(self): | 77 def DownloadData(self): |
81 pass | 78 pass |
82 | 79 |
83 def ReadStatusFile(self, variables): | 80 def ReadStatusFile(self, variables): |
84 (self.rules, self.wildcards) = \ | 81 (self.rules, self.wildcards) = \ |
85 statusfile.ReadStatusFile(self.status_file(), variables) | 82 statusfile.ReadStatusFile(self.status_file(), variables) |
86 | 83 |
87 def ReadTestCases(self, context): | 84 def ReadTestCases(self, context): |
88 self.tests = self.ListTests(context) | 85 self.tests = self.ListTests(context) |
89 | 86 |
90 @staticmethod | 87 def FilterTestCasesByStatus(self, warn_unused_rules): |
91 def _FilterFlaky(flaky, mode): | |
92 return (mode == "run" and not flaky) or (mode == "skip" and flaky) | |
93 | |
94 def FilterTestCasesByStatus(self, warn_unused_rules, flaky_tests="dontcare"): | |
95 filtered = [] | 88 filtered = [] |
96 used_rules = set() | 89 used_rules = set() |
97 for t in self.tests: | 90 for t in self.tests: |
98 flaky = False | |
99 testname = self.CommonTestName(t) | 91 testname = self.CommonTestName(t) |
| 92 if utils.IsWindows(): |
| 93 testname = testname.replace("\\", "/") |
100 if testname in self.rules: | 94 if testname in self.rules: |
101 used_rules.add(testname) | 95 used_rules.add(testname) |
102 # Even for skipped tests, as the TestCase object stays around and | 96 outcomes = self.rules[testname] |
103 # PrintReport() uses it. | 97 t.outcomes = outcomes # Even for skipped tests, as the TestCase |
104 t.outcomes = self.rules[testname] | 98 # object stays around and PrintReport() uses it. |
105 if statusfile.DoSkip(t.outcomes): | 99 if statusfile.DoSkip(outcomes): |
106 continue # Don't add skipped tests to |filtered|. | 100 continue # Don't add skipped tests to |filtered|. |
107 flaky = statusfile.IsFlaky(t.outcomes) | 101 if len(self.wildcards) != 0: |
108 skip = False | 102 skip = False |
109 for rule in self.wildcards: | 103 for rule in self.wildcards: |
110 assert rule[-1] == '*' | 104 assert rule[-1] == '*' |
111 if testname.startswith(rule[:-1]): | 105 if testname.startswith(rule[:-1]): |
112 used_rules.add(rule) | 106 used_rules.add(rule) |
113 t.outcomes = self.wildcards[rule] | 107 outcomes = self.wildcards[rule] |
114 if statusfile.DoSkip(t.outcomes): | 108 t.outcomes = outcomes |
115 skip = True | 109 if statusfile.DoSkip(outcomes): |
116 break # "for rule in self.wildcards" | 110 skip = True |
117 flaky = flaky or statusfile.IsFlaky(t.outcomes) | 111 break # "for rule in self.wildcards" |
118 if skip or self._FilterFlaky(flaky, flaky_tests): | 112 if skip: continue # "for t in self.tests" |
119 continue # "for t in self.tests" | |
120 filtered.append(t) | 113 filtered.append(t) |
121 self.tests = filtered | 114 self.tests = filtered |
122 | 115 |
123 if not warn_unused_rules: | 116 if not warn_unused_rules: |
124 return | 117 return |
125 | 118 |
126 for rule in self.rules: | 119 for rule in self.rules: |
127 if rule not in used_rules: | 120 if rule not in used_rules: |
128 print("Unused rule: %s -> %s" % (rule, self.rules[rule])) | 121 print("Unused rule: %s -> %s" % (rule, self.rules[rule])) |
129 for rule in self.wildcards: | 122 for rule in self.wildcards: |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 def StripOutputForTransmit(self, testcase): | 178 def StripOutputForTransmit(self, testcase): |
186 if not self.HasUnexpectedOutput(testcase): | 179 if not self.HasUnexpectedOutput(testcase): |
187 testcase.output.stdout = "" | 180 testcase.output.stdout = "" |
188 testcase.output.stderr = "" | 181 testcase.output.stderr = "" |
189 | 182 |
190 def CalculateTotalDuration(self): | 183 def CalculateTotalDuration(self): |
191 self.total_duration = 0.0 | 184 self.total_duration = 0.0 |
192 for t in self.tests: | 185 for t in self.tests: |
193 self.total_duration += t.duration | 186 self.total_duration += t.duration |
194 return self.total_duration | 187 return self.total_duration |
OLD | NEW |