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