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