3 # Permission is hereby granted, free of charge, to any person
4 # obtaining a copy of this software and associated documentation
5 # files (the "Software"), to deal in the Software without
6 # restriction, including without limitation the rights to use,
7 # copy, modify, merge, publish, distribute, sublicense, and/or
8 # sell copies of the Software, and to permit persons to whom the
9 # Software is furnished to do so, subject to the following
12 # This permission notice shall be included in all copies or
13 # substantial portions of the Software.
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
16 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
17 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
18 # PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR(S) BE
19 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
21 # OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 # DEALINGS IN THE SOFTWARE.
27 #############################################################################
28 ##### Vector indicating the number of subtests that have passed/failed/etc.
29 #############################################################################
31 def __init__(self
, p
, w
, f
, s
):
38 self
.passnr
+= o
.passnr
39 self
.warnnr
+= o
.warnnr
40 self
.failnr
+= o
.failnr
41 self
.skipnr
+= o
.skipnr
44 #############################################################################
45 ##### TestSummary: Summarize the results for one test across a
46 ##### number of testruns
47 #############################################################################
49 def __init__(self
, summary
, path
, name
, results
):
51 summary is the root summary object
52 path is the path to the group (e.g. shaders/glean-fragProg1)
53 name is the display name of the group (e.g. glean-fragProg1)
54 results is an array of TestResult instances, one per testrun
56 self
.summary
= summary
59 self
.results
= results
[:]
61 for j
in range(len(self
.results
)):
62 result
= self
.results
[j
]
63 result
.testrun
= self
.summary
.testruns
[j
]
65 if 'result' in result
:
66 result
.status
= result
['result']
69 'pass': PassVector(1,0,0,0),
70 'warn': PassVector(0,1,0,0),
71 'fail': PassVector(0,0,1,0),
72 'skip': PassVector(0,0,0,1)
75 if result
.status
not in vectormap
:
76 result
.status
= 'warn'
78 result
.passvector
= vectormap
[result
.status
]
80 stati
= set([result
.status
for result
in results
])
81 self
.changes
= len(stati
) > 1
82 self
.problems
= len(stati
- set(['pass', 'skip'])) > 0
87 #############################################################################
88 ##### GroupSummary: Summarize a group of tests
89 #############################################################################
91 def __init__(self
, summary
, path
, name
, results
):
93 summary is the root summary object
94 path is the path to the group (e.g. shaders/glean-fragProg1)
95 name is the display name of the group (e.g. glean-fragProg1)
96 results is an array of GroupResult instances, one per testrun
98 self
.summary
= summary
101 self
.results
= results
[:]
103 self
.problems
= False
106 # Perform some initial annotations
107 for j
in range(len(self
.results
)):
108 result
= self
.results
[j
]
109 result
.passvector
= PassVector(0, 0, 0, 0)
110 result
.testrun
= self
.summary
.testruns
[j
]
112 # Collect, create and annotate children
113 for result
in self
.results
:
115 if name
in self
.children
:
119 if len(self
.path
) > 0:
120 childpath
= self
.path
+ '/' + childpath
122 if isinstance(result
[name
], core
.GroupResult
):
123 childresults
= [r
.get(name
, core
.GroupResult())
124 for r
in self
.results
]
126 self
.children
[name
] = GroupSummary(
133 childresults
= [r
.get(name
, core
.TestResult({}, { 'result': 'skip' }))
134 for r
in self
.results
]
136 self
.children
[name
] = TestSummary(
143 for j
in range(len(self
.results
)):
144 self
.results
[j
].passvector
.add(childresults
[j
].passvector
)
146 self
.changes
= self
.changes
or self
.children
[name
].changes
147 self
.problems
= self
.problems
or self
.children
[name
].problems
151 Returns an array of all child TestSummary instances.
153 return [t
for name
in self
.children
for t
in self
.children
[name
].allTests()]
155 #############################################################################
156 ##### Summary: Summarize an array of testruns
157 #############################################################################
159 def __init__(self
, testruns
):
161 testruns is an array of TestrunResult instances
163 self
.testruns
= testruns
164 self
.root
= GroupSummary(self
, '', 'All', [tr
.results
for tr
in testruns
])
168 Returns an array of all child TestSummary instances.
170 return self
.root
.allTests()