mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Update web-platform-tests to revision dc5cbf088edcdb266541d4e5a76149a2c6e716a0
This commit is contained in:
parent
1d40075f03
commit
079092dfea
2381 changed files with 90360 additions and 17722 deletions
|
@ -1,7 +1,7 @@
|
|||
# Copyright (c) 2016 W3C
|
||||
# Released under the W3C Test Suite License: see LICENSE.txt
|
||||
|
||||
# This tool creates .html test files for the WPT harness from corresponding .text
|
||||
# This tool creates .html test files for the WPT harness from corresponding .test
|
||||
# files that it finds in the tree for this test collection.
|
||||
|
||||
|
||||
|
@ -16,8 +16,8 @@ import argparse
|
|||
|
||||
TESTTREE = '..'
|
||||
DEFDIR = '../definitions'
|
||||
TEMPLATE = 'template'
|
||||
|
||||
MANUAL_TEMPLATE = 'template_manual'
|
||||
JS_TEMPLATE = 'template_js'
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
|
@ -27,7 +27,8 @@ args = parser.parse_args()
|
|||
|
||||
# pull in the template
|
||||
|
||||
template = open(TEMPLATE).read()
|
||||
manualTemplate = open(MANUAL_TEMPLATE, "r").read()
|
||||
autoTemplate = open(JS_TEMPLATE, "r").read()
|
||||
|
||||
defList = []
|
||||
defnames = ""
|
||||
|
@ -37,7 +38,7 @@ for curdir, subdirList, fileList in os.walk(DEFDIR, topdown=True):
|
|||
for file in fnmatch.filter(fileList, "*.json"):
|
||||
theFile = os.path.join(curdir, file)
|
||||
try:
|
||||
testJSON = json.load(open(theFile))
|
||||
testJSON = json.load(open(theFile, "r"))
|
||||
except ValueError as e:
|
||||
print "parse of " + theFile + " failed: " + e[0]
|
||||
else:
|
||||
|
@ -51,31 +52,47 @@ if (len(defList)):
|
|||
# iterate over the folders looking for .test files
|
||||
|
||||
for curdir, subdirList, fileList in os.walk(TESTTREE, topdown=True):
|
||||
# sjip the definitions directory
|
||||
# skip the definitions directory
|
||||
subdirList[:] = [d for d in subdirList if d != "definitions"]
|
||||
# skip the examples directory
|
||||
if args.examples != 1:
|
||||
subdirList[:] = [d for d in subdirList if d != "examples"]
|
||||
|
||||
for file in fnmatch.filter(fileList, "*.test"):
|
||||
# for each .test file, create a corresponding .html file using template
|
||||
# for each .test file, create a corresponding .html file using the appropriate
|
||||
# template
|
||||
theFile = os.path.join(curdir, file)
|
||||
try:
|
||||
testJSON = json.load(open(theFile))
|
||||
testJSON = json.load(open(theFile, "r"))
|
||||
except ValueError as e:
|
||||
print "parse of " + theFile + " failed: " + e[0]
|
||||
else:
|
||||
try:
|
||||
testType = testJSON['testType']
|
||||
except:
|
||||
testType = "manual"
|
||||
|
||||
templateFile = manualTemplate
|
||||
suffix = "-manual.html"
|
||||
|
||||
if testType == "automated":
|
||||
templateFile = autoTemplate
|
||||
suffix = ".html"
|
||||
|
||||
rfile = re.sub("\.\./", "", file)
|
||||
# interesting pattern is {{TESTFILE}}
|
||||
tcopy = re.sub("{{TESTFILE}}", rfile, template)
|
||||
tcopy = re.sub("{{TESTFILE}}", rfile, templateFile)
|
||||
|
||||
tcopy = re.sub("{{SCHEMADEFS}}", defNames, tcopy)
|
||||
|
||||
if testJSON['name']:
|
||||
tcopy = re.sub("{{TESTTITLE}}", testJSON['name'], tcopy)
|
||||
try:
|
||||
title = testJSON['name']
|
||||
except:
|
||||
title = file
|
||||
tcopy = re.sub("{{TESTTITLE}}", title, tcopy)
|
||||
|
||||
# target file is basename of theFile + '-manual.html'
|
||||
target = re.sub("\.test","-manual.html", theFile)
|
||||
target = re.sub("\.test",suffix, theFile)
|
||||
|
||||
try:
|
||||
out = open(target, "w")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue