13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _XETESTRESULTPARSER_HPP
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _XETESTRESULTPARSER_HPP
33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*-------------------------------------------------------------------------
43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program Test Executor
53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ------------------------------------------
63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project
83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License");
103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License.
113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at
123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *      http://www.apache.org/licenses/LICENSE-2.0
143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software
163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS,
173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and
193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License.
203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*!
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Test case result parser.
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "xeDefs.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "xeXMLParser.hpp"
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "xeTestCaseResult.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <vector>
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace xe
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyryenum TestLogVersion
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TESTLOGVERSION_0_2_0 = 0,
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TESTLOGVERSION_0_3_0,
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TESTLOGVERSION_0_3_1,
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TESTLOGVERSION_0_3_2,
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TESTLOGVERSION_0_3_3,
42352d99d9473086a05b992d47e6af29480ef57840Mika Isojärvi	TESTLOGVERSION_0_3_4,
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TESTLOGVERSION_LAST
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TestResultParseError : public ParseError
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestResultParseError (const std::string& message) : ParseError(message) {}
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TestResultParser
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	enum ParseResult
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		PARSERESULT_NOT_CHANGED,
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		PARSERESULT_CHANGED,
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		PARSERESULT_COMPLETE,
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		PARSERESULT_ERROR,
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		PARSERESULT_LAST
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							TestResultParser			(void);
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							~TestResultParser			(void);
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					init						(TestCaseResult* dstResult);
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ParseResult				parse						(const deUint8* bytes, int numBytes);
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							TestResultParser			(const TestResultParser& other);
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestResultParser&		operator=					(const TestResultParser& other);
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					clear						(void);
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					handleElementStart			(void);
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					handleElementEnd			(void);
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					handleData					(void);
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char*				getAttribute				(const char* name);
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ri::Item*				getCurrentItem				(void);
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ri::List*				getCurrentItemList			(void);
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					pushItem					(ri::Item* item);
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					popItem						(void);
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					updateCurrentItemList		(void);
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	enum State
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		STATE_NOT_INITIALIZED = 0,
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		STATE_INITIALIZED,
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		STATE_IN_TEST_CASE_RESULT,
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		STATE_TEST_CASE_RESULT_ENDED,
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		STATE_LAST
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	xml::Parser				m_xmlParser;
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestCaseResult*			m_result;
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	State					m_state;
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLogVersion			m_logVersion;		//!< Only valid in STATE_IN_TEST_CASE_RESULT.
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<ri::Item*>	m_itemStack;
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ri::List*				m_curItemList;
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int						m_base64DecodeOffset;
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string				m_curNumValue;
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Helpers exposed to other parsers.
1153c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTestStatusCode	getTestStatusCode			(const char* statusCode);
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Parsing helpers.
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TestCaseResultData;
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid			parseTestCaseResultFromData	(TestResultParser* parser, TestCaseResult* result, const TestCaseResultData& data);
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // xe
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif // _XETESTRESULTPARSER_HPP
126