xref: /aosp_15_r20/external/deqp/executor/xeBatchResult.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1*35238bceSAndroid Build Coastguard Worker #ifndef _XEBATCHRESULT_HPP
2*35238bceSAndroid Build Coastguard Worker #define _XEBATCHRESULT_HPP
3*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
4*35238bceSAndroid Build Coastguard Worker  * drawElements Quality Program Test Executor
5*35238bceSAndroid Build Coastguard Worker  * ------------------------------------------
6*35238bceSAndroid Build Coastguard Worker  *
7*35238bceSAndroid Build Coastguard Worker  * Copyright 2014 The Android Open Source Project
8*35238bceSAndroid Build Coastguard Worker  *
9*35238bceSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
10*35238bceSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
11*35238bceSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
12*35238bceSAndroid Build Coastguard Worker  *
13*35238bceSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
14*35238bceSAndroid Build Coastguard Worker  *
15*35238bceSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
16*35238bceSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
17*35238bceSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18*35238bceSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
19*35238bceSAndroid Build Coastguard Worker  * limitations under the License.
20*35238bceSAndroid Build Coastguard Worker  *
21*35238bceSAndroid Build Coastguard Worker  *//*!
22*35238bceSAndroid Build Coastguard Worker  * \file
23*35238bceSAndroid Build Coastguard Worker  * \brief Test batch result.
24*35238bceSAndroid Build Coastguard Worker  *//*--------------------------------------------------------------------*/
25*35238bceSAndroid Build Coastguard Worker 
26*35238bceSAndroid Build Coastguard Worker #include "xeDefs.hpp"
27*35238bceSAndroid Build Coastguard Worker #include "xeTestCase.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "xeTestCaseResult.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "deSharedPtr.hpp"
30*35238bceSAndroid Build Coastguard Worker 
31*35238bceSAndroid Build Coastguard Worker #include <string>
32*35238bceSAndroid Build Coastguard Worker #include <vector>
33*35238bceSAndroid Build Coastguard Worker #include <map>
34*35238bceSAndroid Build Coastguard Worker 
35*35238bceSAndroid Build Coastguard Worker namespace xe
36*35238bceSAndroid Build Coastguard Worker {
37*35238bceSAndroid Build Coastguard Worker 
38*35238bceSAndroid Build Coastguard Worker class SessionInfo
39*35238bceSAndroid Build Coastguard Worker {
40*35238bceSAndroid Build Coastguard Worker public:
41*35238bceSAndroid Build Coastguard Worker     // Produced by test binary.
42*35238bceSAndroid Build Coastguard Worker     std::string releaseName;
43*35238bceSAndroid Build Coastguard Worker     std::string releaseId;
44*35238bceSAndroid Build Coastguard Worker     std::string targetName;
45*35238bceSAndroid Build Coastguard Worker     std::string qpaCommandLineParameters;
46*35238bceSAndroid Build Coastguard Worker 
47*35238bceSAndroid Build Coastguard Worker     // Produced by Candy.
48*35238bceSAndroid Build Coastguard Worker     std::string candyTargetName;
49*35238bceSAndroid Build Coastguard Worker     std::string configName;
50*35238bceSAndroid Build Coastguard Worker     std::string resultName;
51*35238bceSAndroid Build Coastguard Worker     std::string timestamp;
52*35238bceSAndroid Build Coastguard Worker };
53*35238bceSAndroid Build Coastguard Worker 
54*35238bceSAndroid Build Coastguard Worker class InfoLog
55*35238bceSAndroid Build Coastguard Worker {
56*35238bceSAndroid Build Coastguard Worker public:
57*35238bceSAndroid Build Coastguard Worker     InfoLog(void);
58*35238bceSAndroid Build Coastguard Worker 
getSize(void) const59*35238bceSAndroid Build Coastguard Worker     size_t getSize(void) const
60*35238bceSAndroid Build Coastguard Worker     {
61*35238bceSAndroid Build Coastguard Worker         return m_data.size();
62*35238bceSAndroid Build Coastguard Worker     }
getBytes(void) const63*35238bceSAndroid Build Coastguard Worker     const uint8_t *getBytes(void) const
64*35238bceSAndroid Build Coastguard Worker     {
65*35238bceSAndroid Build Coastguard Worker         return !m_data.empty() ? &m_data[0] : DE_NULL;
66*35238bceSAndroid Build Coastguard Worker     }
67*35238bceSAndroid Build Coastguard Worker 
68*35238bceSAndroid Build Coastguard Worker     void append(const uint8_t *bytes, size_t numBytes);
69*35238bceSAndroid Build Coastguard Worker 
70*35238bceSAndroid Build Coastguard Worker private:
71*35238bceSAndroid Build Coastguard Worker     InfoLog(const InfoLog &other);
72*35238bceSAndroid Build Coastguard Worker     InfoLog &operator=(const InfoLog &other);
73*35238bceSAndroid Build Coastguard Worker 
74*35238bceSAndroid Build Coastguard Worker     std::vector<uint8_t> m_data;
75*35238bceSAndroid Build Coastguard Worker };
76*35238bceSAndroid Build Coastguard Worker 
77*35238bceSAndroid Build Coastguard Worker class TestCaseResultData
78*35238bceSAndroid Build Coastguard Worker {
79*35238bceSAndroid Build Coastguard Worker public:
80*35238bceSAndroid Build Coastguard Worker     TestCaseResultData(const char *casePath);
81*35238bceSAndroid Build Coastguard Worker     ~TestCaseResultData(void);
82*35238bceSAndroid Build Coastguard Worker 
getTestCasePath(void) const83*35238bceSAndroid Build Coastguard Worker     const char *getTestCasePath(void) const
84*35238bceSAndroid Build Coastguard Worker     {
85*35238bceSAndroid Build Coastguard Worker         return m_casePath.c_str();
86*35238bceSAndroid Build Coastguard Worker     }
87*35238bceSAndroid Build Coastguard Worker 
88*35238bceSAndroid Build Coastguard Worker     void setTestResult(TestStatusCode code, const char *details);
89*35238bceSAndroid Build Coastguard Worker 
getStatusCode(void) const90*35238bceSAndroid Build Coastguard Worker     TestStatusCode getStatusCode(void) const
91*35238bceSAndroid Build Coastguard Worker     {
92*35238bceSAndroid Build Coastguard Worker         return m_statusCode;
93*35238bceSAndroid Build Coastguard Worker     }
getStatusDetails(void) const94*35238bceSAndroid Build Coastguard Worker     const char *getStatusDetails(void) const
95*35238bceSAndroid Build Coastguard Worker     {
96*35238bceSAndroid Build Coastguard Worker         return m_statusDetails.c_str();
97*35238bceSAndroid Build Coastguard Worker     }
98*35238bceSAndroid Build Coastguard Worker 
getDataSize(void) const99*35238bceSAndroid Build Coastguard Worker     int getDataSize(void) const
100*35238bceSAndroid Build Coastguard Worker     {
101*35238bceSAndroid Build Coastguard Worker         return (int)m_data.size();
102*35238bceSAndroid Build Coastguard Worker     }
setDataSize(int size)103*35238bceSAndroid Build Coastguard Worker     void setDataSize(int size)
104*35238bceSAndroid Build Coastguard Worker     {
105*35238bceSAndroid Build Coastguard Worker         m_data.resize(size);
106*35238bceSAndroid Build Coastguard Worker     }
107*35238bceSAndroid Build Coastguard Worker 
getData(void) const108*35238bceSAndroid Build Coastguard Worker     const uint8_t *getData(void) const
109*35238bceSAndroid Build Coastguard Worker     {
110*35238bceSAndroid Build Coastguard Worker         return !m_data.empty() ? &m_data[0] : DE_NULL;
111*35238bceSAndroid Build Coastguard Worker     }
getData(void)112*35238bceSAndroid Build Coastguard Worker     uint8_t *getData(void)
113*35238bceSAndroid Build Coastguard Worker     {
114*35238bceSAndroid Build Coastguard Worker         return !m_data.empty() ? &m_data[0] : DE_NULL;
115*35238bceSAndroid Build Coastguard Worker     }
116*35238bceSAndroid Build Coastguard Worker 
117*35238bceSAndroid Build Coastguard Worker     void clear(void);
118*35238bceSAndroid Build Coastguard Worker 
119*35238bceSAndroid Build Coastguard Worker private:
120*35238bceSAndroid Build Coastguard Worker     // \note statusCode and statusDetails are either set by BatchExecutor or later parsed from data.
121*35238bceSAndroid Build Coastguard Worker     std::string m_casePath;
122*35238bceSAndroid Build Coastguard Worker     TestStatusCode m_statusCode;
123*35238bceSAndroid Build Coastguard Worker     std::string m_statusDetails;
124*35238bceSAndroid Build Coastguard Worker     std::vector<uint8_t> m_data;
125*35238bceSAndroid Build Coastguard Worker };
126*35238bceSAndroid Build Coastguard Worker 
127*35238bceSAndroid Build Coastguard Worker typedef de::SharedPtr<TestCaseResultData> TestCaseResultPtr;
128*35238bceSAndroid Build Coastguard Worker typedef de::SharedPtr<const TestCaseResultData> ConstTestCaseResultPtr;
129*35238bceSAndroid Build Coastguard Worker 
130*35238bceSAndroid Build Coastguard Worker class BatchResult
131*35238bceSAndroid Build Coastguard Worker {
132*35238bceSAndroid Build Coastguard Worker public:
133*35238bceSAndroid Build Coastguard Worker     BatchResult(void);
134*35238bceSAndroid Build Coastguard Worker     ~BatchResult(void);
135*35238bceSAndroid Build Coastguard Worker 
getSessionInfo(void) const136*35238bceSAndroid Build Coastguard Worker     const SessionInfo &getSessionInfo(void) const
137*35238bceSAndroid Build Coastguard Worker     {
138*35238bceSAndroid Build Coastguard Worker         return m_sessionInfo;
139*35238bceSAndroid Build Coastguard Worker     }
getSessionInfo(void)140*35238bceSAndroid Build Coastguard Worker     SessionInfo &getSessionInfo(void)
141*35238bceSAndroid Build Coastguard Worker     {
142*35238bceSAndroid Build Coastguard Worker         return m_sessionInfo;
143*35238bceSAndroid Build Coastguard Worker     }
144*35238bceSAndroid Build Coastguard Worker 
getNumTestCaseResults(void) const145*35238bceSAndroid Build Coastguard Worker     int getNumTestCaseResults(void) const
146*35238bceSAndroid Build Coastguard Worker     {
147*35238bceSAndroid Build Coastguard Worker         return (int)m_testCaseResults.size();
148*35238bceSAndroid Build Coastguard Worker     }
getTestCaseResult(int ndx) const149*35238bceSAndroid Build Coastguard Worker     ConstTestCaseResultPtr getTestCaseResult(int ndx) const
150*35238bceSAndroid Build Coastguard Worker     {
151*35238bceSAndroid Build Coastguard Worker         return ConstTestCaseResultPtr(m_testCaseResults[ndx]);
152*35238bceSAndroid Build Coastguard Worker     }
getTestCaseResult(int ndx)153*35238bceSAndroid Build Coastguard Worker     TestCaseResultPtr getTestCaseResult(int ndx)
154*35238bceSAndroid Build Coastguard Worker     {
155*35238bceSAndroid Build Coastguard Worker         return m_testCaseResults[ndx];
156*35238bceSAndroid Build Coastguard Worker     }
157*35238bceSAndroid Build Coastguard Worker 
158*35238bceSAndroid Build Coastguard Worker     bool hasTestCaseResult(const char *casePath) const;
159*35238bceSAndroid Build Coastguard Worker     ConstTestCaseResultPtr getTestCaseResult(const char *casePath) const;
160*35238bceSAndroid Build Coastguard Worker     TestCaseResultPtr getTestCaseResult(const char *casePath);
161*35238bceSAndroid Build Coastguard Worker 
162*35238bceSAndroid Build Coastguard Worker     TestCaseResultPtr createTestCaseResult(const char *casePath);
163*35238bceSAndroid Build Coastguard Worker 
164*35238bceSAndroid Build Coastguard Worker private:
165*35238bceSAndroid Build Coastguard Worker     BatchResult(const BatchResult &other);
166*35238bceSAndroid Build Coastguard Worker     BatchResult &operator=(const BatchResult &other);
167*35238bceSAndroid Build Coastguard Worker 
168*35238bceSAndroid Build Coastguard Worker     SessionInfo m_sessionInfo;
169*35238bceSAndroid Build Coastguard Worker     std::vector<TestCaseResultPtr> m_testCaseResults;
170*35238bceSAndroid Build Coastguard Worker     std::map<std::string, int> m_resultMap;
171*35238bceSAndroid Build Coastguard Worker };
172*35238bceSAndroid Build Coastguard Worker 
173*35238bceSAndroid Build Coastguard Worker } // namespace xe
174*35238bceSAndroid Build Coastguard Worker 
175*35238bceSAndroid Build Coastguard Worker #endif // _XEBATCHRESULT_HPP
176