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("GTF-GLES2", "GLES2" ),
52 Module("GTF-GLES3", "GLES3" ),
53 Module("GTF-GLES31", "GLES31"),
55 GLCTS_BIN_NAME = "glcts"
56 GLCTS_DIR_NAME = "external/openglcts/modules/"
57 DEFAULT_BUILD_DIR = os.path.join(tempfile.gettempdir(), "deqp-caselists", "{targetName}-{buildType}")
58 DEFAULT_TARGET = "null"
60 def getModuleByName (name):
61 for module in MODULES:
62 if module.name == name:
65 raise Exception("Unknown module %s" % name)
67 def getBuildConfig (buildPathPtrn, targetName, buildType):
68 buildPath = buildPathPtrn.format(
69 targetName = targetName,
70 buildType = buildType)
72 return BuildConfig(buildPath, buildType, ["-DDEQP_TARGET=%s" % targetName])
74 def getModulesPath (buildCfg):
75 return os.path.join(buildCfg.getBuildDir(), GLCTS_DIR_NAME)
77 def getCaseListFileName (module, caseListType):
78 return "%s-cases.%s" % (module.name, caseListType)
80 def getCaseListPath (buildCfg, module, caseListType):
81 workDir = getModulesPath(buildCfg)
83 return os.path.join(workDir, getCaseListFileName(module, caseListType))
85 def genCaseList (buildCfg, generator, caseListType):
86 workDir = getModulesPath(buildCfg)
88 pushWorkingDir(workDir)
91 binPath = generator.getBinaryPath(buildCfg.getBuildType(), os.path.join(".", GLCTS_BIN_NAME))
92 execute([binPath, "--deqp-runmode=%s-caselist" % caseListType])
96 def genAndCopyCaseList (buildCfg, generator, module, dstDir, caseListType):
97 caseListFile = getCaseListFileName(module, caseListType)
98 srcPath = getCaseListPath(buildCfg, module, caseListType)
99 dstPath = os.path.join(dstDir, caseListFile)
101 if os.path.exists(srcPath):
104 genCaseList(buildCfg, generator, module, caseListType)
106 if not os.path.exists(srcPath):
107 raise Exception("%s not generated" % srcPath)
109 shutil.copyfile(srcPath, dstPath)