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) } };
67 const char* value = arg + 7;
70 for (; ndx < DE_LENGTH_OF_ARRAY(runTypes); ndx++)
72 if (deStringEqual(runTypes[ndx].name, value))
74 cmdLine.runType = runTypes[ndx].runType;
79 if (ndx >= DE_LENGTH_OF_ARRAY(runTypes))
82 else if (deStringBeginsWith(arg, "--logdir="))
84 const char* value = arg + 9;
85 cmdLine.dstLogDir = value;
87 else if (deStringBeginsWith(arg, "--summary"))
89 cmdLine.flags = glcts::TestRunner::PRINT_SUMMARY;
91 else if (deStringEqual(arg, "--verbose"))
92 cmdLine.flags = glcts::TestRunner::VERBOSE_ALL;
100 static void printHelp(const char* binName)
102 printf("%s:\n", binName);
103 printf(" --type=[esN[M]|glNM] Conformance test run type. Choose from\n");
104 printf(" ES: es2, es3, es31, es32\n");
105 printf(" GL: gl30, gl31, gl32, gl33, gl40, gl41, gl42, gl43, gl44, gl45\n");
106 printf(" --logdir=[path] Destination directory for log files\n");
107 printf(" --summary Print summary without running the tests\n");
108 printf(" --verbose Print out and log more information\n");
111 int main(int argc, char** argv)
115 if (!parseCommandLine(cmdLine, argc, argv))
123 de::UniquePtr<tcu::Platform> platform(createPlatform());
124 tcu::DirArchive archive(".");
125 glcts::TestRunner runner(static_cast<tcu::Platform&>(*platform.get()), archive, cmdLine.dstLogDir.c_str(),
126 cmdLine.runType, cmdLine.flags);
130 if (!runner.iterate())
134 catch (const std::exception& e)
136 printf("ERROR: %s\n", e.what());