Merge vk-gl-cts/vulkan-cts-1.2.6 into vk-gl-cts/vulkan-cts-1.2.7
[platform/upstream/VK-GL-CTS.git] / executor / xeTestCaseResult.hpp
1 #ifndef _XETESTCASERESULT_HPP
2 #define _XETESTCASERESULT_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 case result models.
24  *//*--------------------------------------------------------------------*/
25
26 #include "xeDefs.hpp"
27 #include "xeTestCase.hpp"
28
29 #include <string>
30 #include <vector>
31 #include <ostream>
32
33 namespace xe
34 {
35
36 enum TestStatusCode
37 {
38         TESTSTATUSCODE_PASS,                                    //!< Test case passed.
39         TESTSTATUSCODE_FAIL,                                    //!< Test case failed (not passed).
40         TESTSTATUSCODE_QUALITY_WARNING,                 //!< Result within specification, but suspicious quality wise
41         TESTSTATUSCODE_COMPATIBILITY_WARNING,   //!< Result within specification, but likely to cause fragmentation
42         TESTSTATUSCODE_PENDING,                                 //!< Not yet started.
43         TESTSTATUSCODE_RUNNING,                                 //!< Currently running (not stored in database).
44         TESTSTATUSCODE_NOT_SUPPORTED,                   //!< Some feature was not supported in the implementation.
45         TESTSTATUSCODE_RESOURCE_ERROR,                  //!< A resource error has occurred.
46         TESTSTATUSCODE_INTERNAL_ERROR,                  //!< An internal error has occurred.
47         TESTSTATUSCODE_CANCELED,                                //!< User canceled the execution
48         TESTSTATUSCODE_TIMEOUT,                                 //!< Test was killed because of watch dog timeout.
49         TESTSTATUSCODE_CRASH,                                   //!< Test executable crashed before finishing the test.
50         TESTSTATUSCODE_DISABLED,                                //!< Test case disabled (for current target)
51         TESTSTATUSCODE_TERMINATED,                              //!< Terminated for other reason.
52         TESTSTATUSCODE_WAIVER,                                  //!< Test case waived.
53
54         TESTSTATUSCODE_LAST
55 };
56
57 const char* getTestStatusCodeName (TestStatusCode statusCode);
58
59 namespace ri
60 {
61
62 class Item;
63 class Result;
64 class Text;
65 class Number;
66 class Image;
67 class ImageSet;
68 class VertexShader;
69 class FragmentShader;
70 class ShaderProgram;
71 class ShaderSource;
72 class InfoLog;
73 class EglConfig;
74 class EglConfigSet;
75 class Section;
76 class KernelSource;
77 class CompileInfo;
78 class SampleList;
79 class SampleInfo;
80 class ValueInfo;
81 class Sample;
82 class SampleValue;
83
84 // \todo [2014-02-28 pyry] Make List<T> for items that have only specific subitems.
85
86 class List
87 {
88 public:
89                                                         List                    (void);
90                                                         ~List                   (void);
91
92         int                                             getNumItems             (void) const    { return (int)m_items.size();   }
93         const Item&                             getItem                 (int ndx) const { return *m_items[ndx];                 }
94         Item&                                   getItem                 (int ndx)               { return *m_items[ndx];                 }
95
96         template <typename T>
97         T*                                              allocItem               (void);
98
99 private:
100         std::vector<Item*>              m_items;
101 };
102
103 template <typename T>
104 T* List::allocItem (void)
105 {
106         m_items.reserve(m_items.size()+1);
107         T* item = new T();
108         m_items.push_back(static_cast<ri::Item*>(item));
109         return item;
110 }
111
112 } // ri
113
114 class TestCaseResultHeader
115 {
116 public:
117                                                 TestCaseResultHeader    (void) : caseType(TESTCASETYPE_LAST), statusCode(TESTSTATUSCODE_LAST) {}
118
119         std::string                     caseVersion;                    //!< Test case version.
120         std::string                     casePath;                               //!< Full test case path.
121         TestCaseType            caseType;                               //!< Test case type.
122         TestStatusCode          statusCode;                             //!< Test status code.
123         std::string                     statusDetails;                  //!< Status description.
124 };
125
126 class TestCaseResult : public TestCaseResultHeader
127 {
128 public:
129         ri::List                        resultItems;                    //!< Test log items.
130 };
131
132 // Result items.
133 namespace ri
134 {
135
136 // Result item type.
137 enum Type
138 {
139         TYPE_RESULT = 0,
140         TYPE_TEXT,
141         TYPE_NUMBER,
142         TYPE_IMAGE,
143         TYPE_IMAGESET,
144         TYPE_SHADER,
145         TYPE_SHADERPROGRAM,
146         TYPE_SHADERSOURCE,
147         TYPE_SPIRVSOURCE,
148         TYPE_INFOLOG,
149         TYPE_EGLCONFIG,
150         TYPE_EGLCONFIGSET,
151         TYPE_SECTION,
152         TYPE_KERNELSOURCE,
153         TYPE_COMPILEINFO,
154         TYPE_SAMPLELIST,
155         TYPE_SAMPLEINFO,
156         TYPE_VALUEINFO,
157         TYPE_SAMPLE,
158         TYPE_SAMPLEVALUE,
159
160         TYPE_LAST
161 };
162
163 class NumericValue
164 {
165 public:
166         enum Type
167         {
168                 NUMVALTYPE_EMPTY = 0,
169                 NUMVALTYPE_INT64,
170                 NUMVALTYPE_FLOAT64,
171
172                 NUMVALTYPE_LAST
173         };
174
175                                         NumericValue    (void)                  : m_type(NUMVALTYPE_EMPTY)              {}
176                                         NumericValue    (deInt64 value) : m_type(NUMVALTYPE_INT64)              { m_value.int64 = value;        }
177                                         NumericValue    (double value)  : m_type(NUMVALTYPE_FLOAT64)    { m_value.float64 = value;      }
178
179         Type                    getType                 (void) const    { return m_type; }
180         deInt64                 getInt64                (void) const    { DE_ASSERT(getType() == NUMVALTYPE_INT64);             return m_value.int64;   }
181         double                  getFloat64              (void) const    { DE_ASSERT(getType() == NUMVALTYPE_FLOAT64);   return m_value.float64; }
182
183 private:
184         Type                    m_type;
185         union
186         {
187                 deInt64         int64;
188                 double          float64;
189         } m_value;
190 };
191
192 std::ostream& operator<< (std::ostream& str, const NumericValue& value);
193
194 class Item
195 {
196 public:
197
198         virtual                 ~Item                           (void) {}
199
200         Type                    getType                         (void) const { return m_type; }
201
202 protected:
203                                         Item                            (Type type) : m_type(type) {}
204
205 private:
206                                         Item                            (const Item& other);
207         Item&                   operator=                       (const Item& other);
208
209         Type                    m_type;
210 };
211
212 class Result : public Item
213 {
214 public:
215                                                 Result                  (void) : Item(TYPE_RESULT), statusCode(TESTSTATUSCODE_LAST) {}
216                                                 ~Result                 (void) {}
217
218         TestStatusCode          statusCode;
219         std::string                     details;
220 };
221
222 class Text : public Item
223 {
224 public:
225                                                 Text                    (void) : Item(TYPE_TEXT) {}
226                                                 ~Text                   (void) {}
227
228         std::string                     text;
229 };
230
231 class Number : public Item
232 {
233 public:
234                                                 Number                  (void) : Item(TYPE_NUMBER) {}
235                                                 ~Number                 (void) {}
236
237         std::string                     name;
238         std::string                     description;
239         std::string                     unit;
240         std::string                     tag;
241         NumericValue            value;
242 };
243
244 class Image : public Item
245 {
246 public:
247         enum Format
248         {
249                 FORMAT_RGB888,
250                 FORMAT_RGBA8888,
251
252                 FORMAT_LAST
253         };
254
255         enum Compression
256         {
257                 COMPRESSION_NONE = 0,
258                 COMPRESSION_PNG,
259
260                 COMPRESSION_LAST
261         };
262
263                                                         Image           (void) : Item(TYPE_IMAGE), width(0), height(0), format(FORMAT_LAST), compression(COMPRESSION_LAST) {}
264                                                         ~Image          (void) {}
265
266         std::string                             name;
267         std::string                             description;
268         int                                             width;
269         int                                             height;
270         Format                                  format;
271         Compression                             compression;
272         std::vector<deUint8>    data;
273 };
274
275 class ImageSet : public Item
276 {
277 public:
278                                                 ImageSet                (void) : Item(TYPE_IMAGESET) {}
279                                                 ~ImageSet               (void) {}
280
281         std::string                     name;
282         std::string                     description;
283         List                            images;
284 };
285
286 class ShaderSource : public Item
287 {
288 public:
289                                                 ShaderSource            (void) : Item(TYPE_SHADERSOURCE) {}
290                                                 ~ShaderSource           (void) {}
291
292         std::string                     source;
293 };
294
295 class SpirVSource : public Item
296 {
297 public:
298                                                 SpirVSource                     (void) : Item(TYPE_SPIRVSOURCE) {}
299                                                 ~SpirVSource            (void) {}
300
301         std::string                     source;
302 };
303
304 class InfoLog : public Item
305 {
306 public:
307                                                 InfoLog                         (void) : Item(TYPE_INFOLOG) {}
308                                                 ~InfoLog                        (void) {}
309
310         std::string                     log;
311 };
312
313 class Shader : public Item
314 {
315 public:
316         enum ShaderType
317         {
318                 SHADERTYPE_VERTEX = 0,
319                 SHADERTYPE_FRAGMENT,
320                 SHADERTYPE_GEOMETRY,
321                 SHADERTYPE_TESS_CONTROL,
322                 SHADERTYPE_TESS_EVALUATION,
323                 SHADERTYPE_COMPUTE,
324                 SHADERTYPE_RAYGEN,
325                 SHADERTYPE_ANY_HIT,
326                 SHADERTYPE_CLOSEST_HIT,
327                 SHADERTYPE_MISS,
328                 SHADERTYPE_INTERSECTION,
329                 SHADERTYPE_CALLABLE,
330
331                 SHADERTYPE_LAST
332         };
333
334                                                 Shader                          (void) : Item(TYPE_SHADER), shaderType(SHADERTYPE_LAST), compileStatus(false) {}
335                                                 ~Shader                         (void) {}
336
337         ShaderType                      shaderType;
338         bool                            compileStatus;
339         ShaderSource            source;
340         InfoLog                         infoLog;
341 };
342
343 class ShaderProgram : public Item
344 {
345 public:
346                                                 ShaderProgram           (void) : Item(TYPE_SHADERPROGRAM), linkStatus(false) {}
347                                                 ~ShaderProgram          (void) {}
348
349         List                            shaders;
350         bool                            linkStatus;
351         InfoLog                         linkInfoLog;
352 };
353
354 class EglConfig : public Item
355 {
356 public:
357                                                 EglConfig                       (void);
358                                                 ~EglConfig                      (void) {}
359
360         int                                     bufferSize;
361         int                                     redSize;
362         int                                     greenSize;
363         int                                     blueSize;
364         int                                     luminanceSize;
365         int                                     alphaSize;
366         int                                     alphaMaskSize;
367         bool                            bindToTextureRGB;
368         bool                            bindToTextureRGBA;
369         std::string                     colorBufferType;
370         std::string                     configCaveat;
371         int                                     configID;
372         std::string                     conformant;
373         int                                     depthSize;
374         int                                     level;
375         int                                     maxPBufferWidth;
376         int                                     maxPBufferHeight;
377         int                                     maxPBufferPixels;
378         int                                     maxSwapInterval;
379         int                                     minSwapInterval;
380         bool                            nativeRenderable;
381         std::string                     renderableType;
382         int                                     sampleBuffers;
383         int                                     samples;
384         int                                     stencilSize;
385         std::string                     surfaceTypes;
386         std::string                     transparentType;
387         int                                     transparentRedValue;
388         int                                     transparentGreenValue;
389         int                                     transparentBlueValue;
390 };
391
392 inline EglConfig::EglConfig (void)
393         : Item                                  (TYPE_EGLCONFIG)
394         , bufferSize                    (0)
395         , redSize                               (0)
396         , greenSize                             (0)
397         , blueSize                              (0)
398         , luminanceSize                 (0)
399         , alphaSize                             (0)
400         , alphaMaskSize                 (0)
401         , bindToTextureRGB              (false)
402         , bindToTextureRGBA             (false)
403         , configID                              (0)
404         , depthSize                             (0)
405         , level                                 (0)
406         , maxPBufferWidth               (0)
407         , maxPBufferHeight              (0)
408         , maxPBufferPixels              (0)
409         , maxSwapInterval               (0)
410         , minSwapInterval               (0)
411         , nativeRenderable              (false)
412         , sampleBuffers                 (0)
413         , samples                               (0)
414         , stencilSize                   (0)
415         , transparentRedValue   (0)
416         , transparentGreenValue (0)
417         , transparentBlueValue  (0)
418 {
419 }
420
421 class EglConfigSet : public Item
422 {
423 public:
424                                                 EglConfigSet            (void) : Item(TYPE_EGLCONFIGSET) {}
425                                                 ~EglConfigSet           (void) {}
426
427         std::string                     name;
428         std::string                     description;
429         List                            configs;
430 };
431
432 class Section : public Item
433 {
434 public:
435                                                 Section                 (void) : Item(TYPE_SECTION) {}
436                                                 ~Section                (void) {}
437
438         std::string                     name;
439         std::string                     description;
440         List                            items;
441 };
442
443 class KernelSource : public Item
444 {
445 public:
446                                                 KernelSource    (void) : Item(TYPE_KERNELSOURCE) {}
447                                                 ~KernelSource   (void) {}
448
449         std::string                     source;
450 };
451
452 class CompileInfo : public Item
453 {
454 public:
455                                                 CompileInfo             (void) : Item(TYPE_COMPILEINFO), compileStatus(false) {}
456                                                 ~CompileInfo    (void) {}
457
458         std::string                     name;
459         std::string                     description;
460         bool                            compileStatus;
461         InfoLog                         infoLog;
462 };
463
464 class ValueInfo : public Item
465 {
466 public:
467         enum ValueTag
468         {
469                 VALUETAG_PREDICTOR,
470                 VALUETAG_RESPONSE,
471
472                 VALUETAG_LAST
473         };
474
475                                                 ValueInfo               (void) : Item(TYPE_VALUEINFO), tag(VALUETAG_LAST) {}
476                                                 ~ValueInfo              (void) {}
477
478         std::string                     name;
479         std::string                     description;
480         std::string                     unit;
481         ValueTag                        tag;
482 };
483
484 class SampleInfo : public Item
485 {
486 public:
487                                                 SampleInfo              (void) : Item(TYPE_SAMPLEINFO) {}
488                                                 ~SampleInfo             (void) {}
489
490         List                            valueInfos;
491 };
492
493 class SampleValue : public Item
494 {
495 public:
496                                                 SampleValue             (void) : Item(TYPE_SAMPLEVALUE) {}
497                                                 ~SampleValue    (void) {}
498
499         NumericValue            value;
500 };
501
502 class Sample : public Item
503 {
504 public:
505                                                 Sample                  (void) : Item(TYPE_SAMPLE) {}
506                                                 ~Sample                 (void) {}
507
508         List                            values;
509 };
510
511 class SampleList : public Item
512 {
513 public:
514                                                 SampleList              (void) : Item(TYPE_SAMPLELIST) {}
515                                                 ~SampleList             (void) {}
516
517         std::string                     name;
518         std::string                     description;
519         SampleInfo                      sampleInfo;
520         List                            samples;
521 };
522
523 } // ri
524 } // xe
525
526 #endif // _XETESTCASERESULT_HPP