1 #ifndef _TCUTESTPACKAGE_HPP
2 #define _TCUTESTPACKAGE_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program Tester Core
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 Base class for a test case.
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
27 #include "tcuTestCase.hpp"
37 TestRunStatus (void) { clear(); }
50 int numExecuted; //!< Total number of cases executed.
51 int numPassed; //!< Number of cases passed.
52 int numFailed; //!< Number of cases failed.
53 int numNotSupported; //!< Number of cases not supported.
54 int numWarnings; //!< Number of QualityWarning / CompatibilityWarning results.
55 int numWaived; //!< Number of waived tests.
56 bool isComplete; //!< Is run complete.
60 /*--------------------------------------------------------------------*//*!
61 * \brief Test case execution interface.
63 * TestCaseExecutor provides package-specific resources & initialization
66 * \todo [2015-03-18 pyry] Replace with following API:
71 * TestInstance (TestContext& testCtx);
72 * tcu::TestResult iterate (void);
75 * class TestInstanceFactory (???)
78 * TestInstance* createInstance (const TestCase* testCase, const std::string& path);
80 *//*--------------------------------------------------------------------*/
81 class TestCaseExecutor
84 virtual ~TestCaseExecutor (void) {}
86 virtual void init (TestCase* testCase, const std::string& path) = 0;
87 virtual void deinit (TestCase* testCase) = 0;
88 virtual TestNode::IterateResult iterate (TestCase* testCase) = 0;
89 virtual void deinitTestPackage (TestContext& testCtx) { DE_UNREF(testCtx); };
90 virtual bool usesLocalStatus () { return false; }
91 virtual void updateGlobalStatus (tcu::TestRunStatus& status) { DE_UNREF(status); }
92 virtual void reportDurations (tcu::TestContext& testCtx, const std::string& packageName, const deInt64& duration, const std::map<std::string, deUint64>& groupsDurationTime) { DE_UNREF(testCtx); DE_UNREF(packageName); DE_UNREF(duration); DE_UNREF(groupsDurationTime); }
95 /*--------------------------------------------------------------------*//*!
96 * \brief Base class for test packages.
98 * Test packages are root-level test groups. They also provide package-
99 * specific test case executor, see TestCaseExecutor.
100 *//*--------------------------------------------------------------------*/
101 class TestPackage : public TestNode
104 TestPackage (TestContext& testCtx, const char* name, const char* description);
105 virtual ~TestPackage (void);
107 virtual TestCaseExecutor* createExecutor (void) const = 0;
110 virtual Archive* getArchive (void) { return DE_NULL; }
112 virtual IterateResult iterate (void);
115 // TestPackageRegistry
117 typedef TestPackage* (*TestPackageCreateFunc) (TestContext& testCtx);
119 class TestPackageRegistry
124 PackageInfo (std::string name_, TestPackageCreateFunc createFunc_) : name(name_), createFunc(createFunc_) {}
127 TestPackageCreateFunc createFunc;
130 static TestPackageRegistry* getSingleton (void);
131 static void destroy (void);
133 void registerPackage (const char* name, TestPackageCreateFunc createFunc);
134 const std::vector<PackageInfo*>& getPackageInfos (void) const;
135 PackageInfo* getPackageInfoByName (const char* name) const;
136 TestPackage* createPackage (const char* name, TestContext& testCtx) const;
139 TestPackageRegistry (void);
140 ~TestPackageRegistry (void);
142 static TestPackageRegistry* getOrDestroy (bool isCreate);
145 std::vector<PackageInfo*> m_packageInfos;
148 // TestPackageDescriptor
150 class TestPackageDescriptor
153 TestPackageDescriptor (const char* name, TestPackageCreateFunc createFunc);
154 ~TestPackageDescriptor (void);
159 class TestPackageRoot : public TestNode
162 TestPackageRoot (TestContext& testCtx);
163 TestPackageRoot (TestContext& testCtx, const std::vector<TestNode*>& children);
164 TestPackageRoot (TestContext& testCtx, const TestPackageRegistry* packageRegistry);
165 virtual ~TestPackageRoot (void);
167 virtual IterateResult iterate (void);
172 #endif // _TCUTESTPACKAGE_HPP