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