1 #ifndef _XEBATCHEXECUTOR_HPP
2 #define _XEBATCHEXECUTOR_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program Test Executor
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 Test batch executor.
24 *//*--------------------------------------------------------------------*/
27 #include "xeBatchResult.hpp"
28 #include "xeCommLink.hpp"
29 #include "xeTestLogParser.hpp"
30 #include "xeCallQueue.hpp"
38 struct TargetConfiguration
40 TargetConfiguration (void)
41 : maxCasesPerSession(1000)
45 std::string binaryName;
46 std::string workingDir;
47 std::string cmdLineArgs;
48 int maxCasesPerSession;
51 class BatchExecutorLogHandler : public TestLogHandler
54 BatchExecutorLogHandler (BatchResult* batchResult);
55 ~BatchExecutorLogHandler (void);
57 void setSessionInfo (const SessionInfo& sessionInfo);
59 TestCaseResultPtr startTestCaseResult (const char* casePath);
60 void testCaseResultUpdated (const TestCaseResultPtr& resultData);
61 void testCaseResultComplete (const TestCaseResultPtr& resultData);
64 BatchResult* m_batchResult;
70 BatchExecutor (const TargetConfiguration& config, CommLink* commLink, const TestNode* root, const TestSet& testSet, BatchResult* batchResult, InfoLog* infoLog);
71 ~BatchExecutor (void);
74 void cancel (void); //!< Cancel current run(), can be called from any thread.
77 BatchExecutor (const BatchExecutor& other);
78 BatchExecutor& operator= (const BatchExecutor& other);
82 void onStateChanged (CommLinkState state, const char* message);
83 void onTestLogData (const deUint8* bytes, size_t numBytes);
84 void onInfoLogData (const deUint8* bytes, size_t numBytes);
86 void launchTestSet (const TestSet& testSet);
88 // Callbacks for CommLink.
89 static void enqueueStateChanged (void* userPtr, CommLinkState state, const char* message);
90 static void enqueueTestLogData (void* userPtr, const deUint8* bytes, size_t numBytes);
91 static void enqueueInfoLogData (void* userPtr, const deUint8* bytes, size_t numBytes);
93 // Called in CallQueue dispatch.
94 static void dispatchStateChanged (CallReader& data);
95 static void dispatchTestLogData (CallReader& data);
96 static void dispatchInfoLogData (CallReader& data);
107 TargetConfiguration m_config;
108 CommLink* m_commLink;
110 const TestNode* m_root;
111 const TestSet& m_testSet;
113 BatchExecutorLogHandler m_logHandler;
114 BatchResult* m_batchResult;
118 TestSet m_casesToExecute;
120 TestLogParser m_testLogParser;
122 CallQueue m_dispatcher;
127 #endif // _XEBATCHEXECUTOR_HPP