Skip to content

Commit

Permalink
Give ./wpt test-jobs an --all argument (#13801)
Browse files Browse the repository at this point in the history
This is useful for testing CI changes.
  • Loading branch information
foolip authored Oct 31, 2018
1 parent 4098fe5 commit 3422a5d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
4 changes: 4 additions & 0 deletions tools/ci/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ def get_paths(**kwargs):


def get_jobs(paths, **kwargs):
if kwargs.get("all"):
return set(job_path_map.keys())

jobs = set()

rules = {}
Expand Down Expand Up @@ -121,6 +124,7 @@ def get_jobs(paths, **kwargs):
def create_parser():
parser = argparse.ArgumentParser()
parser.add_argument("revish", default=None, help="Commits to consider. Defaults to the commits on the current branch", nargs="?")
parser.add_argument("--all", help="List all jobs unconditionally.", action="store_true")
parser.add_argument("--includes", default=None, help="Jobs to check for. Return code is 0 if all jobs are found, otherwise 1", nargs="*")
return parser

Expand Down
26 changes: 22 additions & 4 deletions tools/ci/tests/test_jobs.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
from tools.ci import jobs

all_jobs = set([
"build_css",
"lint",
"manifest_upload",
"resources_unittest",
"stability",
"tools_unittest",
"update_built",
"wpt_integration",
"wptrunner_infrastructure",
"wptrunner_unittest",
])

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


def test_all():
assert jobs.get_jobs(["README.md"], all=True) == all_jobs


def test_default():
assert jobs.get_jobs(["README.md"]) == default_jobs


def test_testharness():
assert jobs.get_jobs(["resources/testharness.js"]) == default_jobs | set(["resources_unittest"])
assert jobs.get_jobs(["resources/testharness.js"],
Expand Down Expand Up @@ -39,10 +60,6 @@ def test_stability():
includes=["stability"]) == set(["stability"])


def test_default():
assert jobs.get_jobs(["README.md"]) == default_jobs


def test_tools_unittest():
assert jobs.get_jobs(["tools/ci/test/test_jobs.py"],
includes=["tools_unittest"]) == set(["tools_unittest"])
Expand Down Expand Up @@ -83,6 +100,7 @@ def test_wpt_integration():
assert jobs.get_jobs(["tools/wptrunner/wptrunner/wptrunner.py"],
includes=["wpt_integration"]) == set(["wpt_integration"])


def test_wpt_infrastructure():
assert jobs.get_jobs(["tools/hammer.html"],
includes=["wptrunner_infrastructure"]) == set(["wptrunner_infrastructure"])
Expand Down

0 comments on commit 3422a5d

Please sign in to comment.