1 # Any copyright is dedicated to the public domain.
2 # http://creativecommons.org/publicdomain/zero/1.0/
4 from __future__
import absolute_import
, print_function
, unicode_literals
7 from mozunit
import main
8 from tryselect
.selectors
.auto
import TRY_AUTO_PARAMETERS
10 from gecko_taskgraph
.util
.bugbug
import push_schedules
11 from gecko_taskgraph
.util
.chunking
import BugbugLoader
14 pytestmark
= pytest
.mark
.slow
15 PARAMS
= TRY_AUTO_PARAMETERS
.copy()
18 "head_repository": "https://hg.mozilla.org/try",
20 "target_kind": "test",
21 # These ensure this isn't considered a backstop. The pushdate must
22 # be slightly higher than the one in data/pushes.json, and
23 # pushlog_id must not be a multiple of 10.
24 "pushdate": 1593029536,
30 def test_generate_graph(optimized_task_graph
):
31 """Simply tests that generating the graph does not fail."""
32 assert len(optimized_task_graph
.tasks
) > 0
35 def test_only_important_manifests(params
, full_task_graph
, filter_tasks
):
36 data
= push_schedules(params
["project"], params
["head_rev"])
37 important_manifests
= {
39 for m
, c
in data
.get("groups", {}).items()
40 if c
>= BugbugLoader
.CONFIDENCE_THRESHOLD
43 # Ensure we don't schedule unimportant manifests.
44 for task
in filter_tasks(full_task_graph
, lambda t
: t
.kind
== "test"):
45 attr
= task
.attributes
.get
47 if "test_manifests" in task
.attributes
:
49 t
for t
in attr("test_manifests") if t
not in important_manifests
52 # Manifest scheduling is disabled for mochitest-ally.
53 if attr("unittest_suite") == "mochitest-a11y":
54 assert len(unimportant
) > 0
56 assert unimportant
== []
59 @pytest.mark
.parametrize(
65 and t
.attributes
["unittest_suite"] == "mochitest-browser-chrome"
68 id="mochitest-browser-chrome",
72 def test_tasks_are_scheduled(optimized_task_graph
, filter_tasks
, func
, min_expected
):
73 """Ensure the specified tasks are scheduled on mozilla-central."""
74 tasks
= [t
.label
for t
in filter_tasks(optimized_task_graph
, func
)]
75 assert len(tasks
) >= min_expected
78 @pytest.mark
.parametrize(
82 lambda t
: t
.kind
== "build"
83 and "shippable" in t
.attributes
["build_platform"],
84 id="no shippable builds",
87 lambda t
: t
.kind
== "build" and "fuzzing" in t
.attributes
["build_platform"],
88 id="no fuzzing builds",
91 lambda t
: t
.kind
== "build" and "ccov" in t
.attributes
["build_platform"],
94 # We should only assert that we have no signed builds on platforms that don't run
97 lambda t
: t
.kind
== "build-signing",
98 id="no build-signing",
99 marks
=pytest
.mark
.xfail(reason
="some xpcshell tests require signed builds"),
102 lambda t
: t
.kind
== "upload-symbols",
103 id="no upload-symbols",
107 def test_tasks_are_not_scheduled(
108 optimized_task_graph
, filter_tasks
, print_dependents
, func
110 tasks
= [t
.label
for t
in filter_tasks(optimized_task_graph
, func
)]
112 print_dependents(optimized_task_graph
, t
)
116 if __name__
== "__main__":