Outcome list format: [condition, outcome, outcome, ...]
(rule, outcomes, variables, target_dict)
| 191 | |
| 192 | |
| 193 | def _ParseOutcomeList(rule, outcomes, variables, target_dict): |
| 194 | """Outcome list format: [condition, outcome, outcome, ...]""" |
| 195 | |
| 196 | result = set([]) |
| 197 | if type(outcomes) == str: |
| 198 | outcomes = [outcomes] |
| 199 | for item in outcomes: |
| 200 | if type(item) == str: |
| 201 | result.add(item) |
| 202 | elif type(item) == list: |
| 203 | condition = item[0] |
| 204 | exp = _EvalExpression(condition, variables) |
| 205 | assert exp != VARIANT_EXPRESSION, ( |
| 206 | "Nested variant expressions are not supported") |
| 207 | if exp is False: |
| 208 | continue |
| 209 | |
| 210 | # Ensure nobody uses an identifier by mistake, like "default", |
| 211 | # which would evaluate to true here otherwise. |
| 212 | assert exp is True, "Make sure expressions evaluate to boolean values" |
| 213 | |
| 214 | for outcome in item[1:]: |
| 215 | assert type(outcome) == str |
| 216 | result.add(outcome) |
| 217 | else: |
| 218 | assert False |
| 219 | if len(result) == 0: |
| 220 | return |
| 221 | if rule in target_dict: |
| 222 | # A FAIL without PASS in one rule has always precedence over a single |
| 223 | # PASS (without FAIL) in another. Otherwise the default PASS expectation |
| 224 | # in a rule with a modifier (e.g. PASS, SLOW) would be joined to a FAIL |
| 225 | # from another rule (which intended to mark a test as FAIL and not as |
| 226 | # PASS and FAIL). |
| 227 | if _JoinsPassAndFail(target_dict[rule], result): |
| 228 | target_dict[rule] -= set([PASS]) |
| 229 | if _JoinsPassAndFail(result, target_dict[rule]): |
| 230 | result -= set([PASS]) |
| 231 | target_dict[rule] |= result |
| 232 | else: |
| 233 | target_dict[rule] = result |
| 234 | |
| 235 | |
| 236 | def ReadContent(content): |
no test coverage detected