1 # -*- coding: utf-8 -*-
3 #-------------------------------------------------------------------------
4 # drawElements Quality Program utilities
5 # --------------------------------------
7 # Copyright 2015 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.
21 #-------------------------------------------------------------------------
30 sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "..", "scripts"))
32 from build.common import *
33 from build.config import *
34 from build.build import *
38 def __init__ (self, name, api):
43 Module("dEQP-EGL", "EGL"),
44 Module("dEQP-GLES2", "GLES2"),
45 Module("dEQP-GLES3", "GLES3"),
46 Module("dEQP-GLES31", "GLES31"),
47 Module("KHR-GLES3", "GLES3"),
48 Module("KHR-GLES2", "GLES2"),
49 Module("KHR-GLES31", "GLES31"),
50 Module("KHR-GLES32", "GLES32"),
51 Module("KHR-NOCTX-ES2", "GLES2"),
52 Module("KHR-NOCTX-ES32","GLES32"),
53 Module("GTF-GLES2", "GLES2" ),
54 Module("GTF-GLES3", "GLES3" ),
55 Module("GTF-GLES31", "GLES31"),
56 Module("KHR-GL45", "GL45"),
57 Module("KHR-GL44", "GL44"),
58 Module("KHR-GL43", "GL43"),
59 Module("KHR-GL42", "GL42"),
60 Module("KHR-GL41", "GL41"),
61 Module("KHR-GL40", "GL40"),
62 Module("KHR-GL33", "GL33"),
63 Module("KHR-GL32", "GL32"),
64 Module("KHR-GL31", "GL31"),
65 Module("KHR-GL30", "GL30"),
66 Module("GTF-GL45", "GL45"),
67 Module("GTF-GL44", "GL44"),
68 Module("GTF-GL43", "GL43"),
69 Module("GTF-GL42", "GL42"),
70 Module("GTF-GL41", "GL41"),
71 Module("GTF-GL40", "GL40"),
72 Module("GTF-GL33", "GL33"),
73 Module("GTF-GL32", "GL32"),
74 Module("GTF-GL31", "GL31"),
75 Module("GTF-GL30", "GL30"),
76 Module("KHR-NOCTX-GL30","GL30"),
77 Module("KHR-NOCTX-GL45","GL45"),
79 GLCTS_BIN_NAME = "glcts"
80 GLCTS_DIR_NAME = "external/openglcts/modules/"
81 DEFAULT_BUILD_DIR = os.path.join(tempfile.gettempdir(), "deqp-caselists", "{targetName}-{buildType}")
82 DEFAULT_TARGET = "null"
84 def getModuleByName (name):
85 for module in MODULES:
86 if module.name == name:
89 raise Exception("Unknown module %s" % name)
91 def getBuildConfig (buildPathPtrn, targetName, buildType):
92 buildPath = buildPathPtrn.format(
93 targetName = targetName,
94 buildType = buildType)
96 return BuildConfig(buildPath, buildType, ["-DDEQP_TARGET=%s" % targetName])
98 def getModulesPath (buildCfg):
99 return os.path.join(buildCfg.getBuildDir(), GLCTS_DIR_NAME)
101 def getCaseListFileName (module, caseListType):
103 if mname == "KHR-NOCTX-ES2" or mname == "KHR-NOCTX-ES32" or mname == "KHR-NOCTX-GL30" or mname == "KHR-NOCTX-GL45":
104 mname = "KHR-NoContext"
105 return "%s-cases.%s" % (mname, caseListType)
107 def getCaseListPath (buildCfg, module, caseListType):
108 workDir = getModulesPath(buildCfg)
110 return os.path.join(workDir, getCaseListFileName(module, caseListType))
112 def genCaseList (buildCfg, generator, caseListType):
113 workDir = getModulesPath(buildCfg)
115 pushWorkingDir(workDir)
118 binPath = generator.getBinaryPath(buildCfg.getBuildType(), os.path.join(".", GLCTS_BIN_NAME))
119 execute([binPath, "--deqp-runmode=%s-caselist" % caseListType])
123 def genAndCopyCaseList (buildCfg, generator, module, dstDir, caseListType):
124 caseListFile = getCaseListFileName(module, caseListType)
125 srcPath = getCaseListPath(buildCfg, module, caseListType)
126 dstPath = os.path.join(dstDir, caseListFile)
128 if os.path.exists(srcPath):
131 genCaseList(buildCfg, generator, module, caseListType)
133 if not os.path.exists(srcPath):
134 raise Exception("%s not generated" % srcPath)
136 shutil.copyfile(srcPath, dstPath)