mirror of
https://github.com/servo/servo.git
synced 2025-08-16 19:05:33 +01:00
Update CSS tests to revision c8ec30de8099360ecf6581035bfdf2180fcc9755
Necessary for: https://github.com/servo/servo/pull/7117
This commit is contained in:
parent
e46499a5df
commit
c51deb9a6e
156 changed files with 13569 additions and 535 deletions
|
@ -76,7 +76,7 @@ def whitelist_errors(path, errors):
|
|||
global _whitelist_fn
|
||||
|
||||
if _whitelist_fn is None:
|
||||
_whitelist_fn = parse_whitelist_file(os.path.join(here, "lint.whitelist"))
|
||||
_whitelist_fn = parse_whitelist_file(os.path.join(repo_root, "lint.whitelist"))
|
||||
return _whitelist_fn(path, errors)
|
||||
|
||||
class Regexp(object):
|
||||
|
@ -111,6 +111,15 @@ class W3CTestOrgRegexp(Regexp):
|
|||
pattern = "w3c\-test\.org"
|
||||
error = "W3C-TEST.ORG"
|
||||
|
||||
class Webidl2Regexp(Regexp):
|
||||
pattern = "webidl2\.js"
|
||||
error = "WEBIDL2.JS"
|
||||
|
||||
class ConsoleRegexp(Regexp):
|
||||
pattern = "console\.[a-zA-Z]+\s*\("
|
||||
error = "CONSOLE"
|
||||
file_extensions = [".html", ".htm", ".js", ".xht", ".html", ".svg"]
|
||||
|
||||
class PrintRegexp(Regexp):
|
||||
pattern = "print(?:\s|\s*\()"
|
||||
error = "PRINT STATEMENT"
|
||||
|
@ -121,6 +130,8 @@ regexps = [item() for item in
|
|||
TabsRegexp,
|
||||
CRRegexp,
|
||||
W3CTestOrgRegexp,
|
||||
Webidl2Regexp,
|
||||
ConsoleRegexp,
|
||||
PrintRegexp]]
|
||||
|
||||
def check_regexp_line(path, f):
|
||||
|
@ -160,16 +171,16 @@ def check_parsed(path, f):
|
|||
if source_file.testharness_nodes:
|
||||
if len(source_file.testharness_nodes) > 1:
|
||||
errors.append(("MULTIPLE-TESTHARNESS",
|
||||
"%s more than one <script src='/resources/testharness.js>'" % path, None))
|
||||
"%s more than one <script src='/resources/testharness.js'>" % path, None))
|
||||
|
||||
testharnessreport_nodes = source_file.root.findall(".//{http://www.w3.org/1999/xhtml}script[@src='/resources/testharnessreport.js']")
|
||||
if not testharnessreport_nodes:
|
||||
errors.append(("MISSING-TESTHARNESSREPORT",
|
||||
"%s missing <script src='/resources/testharnessreport.js>'" % path, None))
|
||||
"%s missing <script src='/resources/testharnessreport.js'>" % path, None))
|
||||
else:
|
||||
if len(testharnessreport_nodes) > 1:
|
||||
errors.append(("MULTIPLE-TESTHARNESSREPORT",
|
||||
"%s more than one <script src='/resources/testharnessreport.js>'" % path, None))
|
||||
"%s more than one <script src='/resources/testharnessreport.js'>" % path, None))
|
||||
|
||||
for element in source_file.variant_nodes:
|
||||
if "content" not in element.attrib:
|
||||
|
@ -227,27 +238,46 @@ def output_error_count(error_count):
|
|||
|
||||
def main():
|
||||
error_count = defaultdict(int)
|
||||
last = None
|
||||
|
||||
def run_lint(path, fn, *args):
|
||||
def run_lint(path, fn, last, *args):
|
||||
errors = whitelist_errors(path, fn(path, *args))
|
||||
if errors:
|
||||
last = (errors[-1][0], path)
|
||||
|
||||
output_errors(errors)
|
||||
for error_type, error, line in errors:
|
||||
error_count[error_type] += 1
|
||||
return last
|
||||
|
||||
for path in iter_files():
|
||||
abs_path = os.path.join(repo_root, path)
|
||||
if not os.path.exists(path):
|
||||
continue
|
||||
for path_fn in path_lints:
|
||||
run_lint(path, path_fn)
|
||||
last = run_lint(path, path_fn, last)
|
||||
|
||||
if not os.path.isdir(abs_path):
|
||||
with open(abs_path) as f:
|
||||
for file_fn in file_lints:
|
||||
run_lint(path, file_fn, f)
|
||||
last = run_lint(path, file_fn, last, f)
|
||||
f.seek(0)
|
||||
|
||||
output_error_count(error_count)
|
||||
if error_count:
|
||||
print
|
||||
print "You must fix all errors; for details on how to fix them, see"
|
||||
print "https://github.com/w3c/web-platform-tests/blob/master/docs/lint-tool.md"
|
||||
print
|
||||
print "However, instead of fixing a particular error, it's sometimes"
|
||||
print "OK to add a line to the lint.whitelist file in the root of the"
|
||||
print "web-platform-tests directory to make the lint tool ignore it."
|
||||
print
|
||||
print "For example, to make the lint tool ignore all '%s'" % last[0]
|
||||
print "errors in the %s file," % last[1]
|
||||
print "you could add the following line to the lint.whitelist file."
|
||||
print
|
||||
print "%s:%s" % (last[0], last[1])
|
||||
return sum(error_count.itervalues())
|
||||
|
||||
path_lints = [check_path_length]
|
||||
|
|
|
@ -1,104 +0,0 @@
|
|||
# File containing whiteslist for lint errors
|
||||
# Format is:
|
||||
# ERROR TYPE:file/name/pattern[:line number]
|
||||
# e.g.
|
||||
# TRAILING WHITESPACE:example/file.html:128
|
||||
# to allow trailing whitespace on example/file.html line 128
|
||||
|
||||
## Whitespace rules that we can't enforce yet ##
|
||||
|
||||
INDENT TABS: .gitmodules
|
||||
INDENT TABS: app-uri/*
|
||||
INDENT TABS: conformance-checkers/*
|
||||
INDENT TABS: content-security-policy/*
|
||||
INDENT TABS: custom-elements/*
|
||||
INDENT TABS: DOMEvents/*
|
||||
INDENT TABS: eventsource/*
|
||||
INDENT TABS: html/editing/dnd/*
|
||||
INDENT TABS: html/semantics/*
|
||||
INDENT TABS: html/syntax/*
|
||||
INDENT TABS: html/webappapis/*
|
||||
INDENT TABS: media-source/*
|
||||
INDENT TABS: old-tests/*
|
||||
INDENT TABS: pointerlock/*
|
||||
INDENT TABS: shadow-dom/*
|
||||
INDENT TABS: tools/*
|
||||
INDENT TABS: touch-events/*
|
||||
INDENT TABS: web-animations/*
|
||||
INDENT TABS: webaudio/*
|
||||
INDENT TABS: webdriver/*
|
||||
INDENT TABS: webvtt/*
|
||||
INDENT TABS: XMLHttpRequest/*
|
||||
|
||||
TRAILING WHITESPACE: app-uri/*
|
||||
TRAILING WHITESPACE: battery-status/*
|
||||
TRAILING WHITESPACE: conformance-checkers/*
|
||||
TRAILING WHITESPACE: content-security-policy/*
|
||||
TRAILING WHITESPACE: custom-elements/*
|
||||
TRAILING WHITESPACE: DOMEvents/*
|
||||
TRAILING WHITESPACE: html-longdesc/*
|
||||
TRAILING WHITESPACE: media-source/*
|
||||
TRAILING WHITESPACE: microdata/*
|
||||
TRAILING WHITESPACE: old-tests/*
|
||||
TRAILING WHITESPACE: pointerevents/*
|
||||
TRAILING WHITESPACE: progress-events/*
|
||||
TRAILING WHITESPACE: shadow-dom/*
|
||||
TRAILING WHITESPACE: tools/*
|
||||
TRAILING WHITESPACE: webaudio/*
|
||||
TRAILING WHITESPACE: webdriver/*
|
||||
TRAILING WHITESPACE: WebIDL/*
|
||||
TRAILING WHITESPACE: webvtt/*
|
||||
TRAILING WHITESPACE: XMLHttpRequest/*
|
||||
|
||||
## File types that should never be checked ##
|
||||
|
||||
*:*.pdf
|
||||
*:*.jpg
|
||||
*:*.png
|
||||
*:*.gif
|
||||
*:*.pdf
|
||||
*:*.wav
|
||||
*:*.mp3
|
||||
*:*.m4a
|
||||
*:*.oga
|
||||
*:*.ogv
|
||||
*:*.webm
|
||||
*:*.mp4
|
||||
*:*.m4v
|
||||
*:*.ttf
|
||||
*:*.woff
|
||||
*:*.eot
|
||||
*:*.sfd
|
||||
*:*.swf
|
||||
|
||||
## Documentation ##
|
||||
|
||||
W3C-TEST.ORG:README.md
|
||||
W3C-TEST.ORG:*/README.md
|
||||
W3C-TEST.ORG:docs/*
|
||||
|
||||
## Helper scripts ##
|
||||
|
||||
W3C-TEST.ORG:tools/*
|
||||
PRINT STATEMENT:tools/*
|
||||
W3C-TEST.ORG:*/tools/*
|
||||
PRINT STATEMENT:*/tools/*
|
||||
|
||||
### Test exclusions ##
|
||||
|
||||
CR AT EOL:WebIDL/valid/idl/documentation-dos.widl
|
||||
CR AT EOL:cors/resources/cors-headers.asis
|
||||
CR AT EOL:html/semantics/embedded-content/the-canvas-element/size.attributes.parse.whitespace.html
|
||||
CR AT EOL:webvtt/webvtt-file-format-parsing/webvtt-file-parsing/support/newlines.vtt
|
||||
PARSE-FAILED:dom/nodes/Document-createElement-namespace-tests/empty.svg
|
||||
PARSE-FAILED:dom/nodes/Document-createElement-namespace-tests/empty.xhtml
|
||||
PARSE-FAILED:dom/nodes/Document-createElement-namespace-tests/minimal_html.svg
|
||||
PARSE-FAILED:dom/nodes/Document-createElement-namespace-tests/minimal_html.xhtml
|
||||
|
||||
# These have undefined entities; should probably find a way to define them
|
||||
PARSE-FAILED:ext-xhtml-pubid/the-xhtml-syntax/parsing-xhtml-documents/xhtml-pubid-1.xhtml
|
||||
PARSE-FAILED:ext-xhtml-pubid/the-xhtml-syntax/parsing-xhtml-documents/xhtml-pubid-2.xhtml
|
||||
PARSE-FAILED:ext-xhtml-pubid/the-xhtml-syntax/parsing-xhtml-documents/xhtml-pubid-3.xhtml
|
||||
|
||||
# Test generation files containing print statements
|
||||
PRINT STATEMENT:dom/nodes/Document-createElement-namespace-tests/generate.py
|
Loading…
Add table
Add a link
Reference in a new issue