From 70037699ae861c31cc72569e3f7e2bbd5c8c02b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20J=C3=A4genstedt?= Date: Tue, 30 Oct 2018 12:42:46 +0100 Subject: [PATCH] Give `./wpt test-jobs` an `--all` argument This is useful for testing CI changes. --- tools/ci/jobs.py | 4 ++++ tools/ci/tests/test_jobs.py | 26 ++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/tools/ci/jobs.py b/tools/ci/jobs.py index 97504dc8d9c517..9abbfd27be9a1a 100644 --- a/tools/ci/jobs.py +++ b/tools/ci/jobs.py @@ -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 = {} @@ -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 diff --git a/tools/ci/tests/test_jobs.py b/tools/ci/tests/test_jobs.py index e888ad884a18f2..0f9ce1f02e71c3 100644 --- a/tools/ci/tests/test_jobs.py +++ b/tools/ci/tests/test_jobs.py @@ -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"], @@ -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"]) @@ -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"])