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
getNumItems(void) const92 int getNumItems (void) const { return (int)m_items.size(); }
getItem(int ndx) const93 const Item& getItem (int ndx) const { return *m_items[ndx]; }
getItem(int 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>
allocItem(void)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:
TestCaseResultHeader(void)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
NumericValue(void)175 NumericValue (void) : m_type(NUMVALTYPE_EMPTY) {}
NumericValue(deInt64 value)176 NumericValue (deInt64 value) : m_type(NUMVALTYPE_INT64) { m_value.int64 = value; }
NumericValue(double value)177 NumericValue (double value) : m_type(NUMVALTYPE_FLOAT64) { m_value.float64 = value; }
178
getType(void) const179 Type getType (void) const { return m_type; }
getInt64(void) const180 deInt64 getInt64 (void) const { DE_ASSERT(getType() == NUMVALTYPE_INT64); return m_value.int64; }
getFloat64(void) const181 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
~Item(void)198 virtual ~Item (void) {}
199
getType(void) const200 Type getType (void) const { return m_type; }
201
202 protected:
Item(Type type)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:
Result(void)215 Result (void) : Item(TYPE_RESULT), statusCode(TESTSTATUSCODE_LAST) {}
~Result(void)216 ~Result (void) {}
217
218 TestStatusCode statusCode;
219 std::string details;
220 };
221
222 class Text : public Item
223 {
224 public:
Text(void)225 Text (void) : Item(TYPE_TEXT) {}
~Text(void)226 ~Text (void) {}
227
228 std::string text;
229 };
230
231 class Number : public Item
232 {
233 public:
Number(void)234 Number (void) : Item(TYPE_NUMBER) {}
~Number(void)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
Image(void)263 Image (void) : Item(TYPE_IMAGE), width(0), height(0), format(FORMAT_LAST), compression(COMPRESSION_LAST) {}
~Image(void)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:
ImageSet(void)278 ImageSet (void) : Item(TYPE_IMAGESET) {}
~ImageSet(void)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:
ShaderSource(void)289 ShaderSource (void) : Item(TYPE_SHADERSOURCE) {}
~ShaderSource(void)290 ~ShaderSource (void) {}
291
292 std::string source;
293 };
294
295 class SpirVSource : public Item
296 {
297 public:
SpirVSource(void)298 SpirVSource (void) : Item(TYPE_SPIRVSOURCE) {}
~SpirVSource(void)299 ~SpirVSource (void) {}
300
301 std::string source;
302 };
303
304 class InfoLog : public Item
305 {
306 public:
InfoLog(void)307 InfoLog (void) : Item(TYPE_INFOLOG) {}
~InfoLog(void)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 SHADERTYPE_TASK,
331 SHADERTYPE_MESH,
332
333 SHADERTYPE_LAST
334 };
335
Shader(void)336 Shader (void) : Item(TYPE_SHADER), shaderType(SHADERTYPE_LAST), compileStatus(false) {}
~Shader(void)337 ~Shader (void) {}
338
339 ShaderType shaderType;
340 bool compileStatus;
341 ShaderSource source;
342 InfoLog infoLog;
343 };
344
345 class ShaderProgram : public Item
346 {
347 public:
ShaderProgram(void)348 ShaderProgram (void) : Item(TYPE_SHADERPROGRAM), linkStatus(false) {}
~ShaderProgram(void)349 ~ShaderProgram (void) {}
350
351 List shaders;
352 bool linkStatus;
353 InfoLog linkInfoLog;
354 };
355
356 class EglConfig : public Item
357 {
358 public:
359 EglConfig (void);
~EglConfig(void)360 ~EglConfig (void) {}
361
362 int bufferSize;
363 int redSize;
364 int greenSize;
365 int blueSize;
366 int luminanceSize;
367 int alphaSize;
368 int alphaMaskSize;
369 bool bindToTextureRGB;
370 bool bindToTextureRGBA;
371 std::string colorBufferType;
372 std::string configCaveat;
373 int configID;
374 std::string conformant;
375 int depthSize;
376 int level;
377 int maxPBufferWidth;
378 int maxPBufferHeight;
379 int maxPBufferPixels;
380 int maxSwapInterval;
381 int minSwapInterval;
382 bool nativeRenderable;
383 std::string renderableType;
384 int sampleBuffers;
385 int samples;
386 int stencilSize;
387 std::string surfaceTypes;
388 std::string transparentType;
389 int transparentRedValue;
390 int transparentGreenValue;
391 int transparentBlueValue;
392 };
393
EglConfig(void)394 inline EglConfig::EglConfig (void)
395 : Item (TYPE_EGLCONFIG)
396 , bufferSize (0)
397 , redSize (0)
398 , greenSize (0)
399 , blueSize (0)
400 , luminanceSize (0)
401 , alphaSize (0)
402 , alphaMaskSize (0)
403 , bindToTextureRGB (false)
404 , bindToTextureRGBA (false)
405 , configID (0)
406 , depthSize (0)
407 , level (0)
408 , maxPBufferWidth (0)
409 , maxPBufferHeight (0)
410 , maxPBufferPixels (0)
411 , maxSwapInterval (0)
412 , minSwapInterval (0)
413 , nativeRenderable (false)
414 , sampleBuffers (0)
415 , samples (0)
416 , stencilSize (0)
417 , transparentRedValue (0)
418 , transparentGreenValue (0)
419 , transparentBlueValue (0)
420 {
421 }
422
423 class EglConfigSet : public Item
424 {
425 public:
EglConfigSet(void)426 EglConfigSet (void) : Item(TYPE_EGLCONFIGSET) {}
~EglConfigSet(void)427 ~EglConfigSet (void) {}
428
429 std::string name;
430 std::string description;
431 List configs;
432 };
433
434 class Section : public Item
435 {
436 public:
Section(void)437 Section (void) : Item(TYPE_SECTION) {}
~Section(void)438 ~Section (void) {}
439
440 std::string name;
441 std::string description;
442 List items;
443 };
444
445 class KernelSource : public Item
446 {
447 public:
KernelSource(void)448 KernelSource (void) : Item(TYPE_KERNELSOURCE) {}
~KernelSource(void)449 ~KernelSource (void) {}
450
451 std::string source;
452 };
453
454 class CompileInfo : public Item
455 {
456 public:
CompileInfo(void)457 CompileInfo (void) : Item(TYPE_COMPILEINFO), compileStatus(false) {}
~CompileInfo(void)458 ~CompileInfo (void) {}
459
460 std::string name;
461 std::string description;
462 bool compileStatus;
463 InfoLog infoLog;
464 };
465
466 class ValueInfo : public Item
467 {
468 public:
469 enum ValueTag
470 {
471 VALUETAG_PREDICTOR,
472 VALUETAG_RESPONSE,
473
474 VALUETAG_LAST
475 };
476
ValueInfo(void)477 ValueInfo (void) : Item(TYPE_VALUEINFO), tag(VALUETAG_LAST) {}
~ValueInfo(void)478 ~ValueInfo (void) {}
479
480 std::string name;
481 std::string description;
482 std::string unit;
483 ValueTag tag;
484 };
485
486 class SampleInfo : public Item
487 {
488 public:
SampleInfo(void)489 SampleInfo (void) : Item(TYPE_SAMPLEINFO) {}
~SampleInfo(void)490 ~SampleInfo (void) {}
491
492 List valueInfos;
493 };
494
495 class SampleValue : public Item
496 {
497 public:
SampleValue(void)498 SampleValue (void) : Item(TYPE_SAMPLEVALUE) {}
~SampleValue(void)499 ~SampleValue (void) {}
500
501 NumericValue value;
502 };
503
504 class Sample : public Item
505 {
506 public:
Sample(void)507 Sample (void) : Item(TYPE_SAMPLE) {}
~Sample(void)508 ~Sample (void) {}
509
510 List values;
511 };
512
513 class SampleList : public Item
514 {
515 public:
SampleList(void)516 SampleList (void) : Item(TYPE_SAMPLELIST) {}
~SampleList(void)517 ~SampleList (void) {}
518
519 std::string name;
520 std::string description;
521 SampleInfo sampleInfo;
522 List samples;
523 };
524
525 } // ri
526 } // xe
527
528 #endif // _XETESTCASERESULT_HPP
529