The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.
Please select the desired protocol below to get the URL.
This URL has Read-Only access.
main_repo / deps / v8 / tools / testrunner / local / statusfile.py @ f230a1cf
History | View | Annotate | Download (4.21 KB)
1 |
# Copyright 2012 the V8 project authors. All rights reserved.
|
---|---|
2 |
# Redistribution and use in source and binary forms, with or without
|
3 |
# modification, are permitted provided that the following conditions are
|
4 |
# met:
|
5 |
#
|
6 |
# * Redistributions of source code must retain the above copyright
|
7 |
# notice, this list of conditions and the following disclaimer.
|
8 |
# * Redistributions in binary form must reproduce the above
|
9 |
# copyright notice, this list of conditions and the following
|
10 |
# disclaimer in the documentation and/or other materials provided
|
11 |
# with the distribution.
|
12 |
# * Neither the name of Google Inc. nor the names of its
|
13 |
# contributors may be used to endorse or promote products derived
|
14 |
# from this software without specific prior written permission.
|
15 |
#
|
16 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17 |
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18 |
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19 |
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
20 |
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21 |
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22 |
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23 |
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24 |
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25 |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26 |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27 |
|
28 |
|
29 |
# These outcomes can occur in a TestCase's outcomes list:
|
30 |
SKIP = "SKIP"
|
31 |
FAIL = "FAIL"
|
32 |
PASS = "PASS"
|
33 |
OKAY = "OKAY"
|
34 |
TIMEOUT = "TIMEOUT"
|
35 |
CRASH = "CRASH"
|
36 |
SLOW = "SLOW"
|
37 |
FLAKY = "FLAKY"
|
38 |
NO_VARIANTS = "NO_VARIANTS"
|
39 |
# These are just for the status files and are mapped below in DEFS:
|
40 |
FAIL_OK = "FAIL_OK"
|
41 |
PASS_OR_FAIL = "PASS_OR_FAIL"
|
42 |
|
43 |
ALWAYS = "ALWAYS"
|
44 |
|
45 |
KEYWORDS = {} |
46 |
for key in [SKIP, FAIL, PASS, OKAY, TIMEOUT, CRASH, SLOW, FLAKY, FAIL_OK, |
47 |
NO_VARIANTS, PASS_OR_FAIL, ALWAYS]: |
48 |
KEYWORDS[key] = key |
49 |
|
50 |
DEFS = {FAIL_OK: [FAIL, OKAY], |
51 |
PASS_OR_FAIL: [PASS, FAIL]} |
52 |
|
53 |
# Support arches, modes to be written as keywords instead of strings.
|
54 |
VARIABLES = {ALWAYS: True}
|
55 |
for var in ["debug", "release", "android_arm", "android_ia32", "arm", "ia32", |
56 |
"mipsel", "x64", "nacl_ia32", "nacl_x64", "macos", "windows", |
57 |
"linux"]:
|
58 |
VARIABLES[var] = var |
59 |
|
60 |
|
61 |
def DoSkip(outcomes): |
62 |
return SKIP in outcomes or SLOW in outcomes |
63 |
|
64 |
|
65 |
def OnlyStandardVariant(outcomes): |
66 |
return NO_VARIANTS in outcomes |
67 |
|
68 |
|
69 |
def IsFlaky(outcomes): |
70 |
return FLAKY in outcomes |
71 |
|
72 |
|
73 |
def IsPassOrFail(outcomes): |
74 |
return ((PASS in outcomes) and (FAIL in outcomes) and |
75 |
(not CRASH in outcomes) and (not OKAY in outcomes)) |
76 |
|
77 |
|
78 |
def IsFailOk(outcomes): |
79 |
return (FAIL in outcomes) and (OKAY in outcomes) |
80 |
|
81 |
|
82 |
def _AddOutcome(result, new): |
83 |
global DEFS
|
84 |
if new in DEFS: |
85 |
mapped = DEFS[new] |
86 |
if type(mapped) == list: |
87 |
for m in mapped: |
88 |
_AddOutcome(result, m) |
89 |
elif type(mapped) == str: |
90 |
_AddOutcome(result, mapped) |
91 |
else:
|
92 |
result.add(new) |
93 |
|
94 |
|
95 |
def _ParseOutcomeList(rule, outcomes, target_dict, variables): |
96 |
result = set([])
|
97 |
if type(outcomes) == str: |
98 |
outcomes = [outcomes] |
99 |
for item in outcomes: |
100 |
if type(item) == str: |
101 |
_AddOutcome(result, item) |
102 |
elif type(item) == list: |
103 |
if not eval(item[0], variables): continue |
104 |
for outcome in item[1:]: |
105 |
assert type(outcome) == str |
106 |
_AddOutcome(result, outcome) |
107 |
else:
|
108 |
assert False |
109 |
if len(result) == 0: return |
110 |
if rule in target_dict: |
111 |
target_dict[rule] |= result |
112 |
else:
|
113 |
target_dict[rule] = result |
114 |
|
115 |
|
116 |
def ReadStatusFile(path, variables): |
117 |
with open(path) as f: |
118 |
global KEYWORDS
|
119 |
contents = eval(f.read(), KEYWORDS)
|
120 |
|
121 |
rules = {} |
122 |
wildcards = {} |
123 |
variables.update(VARIABLES) |
124 |
for section in contents: |
125 |
assert type(section) == list |
126 |
assert len(section) == 2 |
127 |
if not eval(section[0], variables): continue |
128 |
section = section[1]
|
129 |
assert type(section) == dict |
130 |
for rule in section: |
131 |
assert type(rule) == str |
132 |
if rule[-1] == '*': |
133 |
_ParseOutcomeList(rule, section[rule], wildcards, variables) |
134 |
else:
|
135 |
_ParseOutcomeList(rule, section[rule], rules, variables) |
136 |
return rules, wildcards
|