1 #ifndef _QPTESTLOG_H 2 #define _QPTESTLOG_H 3 /*------------------------------------------------------------------------- 4 * drawElements Quality Program Helper Library 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 * \defgroup TestLog 23 * \ingroup TestLog 24 * \{ 25 * \file 26 * \brief Test log library 27 * 28 * qpTestLog Conventions: 29 * 30 * Each function takes qpTestLog pointer. Operations are done on that log 31 * instance. 32 * 33 * When function takes a 'name' parameter, that name is expected to 34 * be a unique identifier within the scope of one test case. Test case 35 * begins with a call to qpTestLog_startCase and ends with a call to 36 * qpTestLog_endCase or qpTestLog_terminateCase. The human readable 37 * "name" for a piece of information is given with the parameter 38 * called 'description'. 39 * 40 * All functions writing to the log return a boolean value. False 41 * means that the current write operation failed and the current log 42 * instance should be abandoned. 43 * 44 *//*--------------------------------------------------------------------*/ 45 46 #include "deDefs.h" 47 48 typedef struct qpTestLog_s qpTestLog; 49 50 /* Test results supported by current report version */ 51 /* \note Keep in sync with TestCaseStatus in Candy project. */ 52 typedef enum qpTestResult_e 53 { 54 QP_TEST_RESULT_PASS = 0, /*!< Test case passed. */ 55 QP_TEST_RESULT_FAIL, /*!< Implementation produced incorrect results */ 56 QP_TEST_RESULT_QUALITY_WARNING, /*!< Result is within specification, but is not of high quality */ 57 QP_TEST_RESULT_COMPATIBILITY_WARNING, /*!< Result is within specification, but likely to cause fragmentation in the market */ 58 QP_TEST_RESULT_PENDING, /*!< The test is still running. Not a valid end result */ 59 QP_TEST_RESULT_NOT_SUPPORTED, /*!< Implementation does not support functionality needed by this test case */ 60 QP_TEST_RESULT_RESOURCE_ERROR, /*!< Implementation fails to pass the test due to lack of resources */ 61 QP_TEST_RESULT_INTERNAL_ERROR, /*!< Error occurred within Tester Core */ 62 QP_TEST_RESULT_CRASH, /*!< Crash occurred in test execution. */ 63 QP_TEST_RESULT_TIMEOUT, /*!< Timeout occurred in test execution. */ 64 QP_TEST_RESULT_WAIVER, /*!< Status code reported by waived test. */ 65 66 QP_TEST_RESULT_LAST 67 } qpTestResult; 68 69 /* Test case types. */ 70 typedef enum qpTestCaseType_e 71 { 72 QP_TEST_CASE_TYPE_SELF_VALIDATE = 0, /*!< Self-validating test case */ 73 QP_TEST_CASE_TYPE_PERFORMANCE, /*!< Performace test case */ 74 QP_TEST_CASE_TYPE_CAPABILITY, /*!< Capability score case */ 75 QP_TEST_CASE_TYPE_ACCURACY, /*!< Accuracy test case */ 76 77 QP_TEST_CASE_TYPE_LAST 78 } qpTestCaseType; 79 80 /*--------------------------------------------------------------------*//*! 81 * \brief Tag key-value pairs to give cues on proper visualization in GUI 82 *//*--------------------------------------------------------------------*/ 83 typedef enum qpKeyValueTag_e 84 { 85 QP_KEY_TAG_NONE = 0, 86 QP_KEY_TAG_PERFORMANCE, 87 QP_KEY_TAG_QUALITY, 88 QP_KEY_TAG_PRECISION, 89 QP_KEY_TAG_TIME, 90 91 /* Add new values here if needed, remember to update relevant code in qpTestLog.c and change format revision */ 92 93 QP_KEY_TAG_LAST /* Do not remove */ 94 } qpKeyValueTag; 95 96 /*--------------------------------------------------------------------*//*! 97 * \brief Sample value tag for giving hints for analysis 98 *//*--------------------------------------------------------------------*/ 99 typedef enum qpSampleValueTag_e 100 { 101 QP_SAMPLE_VALUE_TAG_PREDICTOR = 0, /*!< Predictor for sample, such as number of operations. */ 102 QP_SAMPLE_VALUE_TAG_RESPONSE, /*!< Response, i.e. measured value, such as render time. */ 103 104 /* Add new values here if needed, remember to update relevant code in qpTestLog.c and change format revision */ 105 106 QP_SAMPLE_VALUE_TAG_LAST /* Do not remove */ 107 } qpSampleValueTag; 108 109 /* Image compression type. */ 110 typedef enum qpImageCompressionMode_e 111 { 112 QP_IMAGE_COMPRESSION_MODE_NONE = 0, /*!< Do not compress images. */ 113 QP_IMAGE_COMPRESSION_MODE_PNG, /*!< Compress images using lossless libpng. */ 114 QP_IMAGE_COMPRESSION_MODE_BEST, /*!< Choose the best image compression mode. */ 115 116 QP_IMAGE_COMPRESSION_MODE_LAST 117 } qpImageCompressionMode; 118 119 /*--------------------------------------------------------------------*//*! 120 * \brief Image formats. 121 * 122 * Pixels are handled as a byte stream, i.e., endianess does not 123 * affect component ordering. 124 *//*--------------------------------------------------------------------*/ 125 typedef enum qpImageFormat_e 126 { 127 QP_IMAGE_FORMAT_RGB888 = 0, 128 QP_IMAGE_FORMAT_RGBA8888, 129 130 QP_IMAGE_FORMAT_LAST 131 } qpImageFormat; 132 133 /* Test log flags. */ 134 typedef enum qpTestLogFlag_e 135 { 136 QP_TEST_LOG_EXCLUDE_IMAGES = (1<<0) /*!< Do not log images. This reduces log size considerably. */ 137 ,QP_TEST_LOG_EXCLUDE_SHADER_SOURCES = (1<<1) /*!< Do not log shader sources. Helps to reduce log size further. */ 138 ,QP_TEST_LOG_NO_FLUSH = (1<<2) /*!< Do not do a fflush after writing the log. */ 139 ,QP_TEST_LOG_EXCLUDE_EMPTY_LOGINFO = (1<<3) /*!< Do not log empty shader compile or link loginfo. */ 140 ,QP_TEST_LOG_NO_INITIAL_OUTPUT = (1<<4) /*!< Do not push data to cout when initializing log. */ 141 ,QP_TEST_LOG_COMPACT = (1<<5) /*!< Only write test case status. */ 142 } qpTestLogFlag; 143 144 /* Shader type. */ 145 typedef enum qpShaderType_e 146 { 147 QP_SHADER_TYPE_VERTEX = 0, 148 QP_SHADER_TYPE_FRAGMENT, 149 QP_SHADER_TYPE_GEOMETRY, 150 QP_SHADER_TYPE_TESS_CONTROL, 151 QP_SHADER_TYPE_TESS_EVALUATION, 152 QP_SHADER_TYPE_COMPUTE, 153 QP_SHADER_TYPE_RAYGEN, 154 QP_SHADER_TYPE_ANY_HIT, 155 QP_SHADER_TYPE_CLOSEST_HIT, 156 QP_SHADER_TYPE_MISS, 157 QP_SHADER_TYPE_INTERSECTION, 158 QP_SHADER_TYPE_CALLABLE, 159 QP_SHADER_TYPE_TASK, 160 QP_SHADER_TYPE_MESH, 161 162 QP_SHADER_TYPE_LAST 163 } qpShaderType; 164 165 DE_BEGIN_EXTERN_C 166 167 /* \todo [2013-04-13 pyry] Clean up & document. Do we actually want this? */ 168 typedef struct qpEglConfigInfo_s 169 { 170 int bufferSize; 171 int redSize; 172 int greenSize; 173 int blueSize; 174 int luminanceSize; 175 int alphaSize; 176 int alphaMaskSize; 177 deBool bindToTextureRGB; 178 deBool bindToTextureRGBA; 179 const char* colorBufferType; 180 const char* configCaveat; 181 int configID; 182 const char* conformant; 183 int depthSize; 184 int level; 185 int maxPBufferWidth; 186 int maxPBufferHeight; 187 int maxPBufferPixels; 188 int maxSwapInterval; 189 int minSwapInterval; 190 deBool nativeRenderable; 191 const char* renderableType; 192 int sampleBuffers; 193 int samples; 194 int stencilSize; 195 const char* surfaceTypes; 196 const char* transparentType; 197 int transparentRedValue; 198 int transparentGreenValue; 199 int transparentBlueValue; 200 deBool recordableAndroid; 201 } qpEglConfigInfo; 202 203 204 qpTestLog* qpTestLog_createFileLog (const char* fileName, deUint32 flags); 205 deBool qpTestLog_beginSession (qpTestLog* log, const char* additionalSessionInfo); 206 void qpTestLog_destroy (qpTestLog* log); 207 deBool qpTestLog_isCompact (qpTestLog* log); 208 209 deBool qpTestLog_startCase (qpTestLog* log, const char* testCasePath, qpTestCaseType testCaseType); 210 deBool qpTestLog_endCase (qpTestLog* log, qpTestResult result, const char* description); 211 212 deBool qpTestLog_startTestsCasesTime (qpTestLog* log); 213 deBool qpTestLog_endTestsCasesTime (qpTestLog* log); 214 215 deBool qpTestLog_terminateCase (qpTestLog* log, qpTestResult result); 216 217 deBool qpTestLog_startSection (qpTestLog* log, const char* name, const char* description); 218 deBool qpTestLog_endSection (qpTestLog* log); 219 deBool qpTestLog_writeText (qpTestLog* log, const char* name, const char* description, qpKeyValueTag tag, const char* value); 220 deBool qpTestLog_writeInteger (qpTestLog* log, const char* name, const char* description, const char* unit, qpKeyValueTag tag, deInt64 value); 221 deBool qpTestLog_writeFloat (qpTestLog* log, const char* name, const char* description, const char* unit, qpKeyValueTag tag, float value); 222 223 deBool qpTestLog_startImageSet (qpTestLog* log, const char* name, const char* description); 224 deBool qpTestLog_endImageSet (qpTestLog* log); 225 deBool qpTestLog_writeImage (qpTestLog* log, const char* name, const char* description, qpImageCompressionMode compressionMode, qpImageFormat format, int width, int height, int stride, const void* data); 226 227 deBool qpTestLog_startEglConfigSet (qpTestLog* log, const char* key, const char* description); 228 deBool qpTestLog_writeEglConfig (qpTestLog* log, const qpEglConfigInfo* config); 229 deBool qpTestLog_endEglConfigSet (qpTestLog* log); 230 231 /* \todo [2013-08-26 pyry] Unify ShaderProgram & KernelSource & CompileInfo. */ 232 233 deBool qpTestLog_startShaderProgram (qpTestLog* log, deBool linkOk, const char* linkInfoLog); 234 deBool qpTestLog_endShaderProgram (qpTestLog* log); 235 deBool qpTestLog_writeShader (qpTestLog* log, qpShaderType type, const char* source, deBool compileOk, const char* infoLog); 236 237 deBool qpTestLog_writeKernelSource (qpTestLog* log, const char* source); 238 deBool qpTestLog_writeSpirVAssemblySource (qpTestLog* log, const char* source); 239 deBool qpTestLog_writeCompileInfo (qpTestLog* log, const char* name, const char* description, deBool compileOk, const char* infoLog); 240 241 deBool qpTestLog_startSampleList (qpTestLog* log, const char* name, const char* description); 242 deBool qpTestLog_startSampleInfo (qpTestLog* log); 243 deBool qpTestLog_writeValueInfo (qpTestLog* log, const char* name, const char* description, const char* unit, qpSampleValueTag tag); 244 deBool qpTestLog_endSampleInfo (qpTestLog* log); 245 deBool qpTestLog_startSample (qpTestLog* log); 246 deBool qpTestLog_writeValueFloat (qpTestLog* log, double value); 247 deBool qpTestLog_writeValueInteger (qpTestLog* log, deInt64 value); 248 deBool qpTestLog_endSample (qpTestLog* log); 249 deBool qpTestLog_endSampleList (qpTestLog* log); 250 251 deBool qpTestLog_writeRaw (qpTestLog* log, const char* rawContents); 252 253 deUint32 qpTestLog_getLogFlags (const qpTestLog* log); 254 255 const char* qpGetTestResultName (qpTestResult result); 256 257 DE_END_EXTERN_C 258 259 /*! \} */ 260 261 #endif /* _QPTESTLOG_H */ 262