from fnmatch import fnmatch
from copy import copy
+import argparse
import xml.etree.cElementTree as ElementTree
import xml.dom.minidom as minidom
-APK_NAME = "com.drawelements.deqp.apk"
+APK_NAME = "com.drawelements.deqp.apk"
GENERATED_FILE_WARNING = """
This file has been automatically generated. Edit with caution.
reparsed = minidom.parseString(uglyString)
return reparsed.toprettyxml(indent='\t', encoding='utf-8')
-def genCTSPackageXML (mustpass, package, root):
- def isLeafGroup (testGroup):
- numGroups = 0
- numTests = 0
-
- for child in testGroup.children:
- if isinstance(child, TestCase):
- numTests += 1
- else:
- numGroups += 1
-
- assert numGroups + numTests > 0
-
- if numGroups > 0 and numTests > 0:
- die("Mixed groups and cases in %s" % testGroup.name)
-
- return numGroups == 0
-
- def makeConfiguration (parentElem, config):
- attributes = {}
-
- if config.glconfig != None:
- attributes['glconfig'] = config.glconfig
-
- if config.rotation != None:
- attributes['rotation'] = config.rotation
-
- if config.surfacetype != None:
- attributes['surfacetype'] = config.surfacetype
-
- return ElementTree.SubElement(parentElem, "TestInstance", attributes)
-
- def makeTestCase (parentElem, testCase):
- caseElem = ElementTree.SubElement(parentElem, "Test", name=testCase.name)
- for config in testCase.configurations:
- makeConfiguration(caseElem, config)
- return caseElem
-
- def makeTestGroup (parentElem, testGroup):
- groupElem = ElementTree.SubElement(parentElem, "TestCase" if isLeafGroup(testGroup) else "TestSuite", name=testGroup.name)
- for child in testGroup.children:
- if isinstance(child, TestCase):
- makeTestCase(groupElem, child)
- else:
- makeTestGroup(groupElem, child)
- return groupElem
-
- pkgElem = ElementTree.Element("TestPackage",
- name = package.module.name,
- appPackageName = getCTSPackageName(package),
- testType = "deqpTest")
-
- pkgElem.set("xmlns:deqp", "http://drawelements.com/deqp")
- insertXMLHeaders(mustpass, pkgElem)
-
- glesVersion = getModuleGLESVersion(package.module)
-
- if glesVersion != None:
- pkgElem.set("deqp:glesVersion", str(glesVersion.encode()))
-
- for child in root.children:
- makeTestGroup(pkgElem, child)
-
- return pkgElem
-
def genSpecXML (mustpass):
mustpassElem = ElementTree.Element("Mustpass", version = mustpass.version)
insertXMLHeaders(mustpass, mustpassElem)
RUNNER_CLASS = "com.drawelements.deqp.runner.DeqpTestRunner"
configElement = ElementTree.Element("configuration")
+ # add in metadata option for component name
+ ElementTree.SubElement(configElement, "option", name="config-descriptor:metadata", key="component", value="deqp")
+
for package in mustpass.packages:
for config in package.configurations:
testElement = ElementTree.SubElement(configElement, "test")
patternLists = readPatternLists(mustpass)
for package in mustpass.packages:
- allCasesInPkg = moduleCaseLists[package.module]
- matchingByConfig = {}
- allMatchingSet = set()
+ allCasesInPkg = moduleCaseLists[package.module]
for config in package.configurations:
filtered = applyFilters(allCasesInPkg, patternLists, config.filters)
print " Writing deqp caselist: " + dstFile
writeFile(dstFile, "\n".join(filtered) + "\n")
- matchingByConfig[config] = filtered
- allMatchingSet = allMatchingSet | set(filtered)
-
- allMatchingCases = [c for c in allCasesInPkg if c in allMatchingSet] # To preserve ordering
- root = buildTestHierachy(allMatchingCases)
- testCaseMap = buildTestCaseMap(root)
-
- for config in package.configurations:
- for case in matchingByConfig[config]:
- testCaseMap[case].configurations.append(config)
-
- # NOTE: CTS v2 does not need package XML files. Remove when transition is complete.
- packageXml = genCTSPackageXML(mustpass, package, root)
- xmlFilename = os.path.join(mustpass.project.path, mustpass.version, getCTSPackageName(package) + ".xml")
-
- print " Writing CTS caselist: " + xmlFilename
- writeFile(xmlFilename, prettifyXML(packageXml))
-
specXML = genSpecXML(mustpass)
specFilename = os.path.join(mustpass.project.path, mustpass.version, "mustpass.xml")
for mustpass in mustpassLists:
genMustpass(mustpass, moduleCaseLists)
+
+def parseCmdLineArgs ():
+ parser = argparse.ArgumentParser(description = "Build Android CTS mustpass",
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter)
+ parser.add_argument("-b",
+ "--build-dir",
+ dest="buildDir",
+ default=DEFAULT_BUILD_DIR,
+ help="Temporary build directory")
+ parser.add_argument("-t",
+ "--build-type",
+ dest="buildType",
+ default="Debug",
+ help="Build type")
+ parser.add_argument("-c",
+ "--deqp-target",
+ dest="targetName",
+ default=DEFAULT_TARGET,
+ help="dEQP build target")
+ return parser.parse_args()
+
+def parseBuildConfigFromCmdLineArgs ():
+ args = parseCmdLineArgs()
+ return getBuildConfig(args.buildDir, args.targetName, args.buildType)