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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 mapped = DEFS[new] | 99 mapped = DEFS[new] |
100 if type(mapped) == list: | 100 if type(mapped) == list: |
101 for m in mapped: | 101 for m in mapped: |
102 _AddOutcome(result, m) | 102 _AddOutcome(result, m) |
103 elif type(mapped) == str: | 103 elif type(mapped) == str: |
104 _AddOutcome(result, mapped) | 104 _AddOutcome(result, mapped) |
105 else: | 105 else: |
106 result.add(new) | 106 result.add(new) |
107 | 107 |
108 | 108 |
| 109 def _JoinsPassAndFail(outcomes1, outcomes2): |
| 110 """Indicates if we join PASS and FAIL from two different outcome sets and |
| 111 the first doesn't already contain both. |
| 112 """ |
| 113 return ( |
| 114 PASS in outcomes1 and |
| 115 not FAIL in outcomes1 and |
| 116 FAIL in outcomes2 |
| 117 ) |
| 118 |
109 def _ParseOutcomeList(rule, outcomes, target_dict, variables): | 119 def _ParseOutcomeList(rule, outcomes, target_dict, variables): |
110 result = set([]) | 120 result = set([]) |
111 if type(outcomes) == str: | 121 if type(outcomes) == str: |
112 outcomes = [outcomes] | 122 outcomes = [outcomes] |
113 for item in outcomes: | 123 for item in outcomes: |
114 if type(item) == str: | 124 if type(item) == str: |
115 _AddOutcome(result, item) | 125 _AddOutcome(result, item) |
116 elif type(item) == list: | 126 elif type(item) == list: |
117 if not eval(item[0], variables): continue | 127 if not eval(item[0], variables): continue |
118 for outcome in item[1:]: | 128 for outcome in item[1:]: |
119 assert type(outcome) == str | 129 assert type(outcome) == str |
120 _AddOutcome(result, outcome) | 130 _AddOutcome(result, outcome) |
121 else: | 131 else: |
122 assert False | 132 assert False |
123 if len(result) == 0: return | 133 if len(result) == 0: return |
124 if rule in target_dict: | 134 if rule in target_dict: |
| 135 # A FAIL without PASS in one rule has always precedence over a single |
| 136 # PASS (without FAIL) in another. Otherwise the default PASS expectation |
| 137 # in a rule with a modifier (e.g. PASS, SLOW) would be joined to a FAIL |
| 138 # from another rule (which intended to mark a test as FAIL and not as |
| 139 # PASS and FAIL). |
| 140 if _JoinsPassAndFail(target_dict[rule], result): |
| 141 target_dict[rule] -= set([PASS]) |
| 142 if _JoinsPassAndFail(result, target_dict[rule]): |
| 143 result -= set([PASS]) |
125 target_dict[rule] |= result | 144 target_dict[rule] |= result |
126 else: | 145 else: |
127 target_dict[rule] = result | 146 target_dict[rule] = result |
128 | 147 |
129 | 148 |
130 def ReadContent(path): | 149 def ReadContent(path): |
131 with open(path) as f: | 150 with open(path) as f: |
132 global KEYWORDS | 151 global KEYWORDS |
133 return eval(f.read(), KEYWORDS) | 152 return eval(f.read(), KEYWORDS) |
134 | 153 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 for rule in section: | 191 for rule in section: |
173 _assert(type(rule) == str, "Rule key must be a string") | 192 _assert(type(rule) == str, "Rule key must be a string") |
174 _assert(not rule.startswith(root_prefix), | 193 _assert(not rule.startswith(root_prefix), |
175 "Suite name prefix must not be used in rule keys") | 194 "Suite name prefix must not be used in rule keys") |
176 _assert(not rule.endswith('.js'), | 195 _assert(not rule.endswith('.js'), |
177 ".js extension must not be used in rule keys.") | 196 ".js extension must not be used in rule keys.") |
178 return status["success"] | 197 return status["success"] |
179 except Exception as e: | 198 except Exception as e: |
180 print e | 199 print e |
181 return False | 200 return False |
OLD | NEW |