1 /*-------------------------------------------------------------------------
2  * drawElements Quality Program Tester Core
3  * ----------------------------------------
4  *
5  * Copyright 2014 The Android Open Source Project
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */ /*!
20  * \file
21  * \brief Generic main().
22  */ /*--------------------------------------------------------------------*/
23 
24 #ifndef TCU_RANDOM_ORDER_EXECUTOR_H_
25 #define TCU_RANDOM_ORDER_EXECUTOR_H_
26 
27 #include "deUniquePtr.hpp"
28 #include "tcuTestHierarchyIterator.hpp"
29 
30 #include "tests/test_utils/RenderDoc.h"
31 
32 namespace tcu
33 {
34 
35 class RandomOrderExecutor
36 {
37   public:
38     RandomOrderExecutor(TestPackageRoot &root, TestContext &testCtx, bool enableRenderDocCapture);
39     ~RandomOrderExecutor(void);
40 
41     TestStatus execute(const std::string &path);
42 
43   private:
44     void pruneStack(size_t newStackSize);
45     TestCase *seekToCase(const std::string &path);
46 
47     TestStatus executeInner(TestCase *testCase, const std::string &casePath);
48 
49     struct NodeStackEntry
50     {
51         TestNode *node;
52         std::vector<TestNode *> children;
53 
NodeStackEntryNodeStackEntry54         NodeStackEntry(void) : node(DE_NULL) {}
NodeStackEntryNodeStackEntry55         NodeStackEntry(TestNode *node_) : node(node_) {}
56     };
57 
58     TestContext &m_testCtx;
59 
60     DefaultHierarchyInflater m_inflater;
61     std::vector<NodeStackEntry> m_nodeStack;
62 
63     de::MovePtr<TestCaseExecutor> m_caseExecutor;
64 
65     RenderDoc mRenderDoc;
66 };
67 
68 }  // namespace tcu
69 
70 #endif  // TCU_RANDOM_ORDER_EXECUTOR_H_
71