mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #19929 - terracotaPie:master, r=jdm
Verify that all values in include.ini represent real directories <!-- Please describe your changes on the following line: --> wpt manifest(include.ini) contains directories as headers. With this test in **test-tidy** we check if they are present in respective wtp test folders. --- - [X] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [X] These changes fix #19703 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19929) <!-- Reviewable:end -->
This commit is contained in:
commit
f84e9236ae
6 changed files with 66 additions and 22 deletions
|
@ -22,10 +22,19 @@ import colorama
|
||||||
import toml
|
import toml
|
||||||
import voluptuous
|
import voluptuous
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from licenseck import MPL, APACHE, COPYRIGHT, licenses_toml, licenses_dep_toml
|
from licenseck import MPL, APACHE, COPYRIGHT, licenses_toml, licenses_dep_toml
|
||||||
|
topdir = os.path.abspath(os.path.dirname(sys.argv[0]))
|
||||||
|
wpt = os.path.join(topdir, "tests", "wpt")
|
||||||
|
|
||||||
|
|
||||||
|
def wpt_path(*args):
|
||||||
|
return os.path.join(wpt, *args)
|
||||||
|
|
||||||
|
sys.path.append(wpt_path("web-platform-tests", "tools", "wptrunner", "wptrunner"))
|
||||||
|
from wptmanifest import parser, node
|
||||||
|
|
||||||
CONFIG_FILE_PATH = os.path.join(".", "servo-tidy.toml")
|
CONFIG_FILE_PATH = os.path.join(".", "servo-tidy.toml")
|
||||||
|
WPT_MANIFEST_PATH = wpt_path("include.ini")
|
||||||
|
|
||||||
# Default configs
|
# Default configs
|
||||||
config = {
|
config = {
|
||||||
|
@ -440,6 +449,38 @@ def check_shell(file_name, lines):
|
||||||
yield(idx + 1, "variable substitutions should use the full \"${VAR}\" form")
|
yield(idx + 1, "variable substitutions should use the full \"${VAR}\" form")
|
||||||
|
|
||||||
|
|
||||||
|
def rec_parse(current_path, root_node):
|
||||||
|
dirs = []
|
||||||
|
for item in root_node.children:
|
||||||
|
if isinstance(item, node.DataNode):
|
||||||
|
next_depth = os.path.join(current_path, item.data)
|
||||||
|
dirs.append(next_depth)
|
||||||
|
dirs += rec_parse(next_depth, item)
|
||||||
|
return dirs
|
||||||
|
|
||||||
|
|
||||||
|
def check_manifest_dirs(config_file, print_text=True):
|
||||||
|
if not os.path.exists(config_file):
|
||||||
|
yield(config_file, 0, "%s manifest file is required but was not found" % config_file)
|
||||||
|
return
|
||||||
|
|
||||||
|
# Load configs from include.ini
|
||||||
|
with open(config_file) as content:
|
||||||
|
conf_file = content.read()
|
||||||
|
lines = conf_file.splitlines(True)
|
||||||
|
|
||||||
|
if print_text:
|
||||||
|
print '\rChecking the wpt manifest file...'
|
||||||
|
|
||||||
|
p = parser.parse(lines)
|
||||||
|
paths = rec_parse(wpt_path("web-platform-tests"), p)
|
||||||
|
for idx, path in enumerate(paths):
|
||||||
|
if path.endswith("_mozilla"):
|
||||||
|
continue
|
||||||
|
if not os.path.isdir(path):
|
||||||
|
yield(config_file, idx + 1, "Path in manifest was not found: {}".format(path))
|
||||||
|
|
||||||
|
|
||||||
def check_rust(file_name, lines):
|
def check_rust(file_name, lines):
|
||||||
if not file_name.endswith(".rs") or \
|
if not file_name.endswith(".rs") or \
|
||||||
file_name.endswith(".mako.rs") or \
|
file_name.endswith(".mako.rs") or \
|
||||||
|
@ -1122,6 +1163,8 @@ def run_lint_scripts(only_changed_files=False, progress=True, stylo=False):
|
||||||
def scan(only_changed_files=False, progress=True, stylo=False):
|
def scan(only_changed_files=False, progress=True, stylo=False):
|
||||||
# check config file for errors
|
# check config file for errors
|
||||||
config_errors = check_config_file(CONFIG_FILE_PATH)
|
config_errors = check_config_file(CONFIG_FILE_PATH)
|
||||||
|
# check ini directories exist
|
||||||
|
manifest_errors = check_manifest_dirs(WPT_MANIFEST_PATH)
|
||||||
# check directories contain expected files
|
# check directories contain expected files
|
||||||
directory_errors = check_directory_files(config['check_ext'])
|
directory_errors = check_directory_files(config['check_ext'])
|
||||||
# standard checks
|
# standard checks
|
||||||
|
@ -1135,7 +1178,7 @@ def scan(only_changed_files=False, progress=True, stylo=False):
|
||||||
# other lint checks
|
# other lint checks
|
||||||
lint_errors = run_lint_scripts(only_changed_files, progress, stylo=stylo)
|
lint_errors = run_lint_scripts(only_changed_files, progress, stylo=stylo)
|
||||||
# chain all the iterators
|
# chain all the iterators
|
||||||
errors = itertools.chain(config_errors, directory_errors, lint_errors,
|
errors = itertools.chain(config_errors, manifest_errors, directory_errors, lint_errors,
|
||||||
file_errors, dep_license_errors)
|
file_errors, dep_license_errors)
|
||||||
|
|
||||||
error = None
|
error = None
|
||||||
|
|
5
python/tidy/servo_tidy_tests/manifest-include.ini
Normal file
5
python/tidy/servo_tidy_tests/manifest-include.ini
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
skip: true
|
||||||
|
[html]
|
||||||
|
skip: false
|
||||||
|
[never_going_to_exist]
|
||||||
|
skip: false
|
|
@ -33,6 +33,15 @@ class CheckTidiness(unittest.TestCase):
|
||||||
self.assertEqual("ignored directory './fake/dir' doesn't exist", errors.next()[2])
|
self.assertEqual("ignored directory './fake/dir' doesn't exist", errors.next()[2])
|
||||||
self.assertNoMoreErrors(errors)
|
self.assertNoMoreErrors(errors)
|
||||||
|
|
||||||
|
def test_non_existing_wpt_manifest_checks(self):
|
||||||
|
wrong_path = "/wrong/path.ini"
|
||||||
|
errors = tidy.check_manifest_dirs(wrong_path, print_text=False)
|
||||||
|
self.assertEqual("%s manifest file is required but was not found" % wrong_path, errors.next()[2])
|
||||||
|
self.assertNoMoreErrors(errors)
|
||||||
|
errors = tidy.check_manifest_dirs(os.path.join(base_path, 'manifest-include.ini'), print_text=False)
|
||||||
|
self.assertTrue(errors.next()[2].endswith("never_going_to_exist"))
|
||||||
|
self.assertNoMoreErrors(errors)
|
||||||
|
|
||||||
def test_directory_checks(self):
|
def test_directory_checks(self):
|
||||||
dirs = {
|
dirs = {
|
||||||
os.path.join(base_path, "dir_check/webidl_plus"): ['webidl', 'test'],
|
os.path.join(base_path, "dir_check/webidl_plus"): ['webidl', 'test'],
|
||||||
|
|
|
@ -3,8 +3,6 @@ skip: true
|
||||||
skip: false
|
skip: false
|
||||||
[2dcontext]
|
[2dcontext]
|
||||||
skip: false
|
skip: false
|
||||||
[animation-timing]
|
|
||||||
skip: false
|
|
||||||
[cors]
|
[cors]
|
||||||
skip: false
|
skip: false
|
||||||
[css]
|
[css]
|
||||||
|
@ -55,12 +53,6 @@ skip: true
|
||||||
skip: false
|
skip: false
|
||||||
[selectors]
|
[selectors]
|
||||||
skip: false
|
skip: false
|
||||||
[cssom]
|
|
||||||
skip: false
|
|
||||||
[cssom-view]
|
|
||||||
skip: false
|
|
||||||
[css-values]
|
|
||||||
skip: false
|
|
||||||
[custom-elements]
|
[custom-elements]
|
||||||
skip: false
|
skip: false
|
||||||
[dom]
|
[dom]
|
||||||
|
@ -89,24 +81,16 @@ skip: true
|
||||||
skip: true
|
skip: true
|
||||||
[submission]
|
[submission]
|
||||||
skip: true
|
skip: true
|
||||||
[Opera]
|
|
||||||
skip: true
|
|
||||||
[script_scheduling]
|
|
||||||
skip: false
|
|
||||||
[performance-timeline]
|
[performance-timeline]
|
||||||
skip: false
|
skip: false
|
||||||
[quirks]
|
[quirks]
|
||||||
skip: false
|
skip: false
|
||||||
[referrer-policy]
|
[referrer-policy]
|
||||||
skip: false
|
skip: false
|
||||||
[selectors]
|
|
||||||
skip: false
|
|
||||||
[subresource-integrity]
|
[subresource-integrity]
|
||||||
skip: false
|
skip: false
|
||||||
[touch-events]
|
[touch-events]
|
||||||
skip: false
|
skip: false
|
||||||
[typedarrays]
|
|
||||||
skip: false
|
|
||||||
[uievents]
|
[uievents]
|
||||||
skip: false
|
skip: false
|
||||||
[url]
|
[url]
|
||||||
|
@ -123,5 +107,5 @@ skip: true
|
||||||
skip: false
|
skip: false
|
||||||
[workers]
|
[workers]
|
||||||
skip: false
|
skip: false
|
||||||
[XMLHttpRequest]
|
[xhr]
|
||||||
skip: false
|
skip: false
|
||||||
|
|
|
@ -6,3 +6,9 @@
|
||||||
[Upload events registered too late (resources/redirect.py?code=307&location=http://www1.web-platform.test:8000/XMLHttpRequest/resources/corsenabled.py)]
|
[Upload events registered too late (resources/redirect.py?code=307&location=http://www1.web-platform.test:8000/XMLHttpRequest/resources/corsenabled.py)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
[Upload events registered too late (http://www1.web-platform.test:8000/xhr/resources/corsenabled.py)]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Upload events registered too late (resources/redirect.py?code=307&location=http://www1.web-platform.test:8000/xhr/resources/corsenabled.py)]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,6 @@
|
||||||
[readyState]
|
[readyState]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[body]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[images]
|
[images]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue