зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1277424 - Update wrapper generater to generate webgl2 wrappers. - r=me
MozReview-Commit-ID: 6yihTsCNutV --HG-- extra : rebase_source : 2d04e7e43d3b2567e8ff99fcbda2ffd3eaf6c5fe
This commit is contained in:
Родитель
6a88fee619
Коммит
099766fbca
|
@ -19,10 +19,10 @@ DEST_MANIFEST_PATHSTR = 'generated-mochitest.ini'
|
|||
|
||||
BASE_TEST_LIST_PATHSTR = 'checkout/00_test_list.txt'
|
||||
GENERATED_PATHSTR = 'generated'
|
||||
PATH_SEP_MANGLING = '__'
|
||||
|
||||
SUPPORT_DIRS = [
|
||||
'checkout/conformance',
|
||||
'checkout/resources',
|
||||
'checkout',
|
||||
]
|
||||
|
||||
EXTRA_SUPPORT_FILES = [
|
||||
|
@ -47,11 +47,16 @@ def GetTestList():
|
|||
if len(split) == 2:
|
||||
basePath = split[0]
|
||||
|
||||
curVersion = CURRENT_VERSION
|
||||
testList = ['always-fail.html']
|
||||
AccumTests(basePath, testListFile, curVersion, testList)
|
||||
allowWebGL1 = True
|
||||
allowWebGL2 = True
|
||||
alwaysFailEntry = TestEntry('always-fail.html', True, False)
|
||||
testList = [alwaysFailEntry]
|
||||
AccumTests(basePath, testListFile, allowWebGL1, allowWebGL2, testList)
|
||||
|
||||
for x in testList:
|
||||
x.path = os.path.relpath(x.path, basePath).replace(os.sep, '/')
|
||||
continue
|
||||
|
||||
testList = [os.path.relpath(x, basePath).replace(os.sep, '/') for x in testList]
|
||||
return testList
|
||||
|
||||
##############################
|
||||
|
@ -78,8 +83,15 @@ def IsVersionLess(a, b):
|
|||
|
||||
return False
|
||||
|
||||
class TestEntry:
|
||||
def __init__(self, path, webgl1, webgl2):
|
||||
self.path = path
|
||||
self.webgl1 = webgl1
|
||||
self.webgl2 = webgl2
|
||||
return
|
||||
|
||||
def AccumTests(pathStr, listFile, curVersion, out_testList):
|
||||
|
||||
def AccumTests(pathStr, listFile, allowWebGL1, allowWebGL2, out_testList):
|
||||
listPathStr = pathStr + '/' + listFile
|
||||
|
||||
listPath = listPathStr.replace('/', os.sep)
|
||||
|
@ -100,18 +112,19 @@ def AccumTests(pathStr, listFile, curVersion, out_testList):
|
|||
if curLine.startswith('#'):
|
||||
continue
|
||||
|
||||
shouldSkip = False
|
||||
webgl1 = allowWebGL1
|
||||
webgl2 = allowWebGL2
|
||||
while curLine.startswith('--'): # '--min-version 1.0.2 foo.html'
|
||||
(flag, curLine) = curLine.split(' ', 1)
|
||||
if flag == '--min-version':
|
||||
(refVersion, curLine) = curLine.split(' ', 1)
|
||||
if IsVersionLess(curVersion, refVersion):
|
||||
shouldSkip = True
|
||||
(minVersion, curLine) = curLine.split(' ', 1)
|
||||
if not IsVersionLess(minVersion, "2.0.0"): # >= 2.0.0
|
||||
webgl1 = False
|
||||
break
|
||||
elif flag == '--max-version':
|
||||
(refVersion, curLine) = curLine.split(' ', 1)
|
||||
if IsVersionLess(refVersion, curVersion):
|
||||
shouldSkip = True
|
||||
(maxVersion, curLine) = curLine.split(' ', 1)
|
||||
if IsVersionLess(maxVersion, "2.0.0"):
|
||||
webgl2 = False
|
||||
break
|
||||
elif flag == '--slow':
|
||||
continue # TODO
|
||||
|
@ -121,8 +134,7 @@ def AccumTests(pathStr, listFile, curVersion, out_testList):
|
|||
assert False, text
|
||||
continue
|
||||
|
||||
if shouldSkip:
|
||||
continue
|
||||
assert(webgl1 or webgl2)
|
||||
|
||||
split = curLine.rsplit('.', 1)
|
||||
assert len(split) == 2, 'Bad split for `line`: ' + line
|
||||
|
@ -130,7 +142,8 @@ def AccumTests(pathStr, listFile, curVersion, out_testList):
|
|||
|
||||
if ext == 'html':
|
||||
newTestFilePathStr = pathStr + '/' + curLine
|
||||
out_testList.append(newTestFilePathStr)
|
||||
entry = TestEntry(newTestFilePathStr, webgl1, webgl2)
|
||||
out_testList.append(entry)
|
||||
continue
|
||||
|
||||
assert ext == 'txt', 'Bad `ext` on `line`: ' + line
|
||||
|
@ -142,7 +155,7 @@ def AccumTests(pathStr, listFile, curVersion, out_testList):
|
|||
nextPathStr = split[0]
|
||||
|
||||
nextPathStr = pathStr + '/' + nextPathStr
|
||||
AccumTests(nextPathStr, nextListFile, curVersion, out_testList)
|
||||
AccumTests(nextPathStr, nextListFile, webgl1, webgl2, out_testList)
|
||||
continue
|
||||
|
||||
return
|
||||
|
@ -271,7 +284,35 @@ class TemplateShell:
|
|||
########################################################################
|
||||
# Output
|
||||
|
||||
def WriteWrappers(testWebPathStrList):
|
||||
def WriteWrapper(entryPath, webgl2, templateShell, wrapperPathAccum):
|
||||
mangledPath = entryPath.replace('/', PATH_SEP_MANGLING)
|
||||
maybeWebGL2 = ''
|
||||
if webgl2:
|
||||
maybeWebGL2 = '2_'
|
||||
|
||||
# Mochitests must start with 'test_' or similar, or the test
|
||||
# runner will ignore our tests.
|
||||
# The error text is "is not a valid test".
|
||||
wrapperFileName = 'test_{}{}'.format(maybeWebGL2, mangledPath)
|
||||
|
||||
wrapperPath = GENERATED_PATHSTR + '/' + wrapperFileName
|
||||
print('Adding wrapper: ' + wrapperPath)
|
||||
|
||||
args = ''
|
||||
if webgl2:
|
||||
args = '?webglVersion=2'
|
||||
|
||||
templateDict = {
|
||||
'TEST_PATH': entryPath,
|
||||
'ARGS': args,
|
||||
}
|
||||
|
||||
OutputFilledTemplate(templateShell, templateDict, wrapperPath)
|
||||
wrapperPathAccum.append(wrapperPath)
|
||||
return
|
||||
|
||||
|
||||
def WriteWrappers(testEntryList):
|
||||
templateShell = ImportTemplate(WRAPPER_TEMPLATE_FILE)
|
||||
|
||||
generatedDirPath = GENERATED_PATHSTR.replace('/', os.sep)
|
||||
|
@ -279,25 +320,16 @@ def WriteWrappers(testWebPathStrList):
|
|||
os.mkdir(generatedDirPath)
|
||||
assert os.path.isdir(generatedDirPath)
|
||||
|
||||
wrapperManifestPathStrList = []
|
||||
for testWebPathStr in testWebPathStrList:
|
||||
# Mochitests must start with 'test_' or similar, or the test
|
||||
# runner will ignore our tests.
|
||||
# The error text is "is not a valid test".
|
||||
wrapperFilePathStr = 'test_' + testWebPathStr.replace('/', '__')
|
||||
wrapperFilePathStr = GENERATED_PATHSTR + '/' + wrapperFilePathStr
|
||||
wrapperManifestPathStrList.append(wrapperFilePathStr)
|
||||
|
||||
templateDict = {
|
||||
'HEADER': '<!-- GENERATED FILE, DO NOT EDIT -->',
|
||||
'TEST_PATH': testWebPathStr,
|
||||
}
|
||||
|
||||
print 'Adding wrapper: ' + wrapperFilePathStr
|
||||
OutputFilledTemplate(templateShell, templateDict, wrapperFilePathStr)
|
||||
wrapperPathList = []
|
||||
for entry in testEntryList:
|
||||
if entry.webgl1:
|
||||
WriteWrapper(entry.path, False, templateShell, wrapperPathList)
|
||||
if entry.webgl2:
|
||||
WriteWrapper(entry.path, True, templateShell, wrapperPathList)
|
||||
continue
|
||||
|
||||
return wrapperManifestPathStrList
|
||||
print('{} wrappers written.\n'.format(len(wrapperPathList)))
|
||||
return wrapperPathList
|
||||
|
||||
|
||||
kManifestRelPathStr = os.path.relpath('.', os.path.dirname(DEST_MANIFEST_PATHSTR))
|
||||
|
@ -423,7 +455,7 @@ def LoadErrata():
|
|||
continue
|
||||
elif sectionName != 'DEFAULT':
|
||||
path = sectionName.replace('/', os.sep)
|
||||
assert os.path.exists(path), 'Line {}: {}'.format(sectionLineNum, sectionName)
|
||||
assert os.path.exists(path), 'Errata line {}: Invalid file: {}'.format(sectionLineNum, sectionName)
|
||||
|
||||
for (key, (lineNum, val)) in sectionMap.iteritems():
|
||||
assert key in ACCEPTABLE_ERRATA_KEYS, 'Line {}: {}'.format(lineNum, key)
|
||||
|
@ -469,8 +501,8 @@ if __name__ == '__main__':
|
|||
fileDir = os.path.dirname(__file__)
|
||||
assert not fileDir, 'Run this file from its directory, not ' + fileDir
|
||||
|
||||
testPathStrList = GetTestList()
|
||||
wrapperPathStrList = WriteWrappers(testPathStrList)
|
||||
testEntryList = GetTestList()
|
||||
wrapperPathStrList = WriteWrappers(testEntryList)
|
||||
|
||||
supportPathStrList = GetSupportFileList()
|
||||
WriteManifest(wrapperPathStrList, supportPathStrList)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
%%HEADER%%
|
||||
<!-- GENERATED FILE, DO NOT EDIT -->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
|
@ -12,6 +12,6 @@
|
|||
<link rel='stylesheet' type='text/css' href='/tests/SimpleTest/test.css'/>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src='../mochi-single.html?checkout/%%TEST_PATH%%'></iframe>
|
||||
<iframe src='../mochi-single.html?checkout/%%TEST_PATH%%%%ARGS%%'></iframe>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Загрузка…
Ссылка в новой задаче