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