mirror of
https://github.com/servo/servo.git
synced 2025-08-15 02:15:33 +01:00
Update web-platform-tests to revision 58eb04cecbbec2e18531ab440225e38944a9c444
This commit is contained in:
parent
25e8bf69e6
commit
665817d2a6
35333 changed files with 1818077 additions and 16036 deletions
|
@ -16,7 +16,8 @@ from .item import Stub, ManualTest, WebdriverSpecTest, RefTestNode, RefTest, Tes
|
|||
from .utils import rel_path_to_url, ContextManagerBytesIO, cached_property
|
||||
|
||||
wd_pattern = "*.py"
|
||||
meta_re = re.compile(b"//\s*META:\s*(\w*)=(.*)$")
|
||||
js_meta_re = re.compile(b"//\s*META:\s*(\w*)=(.*)$")
|
||||
python_meta_re = re.compile(b"#\s*META:\s*(\w*)=(.*)$")
|
||||
|
||||
reference_file_re = re.compile(r'(^|[\-_])(not)?ref[0-9]*([\-_]|$)')
|
||||
|
||||
|
@ -29,14 +30,17 @@ def replace_end(s, old, new):
|
|||
return s[:-len(old)] + new
|
||||
|
||||
|
||||
def read_script_metadata(f):
|
||||
def read_script_metadata(f, regexp):
|
||||
"""
|
||||
Yields any metadata (pairs of bytestrings) from the file-like object `f`,
|
||||
as specified according to the `meta_re` regex.
|
||||
as specified according to a supplied regexp.
|
||||
|
||||
`regexp` - Regexp containing two groups containing the metadata name and
|
||||
value.
|
||||
"""
|
||||
for line in f:
|
||||
assert isinstance(line, binary_type), line
|
||||
m = meta_re.match(line)
|
||||
m = regexp.match(line)
|
||||
if not m:
|
||||
break
|
||||
|
||||
|
@ -55,7 +59,10 @@ class SourceFile(object):
|
|||
"support",
|
||||
"tools"])
|
||||
|
||||
dir_path_non_test = {("css21", "archive")}
|
||||
dir_path_non_test = {("css21", "archive"),
|
||||
("css", "CSS2", "archive"),
|
||||
("css", "common"),
|
||||
("css", "work-in-progress")}
|
||||
|
||||
def __init__(self, tests_root, rel_path, url_base, contents=None):
|
||||
"""Object representing a file in a source tree.
|
||||
|
@ -146,14 +153,10 @@ class SourceFile(object):
|
|||
|
||||
parts = self.dir_path.split(os.path.sep)
|
||||
|
||||
if parts[0] in self.root_dir_non_test:
|
||||
if (parts[0] in self.root_dir_non_test or
|
||||
any(item in self.dir_non_test for item in parts) or
|
||||
any(parts[:len(path)] == list(path) for path in self.dir_path_non_test)):
|
||||
return True
|
||||
elif any(item in self.dir_non_test for item in parts):
|
||||
return True
|
||||
else:
|
||||
for path in self.dir_path_non_test:
|
||||
if parts[:len(path)] == list(path):
|
||||
return True
|
||||
return False
|
||||
|
||||
def in_conformance_checker_dir(self):
|
||||
|
@ -167,6 +170,7 @@ class SourceFile(object):
|
|||
return (self.is_dir() or
|
||||
self.name_prefix("MANIFEST") or
|
||||
self.filename.startswith(".") or
|
||||
self.type_flag == "support" or
|
||||
self.in_non_test_dir())
|
||||
|
||||
@property
|
||||
|
@ -208,6 +212,12 @@ class SourceFile(object):
|
|||
be a worker js test file"""
|
||||
return "worker" in self.meta_flags and self.ext == ".js"
|
||||
|
||||
@property
|
||||
def name_is_window(self):
|
||||
"""Check if the file name matches the conditions for the file to
|
||||
be a window js test file"""
|
||||
return "window" in self.meta_flags and self.ext == ".js"
|
||||
|
||||
@property
|
||||
def name_is_webdriver(self):
|
||||
"""Check if the file name matches the conditions for the file to
|
||||
|
@ -274,11 +284,15 @@ class SourceFile(object):
|
|||
|
||||
@cached_property
|
||||
def script_metadata(self):
|
||||
if not self.name_is_worker and not self.name_is_multi_global:
|
||||
if self.name_is_worker or self.name_is_multi_global or self.name_is_window:
|
||||
regexp = js_meta_re
|
||||
elif self.name_is_webdriver:
|
||||
regexp = python_meta_re
|
||||
else:
|
||||
return None
|
||||
|
||||
with self.open() as f:
|
||||
return list(read_script_metadata(f))
|
||||
return list(read_script_metadata(f, regexp))
|
||||
|
||||
@cached_property
|
||||
def timeout(self):
|
||||
|
@ -482,8 +496,10 @@ class SourceFile(object):
|
|||
|
||||
elif self.name_is_multi_global:
|
||||
rv = TestharnessTest.item_type, [
|
||||
TestharnessTest(self, replace_end(self.url, ".any.js", ".any.html"), timeout=self.timeout),
|
||||
TestharnessTest(self, replace_end(self.url, ".any.js", ".any.worker.html"), timeout=self.timeout),
|
||||
TestharnessTest(self, replace_end(self.url, ".any.js", ".any.html"),
|
||||
timeout=self.timeout),
|
||||
TestharnessTest(self, replace_end(self.url, ".any.js", ".any.worker.html"),
|
||||
timeout=self.timeout),
|
||||
]
|
||||
|
||||
elif self.name_is_worker:
|
||||
|
@ -491,8 +507,14 @@ class SourceFile(object):
|
|||
[TestharnessTest(self, replace_end(self.url, ".worker.js", ".worker.html"),
|
||||
timeout=self.timeout)])
|
||||
|
||||
elif self.name_is_window:
|
||||
rv = (TestharnessTest.item_type,
|
||||
[TestharnessTest(self, replace_end(self.url, ".window.js", ".window.html"),
|
||||
timeout=self.timeout)])
|
||||
|
||||
elif self.name_is_webdriver:
|
||||
rv = WebdriverSpecTest.item_type, [WebdriverSpecTest(self, self.url)]
|
||||
rv = WebdriverSpecTest.item_type, [WebdriverSpecTest(self, self.url,
|
||||
timeout=self.timeout)]
|
||||
|
||||
elif self.content_is_css_manual and not self.name_is_reference:
|
||||
rv = ManualTest.item_type, [ManualTest(self, self.url)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue