1 /*
2  * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <cstdio>
17 #include <iostream>
18 
19 #include "tcuDefs.hpp"
20 #include "tcuCommandLine.hpp"
21 #include "tcuPlatform.hpp"
22 #include "tcuApp.hpp"
23 #include "tcuResource.hpp"
24 #include "tcuTestLog.hpp"
25 #include "tcuTestSessionExecutor.hpp"
26 #include "deUniquePtr.hpp"
27 #include "tcuOhosPlatform.hpp"
28 
29 #include "external/openglcts/modules/common/glcConfigPackage.hpp"
30 #include "external/openglcts/modules/common/glcSingleConfigTestPackage.hpp"
31 #include "external/openglcts/modules/common/glcTestPackage.hpp"
32 #include "external/openglcts/modules/gles2/es2cTestPackage.hpp"
33 #include "external/openglcts/modules/gles32/es32cTestPackage.hpp"
34 #include "external/openglcts/modules/gles31/es31cTestPackage.hpp"
35 #include "external/openglcts/modules/gles3/es3cTestPackage.hpp"
36 #include "external/openglcts/modules/glesext/esextcTestPackage.hpp"
37 
38 #include "modules/egl/teglTestPackage.hpp"
39 #include "modules/gles2/tes2TestPackage.hpp"
40 #include "modules/gles3/tes3TestPackage.hpp"
41 #include "modules/gles31/tes31TestPackage.hpp"
42 
43 #include "ohos_context_i.h"
44 #include "logdefine.h"
45 #include "EglBaseFunc.h"
46 
createTestPackage(tcu::TestContext& testCtx)47 static tcu::TestPackage* createTestPackage(tcu::TestContext& testCtx)
48 {
49     return new deqp::egl::TestPackage(testCtx);
50 }
51 
RegistPackage(void)52 void RegistPackage(void)
53 {
54     tcu::TestPackageRegistry *registry = tcu::TestPackageRegistry::getSingleton();
55     registry->registerPackage("dEQP-EGL", createTestPackage);
56 }
57 
58 // extern tcu::TestLog tcutestlog;
RunTestKHRGLES(int argc, const char** argv)59 FuncRunResult RunTestKHRGLES(int argc, const char** argv)
60 {
61     FuncRunResult runResult;
62     bool isExist = true;
63     try {
64         tcu::CommandLine cmdLine(argc, argv);
65         tcu::DirArchive archive(cmdLine.getArchiveDir());
66 
67         de::UniquePtr<tcu::Platform> platform(createOhosPlatform());
68         de::UniquePtr<tcu::App> app(new tcu::App(*platform, archive, OHOS::Logdefine::tcutestlog, cmdLine));
69 
70         for (;isExist;) {
71             if (!app->iterate()) {
72                 isExist = false;
73             };
74         };
75         runResult.isComplete = app->getResult().isComplete;
76         runResult.numPassed = app->getResult().numPassed;
77         runResult.numExecuted = app->getResult().numExecuted;
78         runResult.numFailed = app->getResult().numFailed;
79         runResult.numNotSupported = app->getResult().numNotSupported;
80         runResult.numWarnings = app->getResult().numWarnings;
81         runResult.numWaived = app->getResult().numWaived;
82     } catch (const std::exception &e) {
83         tcu::die("%s", e.what());
84     };
85     return runResult;
86 }