1#ifndef _XSTESTDRIVER_HPP 2#define _XSTESTDRIVER_HPP 3/*------------------------------------------------------------------------- 4 * drawElements Quality Program Execution Server 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 Driver. 24 *//*--------------------------------------------------------------------*/ 25 26#include "xsDefs.hpp" 27#include "xsProtocol.hpp" 28#include "xsTestProcess.hpp" 29 30#include <vector> 31 32namespace xs 33{ 34 35class TestDriver 36{ 37public: 38 TestDriver (xs::TestProcess* testProcess); 39 ~TestDriver (void); 40 41 void reset (void); 42 43 void startProcess (const char* name, const char* params, const char* workingDir, const char* caseList); 44 void stopProcess (void); 45 46 bool poll (ByteBuffer& messageBuffer); 47 48private: 49 enum State 50 { 51 STATE_NOT_STARTED = 0, 52 STATE_PROCESS_LAUNCH_FAILED, 53 STATE_PROCESS_STARTED, 54 STATE_PROCESS_RUNNING, 55 STATE_READING_DATA, 56 STATE_PROCESS_FINISHED, 57 58 STATE_LAST 59 }; 60 61 bool pollLogFile (ByteBuffer& messageBuffer); 62 bool pollInfo (ByteBuffer& messageBuffer); 63 bool pollBuffer (ByteBuffer& messageBuffer, MessageType msgType); 64 65 bool writeMessage (ByteBuffer& messageBuffer, const Message& message); 66 67 State m_state; 68 69 std::string m_lastLaunchFailure; 70 int m_lastExitCode; 71 72 xs::TestProcess* m_process; 73 deUint64 m_lastProcessDataTime; 74 75 std::vector<deUint8> m_dataMsgTmpBuf; 76}; 77 78} // xs 79 80#endif // _XSTESTDRIVER_HPP 81