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/vulkancts/modules/vulkan/vktTestPackage.hpp"
30
31 #include "logdefine.h"
32 #include "ImageBaseFunc.h"
33
34
createTestPackage(tcu::TestContext & testCtx)35 static tcu::TestPackage* createTestPackage (tcu::TestContext& testCtx)
36 {
37 return new vkt::TestPackage(testCtx);
38 }
39
createExperimentalTestPackage(tcu::TestContext & testCtx)40 static tcu::TestPackage* createExperimentalTestPackage (tcu::TestContext& testCtx)
41 {
42 return new vkt::ExperimentalTestPackage(testCtx);
43 }
44
45 // tcu::TestPackageDescriptor g_vktPackageDescriptor("dEQP-VK", createTestPackage);
46 // tcu::TestPackageDescriptor g_vktExperimentalPackageDescriptor("dEQP-VK-experimental", createExperimentalTestPackage);
47
RegistPackage(void)48 void RegistPackage(void)
49 {
50 tcu::TestPackageRegistry *registry = tcu::TestPackageRegistry::getSingleton();
51 registry->registerPackage("dEQP-VK", createTestPackage);
52 registry->registerPackage("dEQP-VK-experimental", createExperimentalTestPackage);
53 }
54
55
56 // extern tcu::TestLog tcutestlog;
RunTestKHRGLES(int argc,const char ** argv)57 FuncRunResult RunTestKHRGLES(int argc, const char** argv)
58 {
59 FuncRunResult runResult;
60 try {
61 tcu::CommandLine cmdLine(argc, argv);
62 std::cout << "testmain end argc"<< argc << ";" << argv[0] << ";" << argv[1] << ";" << argv[2] << std::endl;
63 tcu::DirArchive archive(cmdLine.getArchiveDir());
64
65 de::UniquePtr<tcu::Platform> platform(createOhosPlatform());
66 de::UniquePtr<tcu::App> app(new tcu::App(*platform, archive, OHOS::Logdefine::tcutestlog, cmdLine));
67
68 for (;;) {
69 if (!app->iterate()) {
70 break;
71 };
72 };
73 runResult.isComplete = app->getResult().isComplete;
74 runResult.numPassed = app->getResult().numPassed;
75 runResult.numExecuted = app->getResult().numExecuted;
76 runResult.numFailed = app->getResult().numFailed;
77 runResult.numNotSupported = app->getResult().numNotSupported;
78 runResult.numWarnings = app->getResult().numWarnings;
79 runResult.numWaived = app->getResult().numWaived;
80 } catch (const std::exception &e) {
81 tcu::die("%s", e.what());
82 };
83 return runResult;
84 }