1 #ifndef _XSPOSIXTESTPROCESS_HPP
2 #define _XSPOSIXTESTPROCESS_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program Execution Server
5 * ---------------------------------------------
7 * Copyright 2014 The Android Open Source Project
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 * \brief TestProcess implementation for Unix-like systems.
24 *//*--------------------------------------------------------------------*/
27 #include "xsTestProcess.hpp"
28 #include "xsPosixFileReader.hpp"
29 #include "deProcess.hpp"
30 #include "deThread.hpp"
40 class CaseListWriter : public de::Thread
43 CaseListWriter (void);
44 ~CaseListWriter (void);
46 void start (const char* caseList, deFile* dst);
53 std::vector<char> m_caseList;
57 class PipeReader : public de::Thread
60 PipeReader (ThreadedByteBuffer* dst);
63 void start (deFile* file);
70 ThreadedByteBuffer* m_buf;
75 class PosixTestProcess : public TestProcess
78 PosixTestProcess (void);
79 virtual ~PosixTestProcess (void);
81 virtual void start (const char* name, const char* params, const char* workingDir, const char* caseList);
82 virtual void terminate (void);
83 virtual void cleanup (void);
85 virtual bool isRunning (void);
87 virtual int getExitCode (void) const;
89 virtual int readTestLog (deUint8* dst, int numBytes);
90 virtual int readInfoLog (deUint8* dst, int numBytes) { return m_infoBuffer.tryRead(numBytes, dst); }
93 PosixTestProcess (const PosixTestProcess& other);
94 PosixTestProcess& operator= (const PosixTestProcess& other);
96 de::Process* m_process;
97 deUint64 m_processStartTime; //!< Used for determining log file timeout.
98 std::string m_logFileName;
99 ThreadedByteBuffer m_infoBuffer;
102 posix::CaseListWriter m_caseListWriter;
103 posix::PipeReader m_stdOutReader;
104 posix::PipeReader m_stdErrReader;
105 posix::FileReader m_logReader;
110 #endif // _XSPOSIXTESTPROCESS_HPP