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
93 {
94 return (int)m_items.size();
95 }
getItem(int ndx) const96 const Item &getItem(int ndx) const
97 {
98 return *m_items[ndx];
99 }
getItem(int ndx)100 Item &getItem(int ndx)
101 {
102 return *m_items[ndx];
103 }
104
105 template <typename T>
106 T *allocItem(void);
107
108 private:
109 std::vector<Item *> m_items;
110 };
111
112 template <typename T>
allocItem(void)113 T *List::allocItem(void)
114 {
115 m_items.reserve(m_items.size() + 1);
116 T *item = new T();
117 m_items.push_back(static_cast<ri::Item *>(item));
118 return item;
119 }
120
121 } // namespace ri
122
123 class TestCaseResultHeader
124 {
125 public:
TestCaseResultHeader(void)126 TestCaseResultHeader(void) : caseType(TESTCASETYPE_LAST), statusCode(TESTSTATUSCODE_LAST)
127 {
128 }
129
130 std::string caseVersion; //!< Test case version.
131 std::string casePath; //!< Full test case path.
132 TestCaseType caseType; //!< Test case type.
133 TestStatusCode statusCode; //!< Test status code.
134 std::string statusDetails; //!< Status description.
135 };
136
137 class TestCaseResult : public TestCaseResultHeader
138 {
139 public:
140 ri::List resultItems; //!< Test log items.
141 };
142
143 // Result items.
144 namespace ri
145 {
146
147 // Result item type.
148 enum Type
149 {
150 TYPE_RESULT = 0,
151 TYPE_TEXT,
152 TYPE_NUMBER,
153 TYPE_IMAGE,
154 TYPE_IMAGESET,
155 TYPE_SHADER,
156 TYPE_SHADERPROGRAM,
157 TYPE_SHADERSOURCE,
158 TYPE_SPIRVSOURCE,
159 TYPE_INFOLOG,
160 TYPE_EGLCONFIG,
161 TYPE_EGLCONFIGSET,
162 TYPE_SECTION,
163 TYPE_KERNELSOURCE,
164 TYPE_COMPILEINFO,
165 TYPE_SAMPLELIST,
166 TYPE_SAMPLEINFO,
167 TYPE_VALUEINFO,
168 TYPE_SAMPLE,
169 TYPE_SAMPLEVALUE,
170
171 TYPE_LAST
172 };
173
174 class NumericValue
175 {
176 public:
177 enum Type
178 {
179 NUMVALTYPE_EMPTY = 0,
180 NUMVALTYPE_INT64,
181 NUMVALTYPE_FLOAT64,
182
183 NUMVALTYPE_LAST
184 };
185
NumericValue(void)186 NumericValue(void) : m_type(NUMVALTYPE_EMPTY)
187 {
188 }
NumericValue(int64_t value)189 NumericValue(int64_t value) : m_type(NUMVALTYPE_INT64)
190 {
191 m_value.int64 = value;
192 }
NumericValue(double value)193 NumericValue(double value) : m_type(NUMVALTYPE_FLOAT64)
194 {
195 m_value.float64 = value;
196 }
197
getType(void) const198 Type getType(void) const
199 {
200 return m_type;
201 }
getInt64(void) const202 int64_t getInt64(void) const
203 {
204 DE_ASSERT(getType() == NUMVALTYPE_INT64);
205 return m_value.int64;
206 }
getFloat64(void) const207 double getFloat64(void) const
208 {
209 DE_ASSERT(getType() == NUMVALTYPE_FLOAT64);
210 return m_value.float64;
211 }
212
213 private:
214 Type m_type;
215 union
216 {
217 int64_t int64;
218 double float64;
219 } m_value;
220 };
221
222 std::ostream &operator<<(std::ostream &str, const NumericValue &value);
223
224 class Item
225 {
226 public:
~Item(void)227 virtual ~Item(void)
228 {
229 }
230
getType(void) const231 Type getType(void) const
232 {
233 return m_type;
234 }
235
236 protected:
Item(Type type)237 Item(Type type) : m_type(type)
238 {
239 }
240
241 private:
242 Item(const Item &other);
243 Item &operator=(const Item &other);
244
245 Type m_type;
246 };
247
248 class Result : public Item
249 {
250 public:
Result(void)251 Result(void) : Item(TYPE_RESULT), statusCode(TESTSTATUSCODE_LAST)
252 {
253 }
~Result(void)254 ~Result(void)
255 {
256 }
257
258 TestStatusCode statusCode;
259 std::string details;
260 };
261
262 class Text : public Item
263 {
264 public:
Text(void)265 Text(void) : Item(TYPE_TEXT)
266 {
267 }
~Text(void)268 ~Text(void)
269 {
270 }
271
272 std::string text;
273 };
274
275 class Number : public Item
276 {
277 public:
Number(void)278 Number(void) : Item(TYPE_NUMBER)
279 {
280 }
~Number(void)281 ~Number(void)
282 {
283 }
284
285 std::string name;
286 std::string description;
287 std::string unit;
288 std::string tag;
289 NumericValue value;
290 };
291
292 class Image : public Item
293 {
294 public:
295 enum Format
296 {
297 FORMAT_RGB888,
298 FORMAT_RGBA8888,
299
300 FORMAT_LAST
301 };
302
303 enum Compression
304 {
305 COMPRESSION_NONE = 0,
306 COMPRESSION_PNG,
307
308 COMPRESSION_LAST
309 };
310
Image(void)311 Image(void) : Item(TYPE_IMAGE), width(0), height(0), format(FORMAT_LAST), compression(COMPRESSION_LAST)
312 {
313 }
~Image(void)314 ~Image(void)
315 {
316 }
317
318 std::string name;
319 std::string description;
320 int width;
321 int height;
322 Format format;
323 Compression compression;
324 std::vector<uint8_t> data;
325 };
326
327 class ImageSet : public Item
328 {
329 public:
ImageSet(void)330 ImageSet(void) : Item(TYPE_IMAGESET)
331 {
332 }
~ImageSet(void)333 ~ImageSet(void)
334 {
335 }
336
337 std::string name;
338 std::string description;
339 List images;
340 };
341
342 class ShaderSource : public Item
343 {
344 public:
ShaderSource(void)345 ShaderSource(void) : Item(TYPE_SHADERSOURCE)
346 {
347 }
~ShaderSource(void)348 ~ShaderSource(void)
349 {
350 }
351
352 std::string source;
353 };
354
355 class SpirVSource : public Item
356 {
357 public:
SpirVSource(void)358 SpirVSource(void) : Item(TYPE_SPIRVSOURCE)
359 {
360 }
~SpirVSource(void)361 ~SpirVSource(void)
362 {
363 }
364
365 std::string source;
366 };
367
368 class InfoLog : public Item
369 {
370 public:
InfoLog(void)371 InfoLog(void) : Item(TYPE_INFOLOG)
372 {
373 }
~InfoLog(void)374 ~InfoLog(void)
375 {
376 }
377
378 std::string log;
379 };
380
381 class Shader : public Item
382 {
383 public:
384 enum ShaderType
385 {
386 SHADERTYPE_VERTEX = 0,
387 SHADERTYPE_FRAGMENT,
388 SHADERTYPE_GEOMETRY,
389 SHADERTYPE_TESS_CONTROL,
390 SHADERTYPE_TESS_EVALUATION,
391 SHADERTYPE_COMPUTE,
392 SHADERTYPE_RAYGEN,
393 SHADERTYPE_ANY_HIT,
394 SHADERTYPE_CLOSEST_HIT,
395 SHADERTYPE_MISS,
396 SHADERTYPE_INTERSECTION,
397 SHADERTYPE_CALLABLE,
398 SHADERTYPE_TASK,
399 SHADERTYPE_MESH,
400
401 SHADERTYPE_LAST
402 };
403
Shader(void)404 Shader(void) : Item(TYPE_SHADER), shaderType(SHADERTYPE_LAST), compileStatus(false)
405 {
406 }
~Shader(void)407 ~Shader(void)
408 {
409 }
410
411 ShaderType shaderType;
412 bool compileStatus;
413 ShaderSource source;
414 InfoLog infoLog;
415 };
416
417 class ShaderProgram : public Item
418 {
419 public:
ShaderProgram(void)420 ShaderProgram(void) : Item(TYPE_SHADERPROGRAM), linkStatus(false)
421 {
422 }
~ShaderProgram(void)423 ~ShaderProgram(void)
424 {
425 }
426
427 List shaders;
428 bool linkStatus;
429 InfoLog linkInfoLog;
430 };
431
432 class EglConfig : public Item
433 {
434 public:
435 EglConfig(void);
~EglConfig(void)436 ~EglConfig(void)
437 {
438 }
439
440 int bufferSize;
441 int redSize;
442 int greenSize;
443 int blueSize;
444 int luminanceSize;
445 int alphaSize;
446 int alphaMaskSize;
447 bool bindToTextureRGB;
448 bool bindToTextureRGBA;
449 std::string colorBufferType;
450 std::string configCaveat;
451 int configID;
452 std::string conformant;
453 int depthSize;
454 int level;
455 int maxPBufferWidth;
456 int maxPBufferHeight;
457 int maxPBufferPixels;
458 int maxSwapInterval;
459 int minSwapInterval;
460 bool nativeRenderable;
461 std::string renderableType;
462 int sampleBuffers;
463 int samples;
464 int stencilSize;
465 std::string surfaceTypes;
466 std::string transparentType;
467 int transparentRedValue;
468 int transparentGreenValue;
469 int transparentBlueValue;
470 };
471
EglConfig(void)472 inline EglConfig::EglConfig(void)
473 : Item(TYPE_EGLCONFIG)
474 , bufferSize(0)
475 , redSize(0)
476 , greenSize(0)
477 , blueSize(0)
478 , luminanceSize(0)
479 , alphaSize(0)
480 , alphaMaskSize(0)
481 , bindToTextureRGB(false)
482 , bindToTextureRGBA(false)
483 , configID(0)
484 , depthSize(0)
485 , level(0)
486 , maxPBufferWidth(0)
487 , maxPBufferHeight(0)
488 , maxPBufferPixels(0)
489 , maxSwapInterval(0)
490 , minSwapInterval(0)
491 , nativeRenderable(false)
492 , sampleBuffers(0)
493 , samples(0)
494 , stencilSize(0)
495 , transparentRedValue(0)
496 , transparentGreenValue(0)
497 , transparentBlueValue(0)
498 {
499 }
500
501 class EglConfigSet : public Item
502 {
503 public:
EglConfigSet(void)504 EglConfigSet(void) : Item(TYPE_EGLCONFIGSET)
505 {
506 }
~EglConfigSet(void)507 ~EglConfigSet(void)
508 {
509 }
510
511 std::string name;
512 std::string description;
513 List configs;
514 };
515
516 class Section : public Item
517 {
518 public:
Section(void)519 Section(void) : Item(TYPE_SECTION)
520 {
521 }
~Section(void)522 ~Section(void)
523 {
524 }
525
526 std::string name;
527 std::string description;
528 List items;
529 };
530
531 class KernelSource : public Item
532 {
533 public:
KernelSource(void)534 KernelSource(void) : Item(TYPE_KERNELSOURCE)
535 {
536 }
~KernelSource(void)537 ~KernelSource(void)
538 {
539 }
540
541 std::string source;
542 };
543
544 class CompileInfo : public Item
545 {
546 public:
CompileInfo(void)547 CompileInfo(void) : Item(TYPE_COMPILEINFO), compileStatus(false)
548 {
549 }
~CompileInfo(void)550 ~CompileInfo(void)
551 {
552 }
553
554 std::string name;
555 std::string description;
556 bool compileStatus;
557 InfoLog infoLog;
558 };
559
560 class ValueInfo : public Item
561 {
562 public:
563 enum ValueTag
564 {
565 VALUETAG_PREDICTOR,
566 VALUETAG_RESPONSE,
567
568 VALUETAG_LAST
569 };
570
ValueInfo(void)571 ValueInfo(void) : Item(TYPE_VALUEINFO), tag(VALUETAG_LAST)
572 {
573 }
~ValueInfo(void)574 ~ValueInfo(void)
575 {
576 }
577
578 std::string name;
579 std::string description;
580 std::string unit;
581 ValueTag tag;
582 };
583
584 class SampleInfo : public Item
585 {
586 public:
SampleInfo(void)587 SampleInfo(void) : Item(TYPE_SAMPLEINFO)
588 {
589 }
~SampleInfo(void)590 ~SampleInfo(void)
591 {
592 }
593
594 List valueInfos;
595 };
596
597 class SampleValue : public Item
598 {
599 public:
SampleValue(void)600 SampleValue(void) : Item(TYPE_SAMPLEVALUE)
601 {
602 }
~SampleValue(void)603 ~SampleValue(void)
604 {
605 }
606
607 NumericValue value;
608 };
609
610 class Sample : public Item
611 {
612 public:
Sample(void)613 Sample(void) : Item(TYPE_SAMPLE)
614 {
615 }
~Sample(void)616 ~Sample(void)
617 {
618 }
619
620 List values;
621 };
622
623 class SampleList : public Item
624 {
625 public:
SampleList(void)626 SampleList(void) : Item(TYPE_SAMPLELIST)
627 {
628 }
~SampleList(void)629 ~SampleList(void)
630 {
631 }
632
633 std::string name;
634 std::string description;
635 SampleInfo sampleInfo;
636 List samples;
637 };
638
639 } // namespace ri
640 } // namespace xe
641
642 #endif // _XETESTCASERESULT_HPP
643