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 91 int getNumItems (void) const { return (int)m_items.size(); } 92 const Item& getItem (int ndx) const { return *m_items[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> 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: 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_INFOLOG, 146 TYPE_EGLCONFIG, 147 TYPE_EGLCONFIGSET, 148 TYPE_SECTION, 149 TYPE_KERNELSOURCE, 150 TYPE_COMPILEINFO, 151 TYPE_SAMPLELIST, 152 TYPE_SAMPLEINFO, 153 TYPE_VALUEINFO, 154 TYPE_SAMPLE, 155 TYPE_SAMPLEVALUE, 156 157 TYPE_LAST 158 }; 159 160 class NumericValue 161 { 162 public: 163 enum Type 164 { 165 TYPE_EMPTY = 0, 166 TYPE_INT64, 167 TYPE_FLOAT64, 168 169 TYPE_LAST 170 }; 171 172 NumericValue (void) : m_type(TYPE_EMPTY) {} 173 NumericValue (deInt64 value) : m_type(TYPE_INT64) { m_value.int64 = value; } 174 NumericValue (double value) : m_type(TYPE_FLOAT64) { m_value.float64 = value; } 175 176 Type getType (void) const { return m_type; } 177 deInt64 getInt64 (void) const { DE_ASSERT(getType() == TYPE_INT64); return m_value.int64; } 178 double getFloat64 (void) const { DE_ASSERT(getType() == TYPE_FLOAT64); return m_value.float64; } 179 180 private: 181 Type m_type; 182 union 183 { 184 deInt64 int64; 185 double float64; 186 } m_value; 187 }; 188 189 std::ostream& operator<< (std::ostream& str, const NumericValue& value); 190 191 class Item 192 { 193 public: 194 195 virtual ~Item (void) {} 196 197 Type getType (void) const { return m_type; } 198 199 protected: 200 Item (Type type) : m_type(type) {} 201 202 private: 203 Item (const Item& other); 204 Item& operator= (const Item& other); 205 206 Type m_type; 207 }; 208 209 class Result : public Item 210 { 211 public: 212 Result (void) : Item(TYPE_RESULT), statusCode(TESTSTATUSCODE_LAST) {} 213 ~Result (void) {} 214 215 TestStatusCode statusCode; 216 std::string details; 217 }; 218 219 class Text : public Item 220 { 221 public: 222 Text (void) : Item(TYPE_TEXT) {} 223 ~Text (void) {} 224 225 std::string text; 226 }; 227 228 class Number : public Item 229 { 230 public: 231 Number (void) : Item(TYPE_NUMBER) {} 232 ~Number (void) {} 233 234 std::string name; 235 std::string description; 236 std::string unit; 237 std::string tag; 238 NumericValue value; 239 }; 240 241 class Image : public Item 242 { 243 public: 244 enum Format 245 { 246 FORMAT_RGB888, 247 FORMAT_RGBA8888, 248 249 FORMAT_LAST 250 }; 251 252 enum Compression 253 { 254 COMPRESSION_NONE = 0, 255 COMPRESSION_PNG, 256 257 COMPRESSION_LAST 258 }; 259 260 Image (void) : Item(TYPE_IMAGE), width(0), height(0), format(FORMAT_LAST), compression(COMPRESSION_LAST) {} 261 ~Image (void) {} 262 263 std::string name; 264 std::string description; 265 int width; 266 int height; 267 Format format; 268 Compression compression; 269 std::vector<deUint8> data; 270 }; 271 272 class ImageSet : public Item 273 { 274 public: 275 ImageSet (void) : Item(TYPE_IMAGESET) {} 276 ~ImageSet (void) {} 277 278 std::string name; 279 std::string description; 280 List images; 281 }; 282 283 class ShaderSource : public Item 284 { 285 public: 286 ShaderSource (void) : Item(TYPE_SHADERSOURCE) {} 287 ~ShaderSource (void) {} 288 289 std::string source; 290 }; 291 292 class InfoLog : public Item 293 { 294 public: 295 InfoLog (void) : Item(TYPE_INFOLOG) {} 296 ~InfoLog (void) {} 297 298 std::string log; 299 }; 300 301 class Shader : public Item 302 { 303 public: 304 enum ShaderType 305 { 306 SHADERTYPE_VERTEX = 0, 307 SHADERTYPE_FRAGMENT, 308 SHADERTYPE_GEOMETRY, 309 SHADERTYPE_TESS_CONTROL, 310 SHADERTYPE_TESS_EVALUATION, 311 SHADERTYPE_COMPUTE, 312 313 SHADERTYPE_LAST 314 }; 315 316 Shader (void) : Item(TYPE_SHADER), shaderType(SHADERTYPE_LAST), compileStatus(false) {} 317 ~Shader (void) {} 318 319 ShaderType shaderType; 320 bool compileStatus; 321 ShaderSource source; 322 InfoLog infoLog; 323 }; 324 325 class ShaderProgram : public Item 326 { 327 public: 328 ShaderProgram (void) : Item(TYPE_SHADERPROGRAM), linkStatus(false) {} 329 ~ShaderProgram (void) {} 330 331 List shaders; 332 bool linkStatus; 333 InfoLog linkInfoLog; 334 }; 335 336 class EglConfig : public Item 337 { 338 public: 339 EglConfig (void); 340 ~EglConfig (void) {} 341 342 int bufferSize; 343 int redSize; 344 int greenSize; 345 int blueSize; 346 int luminanceSize; 347 int alphaSize; 348 int alphaMaskSize; 349 bool bindToTextureRGB; 350 bool bindToTextureRGBA; 351 std::string colorBufferType; 352 std::string configCaveat; 353 int configID; 354 std::string conformant; 355 int depthSize; 356 int level; 357 int maxPBufferWidth; 358 int maxPBufferHeight; 359 int maxPBufferPixels; 360 int maxSwapInterval; 361 int minSwapInterval; 362 bool nativeRenderable; 363 std::string renderableType; 364 int sampleBuffers; 365 int samples; 366 int stencilSize; 367 std::string surfaceTypes; 368 std::string transparentType; 369 int transparentRedValue; 370 int transparentGreenValue; 371 int transparentBlueValue; 372 }; 373 374 inline EglConfig::EglConfig (void) 375 : Item (TYPE_EGLCONFIG) 376 , bufferSize (0) 377 , redSize (0) 378 , greenSize (0) 379 , blueSize (0) 380 , luminanceSize (0) 381 , alphaSize (0) 382 , alphaMaskSize (0) 383 , bindToTextureRGB (false) 384 , bindToTextureRGBA (false) 385 , configID (0) 386 , depthSize (0) 387 , level (0) 388 , maxPBufferWidth (0) 389 , maxPBufferHeight (0) 390 , maxPBufferPixels (0) 391 , maxSwapInterval (0) 392 , minSwapInterval (0) 393 , nativeRenderable (false) 394 , sampleBuffers (0) 395 , samples (0) 396 , stencilSize (0) 397 , transparentRedValue (0) 398 , transparentGreenValue (0) 399 , transparentBlueValue (0) 400 { 401 } 402 403 class EglConfigSet : public Item 404 { 405 public: 406 EglConfigSet (void) : Item(TYPE_EGLCONFIGSET) {} 407 ~EglConfigSet (void) {} 408 409 std::string name; 410 std::string description; 411 List configs; 412 }; 413 414 class Section : public Item 415 { 416 public: 417 Section (void) : Item(TYPE_SECTION) {} 418 ~Section (void) {} 419 420 std::string name; 421 std::string description; 422 List items; 423 }; 424 425 class KernelSource : public Item 426 { 427 public: 428 KernelSource (void) : Item(TYPE_KERNELSOURCE) {} 429 ~KernelSource (void) {} 430 431 std::string source; 432 }; 433 434 class CompileInfo : public Item 435 { 436 public: 437 CompileInfo (void) : Item(TYPE_COMPILEINFO), compileStatus(false) {} 438 ~CompileInfo (void) {} 439 440 std::string name; 441 std::string description; 442 bool compileStatus; 443 InfoLog infoLog; 444 }; 445 446 class ValueInfo : public Item 447 { 448 public: 449 enum ValueTag 450 { 451 VALUETAG_PREDICTOR, 452 VALUETAG_RESPONSE, 453 454 VALUETAG_LAST 455 }; 456 457 ValueInfo (void) : Item(TYPE_VALUEINFO), tag(VALUETAG_LAST) {} 458 ~ValueInfo (void) {} 459 460 std::string name; 461 std::string description; 462 std::string unit; 463 ValueTag tag; 464 }; 465 466 class SampleInfo : public Item 467 { 468 public: 469 SampleInfo (void) : Item(TYPE_SAMPLEINFO) {} 470 ~SampleInfo (void) {} 471 472 List valueInfos; 473 }; 474 475 class SampleValue : public Item 476 { 477 public: 478 SampleValue (void) : Item(TYPE_SAMPLEVALUE) {} 479 ~SampleValue (void) {} 480 481 NumericValue value; 482 }; 483 484 class Sample : public Item 485 { 486 public: 487 Sample (void) : Item(TYPE_SAMPLE) {} 488 ~Sample (void) {} 489 490 List values; 491 }; 492 493 class SampleList : public Item 494 { 495 public: 496 SampleList (void) : Item(TYPE_SAMPLELIST) {} 497 ~SampleList (void) {} 498 499 std::string name; 500 std::string description; 501 SampleInfo sampleInfo; 502 List samples; 503 }; 504 505 } // ri 506 } // xe 507 508 #endif // _XETESTCASERESULT_HPP 509