Bug 1744524: part 2) Add `WindowContext::GetUserGestureStart` and remove `WindowConte...
[gecko.git] / taskcluster / test / test_mach_try_auto.py
blob8470344253fcd50b40ccbc259bcafd6f921e7928
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
6 import pytest
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()
16 PARAMS.update(
18 "head_repository": "https://hg.mozilla.org/try",
19 "project": "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,
25 "pushlog_id": "2",
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:
48 unimportant = [
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
55 else:
56 assert unimportant == []
59 @pytest.mark.parametrize(
60 "func,min_expected",
62 pytest.param(
63 lambda t: (
64 t.kind == "test"
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(
79 "func",
81 pytest.param(
82 lambda t: t.kind == "build"
83 and "shippable" in t.attributes["build_platform"],
84 id="no shippable builds",
86 pytest.param(
87 lambda t: t.kind == "build" and "fuzzing" in t.attributes["build_platform"],
88 id="no fuzzing builds",
90 pytest.param(
91 lambda t: t.kind == "build" and "ccov" in t.attributes["build_platform"],
92 id="no ccov builds",
94 # We should only assert that we have no signed builds on platforms that don't run
95 # xpcshell tests.
96 pytest.param(
97 lambda t: t.kind == "build-signing",
98 id="no build-signing",
99 marks=pytest.mark.xfail(reason="some xpcshell tests require signed builds"),
101 pytest.param(
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)]
111 for t in tasks:
112 print_dependents(optimized_task_graph, t)
113 assert tasks == []
116 if __name__ == "__main__":
117 main()