1 /*-------------------------------------------------------------------------
2 * OpenGL Conformance Test Suite
3 * -----------------------------
5 * Copyright (c) 2016 Google Inc.
6 * Copyright (c) 2016 The Khronos Group Inc.
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 * \brief CTS runner main().
23 */ /*-------------------------------------------------------------------*/
26 #include "deUniquePtr.hpp"
27 #include "glcTestRunner.hpp"
28 #include "tcuPlatform.hpp"
29 #include "tcuResource.hpp"
34 tcu::Platform* createPlatform(void);
38 CommandLine(void) : runType(glu::ApiType::es(2, 0)), flags(0)
43 std::string dstLogDir;
47 static bool parseCommandLine(CommandLine& cmdLine, int argc, const char* const* argv)
49 for (int argNdx = 1; argNdx < argc; argNdx++)
51 const char* arg = argv[argNdx];
53 if (deStringBeginsWith(arg, "--type="))
59 } runTypes[] = { { "es2", glu::ApiType::es(2, 0) }, { "es3", glu::ApiType::es(3, 0) },
60 { "es31", glu::ApiType::es(3, 1) }, { "es32", glu::ApiType::es(3, 2) },
61 { "gl30", glu::ApiType::core(3, 0) }, { "gl31", glu::ApiType::core(3, 1) },
62 { "gl32", glu::ApiType::core(3, 2) }, { "gl33", glu::ApiType::core(3, 3) },
63 { "gl40", glu::ApiType::core(4, 0) }, { "gl41", glu::ApiType::core(4, 1) },
64 { "gl42", glu::ApiType::core(4, 2) }, { "gl43", glu::ApiType::core(4, 3) },
65 { "gl44", glu::ApiType::core(4, 4) }, { "gl45", glu::ApiType::core(4, 5) },
66 { "gl46", glu::ApiType::core(4, 6) } };
68 const char* value = arg + 7;
71 for (; ndx < DE_LENGTH_OF_ARRAY(runTypes); ndx++)
73 if (deStringEqual(runTypes[ndx].name, value))
75 cmdLine.runType = runTypes[ndx].runType;
80 if (ndx >= DE_LENGTH_OF_ARRAY(runTypes))
83 else if (deStringBeginsWith(arg, "--logdir="))
85 const char* value = arg + 9;
86 cmdLine.dstLogDir = value;
88 else if (deStringBeginsWith(arg, "--summary"))
90 cmdLine.flags = glcts::TestRunner::PRINT_SUMMARY;
92 else if (deStringEqual(arg, "--verbose"))
93 cmdLine.flags = glcts::TestRunner::VERBOSE_ALL;
101 static void printHelp(const char* binName)
103 printf("%s:\n", binName);
104 printf(" --type=[esN[M]|glNM] Conformance test run type. Choose from\n");
105 printf(" ES: es2, es3, es31, es32\n");
106 printf(" GL: gl30, gl31, gl32, gl33, gl40, gl41, gl42, gl43, gl44, gl45, gl46\n");
107 printf(" --logdir=[path] Destination directory for log files\n");
108 printf(" --summary Print summary without running the tests\n");
109 printf(" --verbose Print out and log more information\n");
112 int main(int argc, char** argv)
115 int exitStatus = EXIT_SUCCESS;
117 if (!parseCommandLine(cmdLine, argc, argv))
125 de::UniquePtr<tcu::Platform> platform(createPlatform());
126 tcu::DirArchive archive(".");
127 glcts::TestRunner runner(static_cast<tcu::Platform&>(*platform.get()), archive, cmdLine.dstLogDir.c_str(),
128 cmdLine.runType, cmdLine.flags);
132 if (!runner.iterate())
134 if (!runner.isConformant())
136 exitStatus = EXIT_FAILURE;
143 catch (const std::exception& e)
145 printf("ERROR: %s\n", e.what());