mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset f7c5431f1c82 (bug 1052240) for B2G ICS Emulator Debug/Opt on a CLOSED TREE
This commit is contained in:
parent
efe013af32
commit
7dce50ada5
@ -1,286 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
#
|
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
#
|
|
||||||
# Write a Mochitest manifest for WebGL conformance test files.
|
|
||||||
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
|
|
||||||
########################################################################
|
|
||||||
# GetTestList
|
|
||||||
|
|
||||||
def GetTestList():
|
|
||||||
testList = []
|
|
||||||
AccumTests('', BASE_TEST_LIST_FILENAME, testList)
|
|
||||||
return testList
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Internals
|
|
||||||
|
|
||||||
BASE_TEST_LIST_FILENAME = '00_test_list.txt'
|
|
||||||
|
|
||||||
def AccumTests(path, listFile, out_testList):
|
|
||||||
listFilePath = os.path.join(path, listFile)
|
|
||||||
assert os.path.exists(listFilePath), 'Bad `listFilePath`: ' + listFilePath
|
|
||||||
|
|
||||||
with open(listFilePath) as fIn:
|
|
||||||
for line in fIn:
|
|
||||||
line = line.rstrip()
|
|
||||||
if not line:
|
|
||||||
continue
|
|
||||||
|
|
||||||
strippedLine = line.lstrip()
|
|
||||||
if strippedLine.startswith('//'):
|
|
||||||
continue
|
|
||||||
if strippedLine.startswith('#'):
|
|
||||||
continue
|
|
||||||
if strippedLine.startswith('--'):
|
|
||||||
continue
|
|
||||||
|
|
||||||
split = line.rsplit('.', 1)
|
|
||||||
assert len(split) == 2, 'Bad split for `line`: ' + line
|
|
||||||
(name, ext) = split
|
|
||||||
|
|
||||||
if ext == 'html':
|
|
||||||
newTestFilePath = os.path.join(path, line)
|
|
||||||
out_testList.append(newTestFilePath)
|
|
||||||
continue
|
|
||||||
|
|
||||||
assert ext == 'txt', 'Bad `ext` on `line`: ' + line
|
|
||||||
|
|
||||||
split = line.rsplit('/', 1)
|
|
||||||
nextListFile = split[-1]
|
|
||||||
nextPath = ''
|
|
||||||
if len(split) != 1:
|
|
||||||
nextPath = split[0]
|
|
||||||
|
|
||||||
nextPath = os.path.join(path, nextPath)
|
|
||||||
AccumTests(nextPath, nextListFile, out_testList)
|
|
||||||
continue
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
########################################################################
|
|
||||||
# Templates
|
|
||||||
|
|
||||||
def FillTemplate(inFilePath, templateDict, outFilePath):
|
|
||||||
templateShell = ImportTemplate(inFilePath)
|
|
||||||
OutputFilledTemplate(templateShell, templateDict, outFilePath)
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
def ImportTemplate(inFilePath):
|
|
||||||
with open(inFilePath, 'r') as f:
|
|
||||||
return TemplateShell(f)
|
|
||||||
|
|
||||||
|
|
||||||
def OutputFilledTemplate(templateShell, templateDict, outFilePath):
|
|
||||||
spanStrList = templateShell.Fill(templateDict)
|
|
||||||
|
|
||||||
with open(outFilePath, 'w') as f:
|
|
||||||
f.writelines(spanStrList)
|
|
||||||
return
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Internals
|
|
||||||
|
|
||||||
def WrapWithIndent(lines, indentLen):
|
|
||||||
split = lines.split('\n')
|
|
||||||
if len(split) == 1:
|
|
||||||
return lines
|
|
||||||
|
|
||||||
ret = [split[0]]
|
|
||||||
indentSpaces = ' ' * indentLen
|
|
||||||
for line in split[1:]:
|
|
||||||
ret.append(indentSpaces + line)
|
|
||||||
|
|
||||||
return '\n'.join(ret)
|
|
||||||
|
|
||||||
|
|
||||||
templateRE = re.compile('(%%.*?%%)')
|
|
||||||
assert templateRE.split(' foo = %%BAR%%;') == [' foo = ', '%%BAR%%', ';']
|
|
||||||
|
|
||||||
|
|
||||||
class TemplateShellSpan:
|
|
||||||
def __init__(self, span):
|
|
||||||
self.span = span
|
|
||||||
|
|
||||||
self.isLiteralSpan = True
|
|
||||||
if self.span.startswith('%%') and self.span.endswith('%%'):
|
|
||||||
self.isLiteralSpan = False
|
|
||||||
self.span = self.span[2:-2]
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
def Fill(self, templateDict, indentLen):
|
|
||||||
if self.isLiteralSpan:
|
|
||||||
return self.span
|
|
||||||
|
|
||||||
assert (self.span in templateDict,
|
|
||||||
'\'' + self.span + '\' not in dict!')
|
|
||||||
|
|
||||||
filling = templateDict[self.span]
|
|
||||||
|
|
||||||
return WrapWithIndent(filling, indentLen)
|
|
||||||
|
|
||||||
|
|
||||||
class TemplateShell:
|
|
||||||
def __init__(self, iterableLines):
|
|
||||||
spanList = []
|
|
||||||
curLiteralSpan = []
|
|
||||||
for line in iterableLines:
|
|
||||||
split = templateRE.split(line)
|
|
||||||
|
|
||||||
for cur in split:
|
|
||||||
isTemplateSpan = cur.startswith('%%') and cur.endswith('%%')
|
|
||||||
if not isTemplateSpan:
|
|
||||||
curLiteralSpan.append(cur)
|
|
||||||
continue
|
|
||||||
|
|
||||||
if curLiteralSpan:
|
|
||||||
span = ''.join(curLiteralSpan)
|
|
||||||
span = TemplateShellSpan(span)
|
|
||||||
spanList.append(span)
|
|
||||||
curLiteralSpan = []
|
|
||||||
|
|
||||||
assert len(cur) >= 4
|
|
||||||
|
|
||||||
span = TemplateShellSpan(cur)
|
|
||||||
spanList.append(span)
|
|
||||||
continue
|
|
||||||
continue
|
|
||||||
|
|
||||||
if curLiteralSpan:
|
|
||||||
span = ''.join(curLiteralSpan)
|
|
||||||
span = TemplateShellSpan(span)
|
|
||||||
spanList.append(span)
|
|
||||||
|
|
||||||
self.spanList = spanList
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
# Returns spanStrList.
|
|
||||||
def Fill(self, templateDict):
|
|
||||||
indentLen = 0
|
|
||||||
ret = []
|
|
||||||
for span in self.spanList:
|
|
||||||
span = span.Fill(templateDict, indentLen)
|
|
||||||
ret.append(span)
|
|
||||||
|
|
||||||
# Get next `indentLen`.
|
|
||||||
try:
|
|
||||||
lineStartPos = span.rindex('\n') + 1
|
|
||||||
|
|
||||||
# let span = 'foo\nbar'
|
|
||||||
# len(span) is 7
|
|
||||||
# lineStartPos is 4
|
|
||||||
indentLen = len(span) - lineStartPos
|
|
||||||
except ValueError:
|
|
||||||
indentLen += len(span)
|
|
||||||
continue
|
|
||||||
|
|
||||||
return ret
|
|
||||||
|
|
||||||
########################################################################
|
|
||||||
# Output
|
|
||||||
|
|
||||||
def WriteWrappers(testFilePathList):
|
|
||||||
templateShell = ImportTemplate(WRAPPER_TEMPLATE_FILEPATH)
|
|
||||||
|
|
||||||
if not os.path.exists(WRAPPERS_DIR):
|
|
||||||
os.mkdir(WRAPPERS_DIR)
|
|
||||||
assert os.path.isdir(WRAPPERS_DIR)
|
|
||||||
|
|
||||||
wrapperFilePathList = []
|
|
||||||
for testFilePath in testFilePathList:
|
|
||||||
# Mochitests must start with 'test_' or similar, or the test
|
|
||||||
# runner will ignore our tests.
|
|
||||||
# The error text is "is not a valid test".
|
|
||||||
wrapperFilePath = 'test_' + testFilePath.replace(os.sep, '__')
|
|
||||||
wrapperFilePath = os.path.join(WRAPPERS_DIR, wrapperFilePath)
|
|
||||||
|
|
||||||
testFilePath = testFilePath.replace(os.sep, '/')
|
|
||||||
|
|
||||||
templateDict = {
|
|
||||||
'TEST_PATH': testFilePath,
|
|
||||||
}
|
|
||||||
|
|
||||||
print('Writing \'' + wrapperFilePath + '\'')
|
|
||||||
OutputFilledTemplate(templateShell, templateDict,
|
|
||||||
wrapperFilePath)
|
|
||||||
|
|
||||||
wrapperFilePathList.append(wrapperFilePath)
|
|
||||||
continue
|
|
||||||
|
|
||||||
return wrapperFilePathList
|
|
||||||
|
|
||||||
|
|
||||||
def WriteManifest(wrapperFilePathList, supportFilePathList):
|
|
||||||
manifestTestList = []
|
|
||||||
for cur in wrapperFilePathList:
|
|
||||||
manifestTestList.append('[' + cur + ']')
|
|
||||||
|
|
||||||
supportFilePathList = sorted(supportFilePathList)
|
|
||||||
|
|
||||||
supportFilesStr = '\n'.join(supportFilePathList)
|
|
||||||
manifestTestsStr = '\n'.join(manifestTestList)
|
|
||||||
|
|
||||||
templateDict = {
|
|
||||||
'SUPPORT_FILES': supportFilesStr,
|
|
||||||
'MANIFEST_TESTS': manifestTestsStr,
|
|
||||||
}
|
|
||||||
|
|
||||||
FillTemplate(MANIFEST_TEMPLATE_FILEPATH, templateDict,
|
|
||||||
MANIFEST_OUTPUT_FILEPATH)
|
|
||||||
return
|
|
||||||
|
|
||||||
##############################
|
|
||||||
# Internals
|
|
||||||
|
|
||||||
WRAPPER_TEMPLATE_FILEPATH = 'mochi-wrapper.html.template'
|
|
||||||
WRAPPERS_DIR = '_wrappers'
|
|
||||||
MANIFEST_TEMPLATE_FILEPATH = 'mochitest.ini.template'
|
|
||||||
MANIFEST_OUTPUT_FILEPATH = '_mochitest.ini'
|
|
||||||
|
|
||||||
########################################################################
|
|
||||||
|
|
||||||
SUPPORT_DIRS = [
|
|
||||||
'conformance',
|
|
||||||
'resources',
|
|
||||||
]
|
|
||||||
|
|
||||||
def GetSupportFileList():
|
|
||||||
ret = []
|
|
||||||
for supportDir in SUPPORT_DIRS:
|
|
||||||
ret += GetFilePathListForDir(supportDir)
|
|
||||||
|
|
||||||
return ret
|
|
||||||
|
|
||||||
def GetFilePathListForDir(baseDir):
|
|
||||||
ret = []
|
|
||||||
for root, folders, files in os.walk(baseDir):
|
|
||||||
for f in files:
|
|
||||||
filePath = os.path.join(root, f)
|
|
||||||
ret.append(filePath)
|
|
||||||
|
|
||||||
return ret
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
fileDir = os.path.dirname(__file__)
|
|
||||||
assert not fileDir, 'Run this file from its directory, not ' + fileDir
|
|
||||||
|
|
||||||
testFilePathList = GetTestList()
|
|
||||||
|
|
||||||
wrapperFilePathList = WriteWrappers(testFilePathList)
|
|
||||||
|
|
||||||
supportFilePathList = GetSupportFileList()
|
|
||||||
WriteManifest(wrapperFilePathList, supportFilePathList)
|
|
||||||
|
|
||||||
print('Done!')
|
|
||||||
|
|
||||||
|
|
@ -1,142 +0,0 @@
|
|||||||
<!DOCTYPE HTML>
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>
|
|
||||||
WebGL Conformance Test Suite Single Test Wrapper
|
|
||||||
</title>
|
|
||||||
<!-- Uncomment this to use this without mochi-wrapper.html files.
|
|
||||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
||||||
-->
|
|
||||||
<script src="../webgl-mochitest/driver-info.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div>Status: <span id='status'>Initializing</span></div>
|
|
||||||
<div>Path: <span id='path'>-</span></div>
|
|
||||||
<div>Failures: <span id='results'>-</span></div>
|
|
||||||
<iframe id='test-frame' width='100%' scrolling='no'></iframe>
|
|
||||||
<script>
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var IFRAME_BODY_MARGIN = 8;
|
|
||||||
var IFRAME_SIZE_UPDATE_INTERVAL = 100; // ms
|
|
||||||
|
|
||||||
////////////////////////////////////////
|
|
||||||
|
|
||||||
var statusElem = document.getElementById('status');
|
|
||||||
var pathElem = document.getElementById('path');
|
|
||||||
var resultsElem = document.getElementById('results');
|
|
||||||
var frameElem = document.getElementById('test-frame');
|
|
||||||
|
|
||||||
|
|
||||||
function RunTest(testPath) {
|
|
||||||
pathElem.innerHTML = testPath;
|
|
||||||
|
|
||||||
// Auto-update to grow the size of the doc.
|
|
||||||
function UpdateFrameSize() {
|
|
||||||
var frameBody = frameElem.contentWindow.document.body;
|
|
||||||
|
|
||||||
if (frameBody) {
|
|
||||||
var scrollHeight = frameBody.scrollHeight;
|
|
||||||
frameElem.height = scrollHeight + 2*IFRAME_BODY_MARGIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(UpdateFrameSize, IFRAME_SIZE_UPDATE_INTERVAL);
|
|
||||||
}
|
|
||||||
UpdateFrameSize();
|
|
||||||
|
|
||||||
// Load the iframe.
|
|
||||||
statusElem.innerHTML = 'Loading';
|
|
||||||
|
|
||||||
frameElem.onloadstart = function() {
|
|
||||||
statusElem.innerHTML = 'Running';
|
|
||||||
};
|
|
||||||
frameElem.src = testPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
var failureCount = 0;
|
|
||||||
var resultCount = 0;
|
|
||||||
window.webglTestHarness = {
|
|
||||||
reportResults: function(success, message) {
|
|
||||||
resultCount++;
|
|
||||||
if (!success) {
|
|
||||||
failureCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
var color = failureCount ? 'red' : 'green';
|
|
||||||
|
|
||||||
resultsElem.innerHTML = [
|
|
||||||
'<font color="' + color + '">',
|
|
||||||
'' + failureCount + '/' + resultCount,
|
|
||||||
'</font>',
|
|
||||||
].join('\n');
|
|
||||||
},
|
|
||||||
|
|
||||||
notifyFinished: function(testPath) {
|
|
||||||
OnTestComplete();
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
var gTestPath = null;
|
|
||||||
|
|
||||||
function OnTestComplete() {
|
|
||||||
statusElem.innerHTML = 'Complete';
|
|
||||||
|
|
||||||
var passed = failureCount == 0;
|
|
||||||
ok(passed, 'Should pass: ' + gTestPath);
|
|
||||||
SimpleTest.finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!window.ok) {
|
|
||||||
window.ok = parent.ok;
|
|
||||||
}
|
|
||||||
if (!window.todo) {
|
|
||||||
window.todo = parent.todo;
|
|
||||||
}
|
|
||||||
if (!window.SimpleTest) {
|
|
||||||
window.SimpleTest = parent.SimpleTest;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!window.ok) {
|
|
||||||
window.ok = function(status, message) {
|
|
||||||
console.log('ok(' + status + ', "' + message + '")');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!window.todo) {
|
|
||||||
window.todo = function(status, message) {
|
|
||||||
console.log('todo(' + status + ', "' + message + '")');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!window.SimpleTest) {
|
|
||||||
window.SimpleTest = {
|
|
||||||
waitForExplicitFinish: function(){},
|
|
||||||
finish: function(){},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////
|
|
||||||
// Begin execution
|
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
|
||||||
|
|
||||||
do {
|
|
||||||
var arg = location.search.substr(1);
|
|
||||||
if (arg == 'dump') {
|
|
||||||
statusElem.innerHTML = 'Dumping';
|
|
||||||
|
|
||||||
ok(true, 'OS:' + DriverInfo.getOS());
|
|
||||||
ok(true, 'OS version:' + DriverInfo.getOSVersion());
|
|
||||||
ok(true, 'Driver:' + DriverInfo.getDriver());
|
|
||||||
|
|
||||||
statusElem.innerHTML = 'Complete';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
gTestPath = arg;
|
|
||||||
RunTest(gTestPath);
|
|
||||||
} while (false);
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,8 +0,0 @@
|
|||||||
iframe {
|
|
||||||
position:fixed;
|
|
||||||
top:0px; left:0px; bottom:0px; right:0px;
|
|
||||||
width:100%; height:100%;
|
|
||||||
border:none; margin:0; padding:0;
|
|
||||||
overflow:hidden;
|
|
||||||
z-index:999999;
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
<!DOCTYPE HTML>
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>
|
|
||||||
Mochitest wrapper for WebGL Conformance Test Suite tests
|
|
||||||
</title>
|
|
||||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="../mochi-wrapper.css"/>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<iframe src='../mochi-single.html?%%TEST_PATH%%'>
|
|
||||||
</iframe>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,7 +0,0 @@
|
|||||||
[DEFAULT]
|
|
||||||
skip-if = e10s
|
|
||||||
support-files = mochi-single.html
|
|
||||||
mochi-wrapper.css
|
|
||||||
%%SUPPORT_FILES%%
|
|
||||||
|
|
||||||
%%MANIFEST_TESTS%%
|
|
@ -5,5 +5,6 @@
|
|||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
MOCHITEST_MANIFESTS += [
|
MOCHITEST_MANIFESTS += [
|
||||||
'_mochitest.ini',
|
'mochitest-conformance-files.ini',
|
||||||
|
'mochitest.ini',
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user