Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tools/ci/jobs.py work on Windows #12980

Merged
merged 3 commits into from Sep 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions tools/ci/jobs.py
Expand Up @@ -35,11 +35,21 @@
}


def _path_norm(path):
"""normalize a path for both case and slashes (to /)"""
path = os.path.normcase(path)
if os.path.sep != "/":
# this must be after the normcase call as that does slash normalization
path = path.replace(os.path.sep, "/")
return path


class Ruleset(object):
def __init__(self, rules):
self.include = []
self.exclude = []
for rule in rules:
rule = _path_norm(rule)
self.add_rule(rule)

def add_rule(self, rule):
Expand All @@ -52,9 +62,7 @@ def add_rule(self, rule):
target.append(re.compile("^%s" % rule))

def __call__(self, path):
if os.path.sep != "/":
path = path.replace(os.path.sep, "/")
path = os.path.normcase(path)
path = _path_norm(path)
for item in self.exclude:
if item.match(path):
return False
Expand Down
20 changes: 0 additions & 20 deletions tools/ci/tests/test_jobs.py
@@ -1,14 +1,8 @@
import sys

import pytest

from tools.ci import jobs

default_jobs = set(["lint", "manifest_upload"])


@pytest.mark.xfail(sys.platform == "win32",
reason="https://github.com/web-platform-tests/wpt/issues/12949")
def test_testharness():
assert jobs.get_jobs(["resources/testharness.js"]) == default_jobs | set(["resources_unittest"])
assert jobs.get_jobs(["resources/testharness.js"],
Expand All @@ -19,8 +13,6 @@ def test_testharness():
includes=["resources_unittest"]) == set()


@pytest.mark.xfail(sys.platform == "win32",
reason="https://github.com/web-platform-tests/wpt/issues/12949")
def test_stability():
assert jobs.get_jobs(["dom/historical.html"],
includes=["stability"]) == set(["stability"])
Expand Down Expand Up @@ -51,8 +43,6 @@ def test_default():
assert jobs.get_jobs(["README.md"]) == default_jobs


@pytest.mark.xfail(sys.platform == "win32",
reason="https://github.com/web-platform-tests/wpt/issues/12949")
def test_tools_unittest():
assert jobs.get_jobs(["tools/ci/test/test_jobs.py"],
includes=["tools_unittest"]) == set(["tools_unittest"])
Expand All @@ -62,17 +52,13 @@ def test_tools_unittest():
includes=["tools_unittest"]) == set()


@pytest.mark.xfail(sys.platform == "win32",
reason="https://github.com/web-platform-tests/wpt/issues/12949")
def test_wptrunner_unittest():
assert jobs.get_jobs(["tools/wptrunner/wptrunner/wptrunner.py"],
includes=["wptrunner_unittest"]) == set(["wptrunner_unittest"])
assert jobs.get_jobs(["tools/example.py"],
includes=["wptrunner_unittest"]) == set()


@pytest.mark.xfail(sys.platform == "win32",
reason="https://github.com/web-platform-tests/wpt/issues/12949")
def test_build_css():
assert jobs.get_jobs(["css/css-build-testsuites.sh"],
includes=["build_css"]) == set(["build_css"])
Expand All @@ -82,8 +68,6 @@ def test_build_css():
includes=["build_css"]) == set()


@pytest.mark.xfail(sys.platform == "win32",
reason="https://github.com/web-platform-tests/wpt/issues/12949")
def test_update_built():
assert jobs.get_jobs(["2dcontext/foo.html"],
includes=["update_built"]) == set(["update_built"])
Expand All @@ -93,16 +77,12 @@ def test_update_built():
includes=["update_built"]) == set(["update_built"])


@pytest.mark.xfail(sys.platform == "win32",
reason="https://github.com/web-platform-tests/wpt/issues/12949")
def test_wpt_integration():
assert jobs.get_jobs(["tools/wpt/wpt.py"],
includes=["wpt_integration"]) == set(["wpt_integration"])
assert jobs.get_jobs(["tools/wptrunner/wptrunner/wptrunner.py"],
includes=["wpt_integration"]) == set(["wpt_integration"])

@pytest.mark.xfail(sys.platform == "win32",
reason="https://github.com/web-platform-tests/wpt/issues/12949")
def test_wpt_infrastructure():
assert jobs.get_jobs(["tools/hammer.html"],
includes=["wptrunner_infrastructure"]) == set(["wptrunner_infrastructure"])
Expand Down