1 # Any copyright is dedicated to the public domain.
2 # http://creativecommons.org/publicdomain/zero/1.0/
5 from gecko_taskgraph
.util
.bugbug
import push_schedules
6 from gecko_taskgraph
.util
.chunking
import BugbugLoader
7 from mozunit
import main
8 from tryselect
.selectors
.auto
import TRY_AUTO_PARAMETERS
10 pytestmark
= pytest
.mark
.slow
11 PARAMS
= TRY_AUTO_PARAMETERS
.copy()
14 "head_repository": "https://hg.mozilla.org/try",
16 "target_kind": "test",
17 # These ensure this isn't considered a backstop. The pushdate must
18 # be slightly higher than the one in data/pushes.json, and
19 # pushlog_id must not be a multiple of 10.
20 "pushdate": 1593029536,
26 def test_generate_graph(optimized_task_graph
):
27 """Simply tests that generating the graph does not fail."""
28 assert len(optimized_task_graph
.tasks
) > 0
31 def test_only_important_manifests(params
, full_task_graph
, filter_tasks
):
32 data
= push_schedules(params
["project"], params
["head_rev"])
33 important_manifests
= {
35 for m
, c
in data
.get("groups", {}).items()
36 if c
>= BugbugLoader
.CONFIDENCE_THRESHOLD
39 # Ensure we don't schedule unimportant manifests.
40 for task
in filter_tasks(full_task_graph
, lambda t
: t
.kind
== "test"):
41 attr
= task
.attributes
.get
43 if "test_manifests" in task
.attributes
:
45 t
for t
in attr("test_manifests") if t
not in important_manifests
48 # Manifest scheduling is disabled for mochitest-ally.
49 if attr("unittest_suite") == "mochitest-a11y":
50 assert len(unimportant
) > 0
52 assert unimportant
== []
55 @pytest.mark
.parametrize(
61 and t
.attributes
["unittest_suite"] == "mochitest-browser-chrome"
64 id="mochitest-browser-chrome",
68 def test_tasks_are_scheduled(optimized_task_graph
, filter_tasks
, func
, min_expected
):
69 """Ensure the specified tasks are scheduled on mozilla-central."""
70 tasks
= [t
.label
for t
in filter_tasks(optimized_task_graph
, func
)]
71 assert len(tasks
) >= min_expected
74 @pytest.mark
.parametrize(
78 lambda t
: t
.kind
== "build"
79 and "shippable" in t
.attributes
["build_platform"],
80 id="no shippable builds",
83 lambda t
: t
.kind
== "build" and "fuzzing" in t
.attributes
["build_platform"],
84 id="no fuzzing builds",
87 lambda t
: t
.kind
== "build" and "ccov" in t
.attributes
["build_platform"],
90 # We should only assert that we have no signed builds on platforms that don't run
93 lambda t
: t
.kind
== "build-signing",
94 id="no build-signing",
95 marks
=pytest
.mark
.xfail(reason
="some xpcshell tests require signed builds"),
98 lambda t
: t
.kind
== "upload-symbols",
99 id="no upload-symbols",
103 def test_tasks_are_not_scheduled(
104 optimized_task_graph
, filter_tasks
, print_dependents
, func
106 tasks
= [t
.label
for t
in filter_tasks(optimized_task_graph
, func
)]
108 print_dependents(optimized_task_graph
, t
)
112 if __name__
== "__main__":