Skip to content

Commit 52e2e05

Browse files
authored
Stop relying on the task name prefix to detect coverage tasks (#352)
Fixes #351
1 parent f56f3cf commit 52e2e05

File tree

10 files changed

+365
-69
lines changed

10 files changed

+365
-69
lines changed

bot/code_coverage_bot/chunk_mapping.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,7 @@ def get_suites(revision):
3838
"and": [
3939
{"eq": {"repo.branch.name": "mozilla-central"}},
4040
{"eq": {"repo.changeset.id12": revision[:12]}},
41-
{
42-
"or": [
43-
{"prefix": {"run.key": "test-linux64-ccov"}},
44-
{"prefix": {"run.key": "test-windows10-64-ccov"}},
45-
]
46-
},
41+
{"regexp": {"run.key": ".*-ccov/.*"}},
4742
]
4843
},
4944
"limit": 500000,
@@ -58,13 +53,6 @@ def get_suites(revision):
5853

5954
# Retrieve chunk -> tests mapping from ActiveData.
6055
def get_tests_chunks(revision, platform, suite):
61-
if platform == "linux":
62-
run_key_prefix = "test-linux64-ccov"
63-
elif platform == "windows":
64-
run_key_prefix = "test-windows10-64-ccov"
65-
else:
66-
raise Exception("Unsupported platform {}".format(platform))
67-
6856
r = requests.post(
6957
ACTIVEDATA_QUERY_URL,
7058
json={
@@ -74,7 +62,7 @@ def get_tests_chunks(revision, platform, suite):
7462
{"eq": {"repo.branch.name": "mozilla-central"}},
7563
{"eq": {"repo.changeset.id12": revision[:12]}},
7664
{"eq": {"run.suite.fullname": suite}},
77-
{"prefix": {"run.key": run_key_prefix}},
65+
{"regexp": {"run.key": f".*-{platform}.*-ccov/.*"}},
7866
]
7967
},
8068
"limit": 50000,

bot/code_coverage_bot/taskcluster.py

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
logger = structlog.getLogger(__name__)
1515
taskcluster_config = TaskclusterConfig("https://firefox-ci-tc.services.mozilla.com")
1616

17+
NAME_PARTS_TO_SKIP = ("opt", "debug", "e10s", "1proc")
18+
1719

1820
def get_task(branch, revision, platform):
1921
if platform == "linux":
@@ -99,47 +101,29 @@ def perform_download():
99101
retry(perform_download)
100102

101103

102-
BUILD_PLATFORMS = [
103-
"build-linux64-ccov/opt",
104-
"build-win64-ccov/debug",
105-
"build-android-test-ccov/opt",
106-
]
107-
108-
TEST_PLATFORMS = [
109-
"test-linux64-ccov/opt",
110-
"test-windows10-64-ccov/debug",
111-
"test-android-em-4.3-arm7-api-16-ccov/debug",
112-
] + BUILD_PLATFORMS
113-
114-
115104
def is_coverage_task(task):
116-
return any(task["metadata"]["name"].startswith(t) for t in TEST_PLATFORMS)
105+
return "ccov" in task["metadata"]["name"].split("/")[0].split("-")
117106

118107

119-
def name_to_chunk(name):
108+
def name_to_chunk(name: str):
120109
"""
121110
Helper to convert a task name to a chunk
122111
Used by chunk mapping
123112
"""
124-
assert isinstance(name, str)
125-
126113
# Some tests are run on build machines, we define a placeholder chunk for those.
127-
if name in BUILD_PLATFORMS:
114+
if name.startswith("build-"):
128115
return "build"
129116

130-
for t in TEST_PLATFORMS:
131-
if name.startswith(t):
132-
name = name[len(t) + 1 :]
133-
break
134-
return "-".join([p for p in name.split("-") if p != "e10s"])
117+
name = name[name.find("/") + 1 :]
118+
119+
return "-".join([p for p in name.split("-") if p not in NAME_PARTS_TO_SKIP])
135120

136121

137-
def chunk_to_suite(chunk):
122+
def chunk_to_suite(chunk: str):
138123
"""
139124
Helper to convert a chunk to a suite (no numbers)
140125
Used by chunk mapping
141126
"""
142-
assert isinstance(chunk, str)
143127
return "-".join([p for p in chunk.split("-") if not p.isdigit()])
144128

145129

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
{
2+
"provisionerId": "gecko-t",
3+
"workerType": "t-linux-xlarge",
4+
"schedulerId": "gecko-level-3",
5+
"taskGroupId": "S5_GgKsuQvuxsHqLKGXpow",
6+
"dependencies": [
7+
"LLq0pXcjRQSeeqX39y0LIg",
8+
"T6iDE8yqQryKzJiVSvfpiQ",
9+
"cCf9pNwMTp-U1DLCivF6ew"
10+
],
11+
"requires": "all-completed",
12+
"routes": [
13+
"tc-treeherder.v2.mozilla-central.1fd87ec46d80675d2a8b18b47029f53a28d43a38.36976"
14+
],
15+
"priority": "medium",
16+
"retries": 5,
17+
"created": "2020-01-03T16:09:04.017Z",
18+
"deadline": "2020-01-04T16:09:04.017Z",
19+
"expires": "2021-01-02T16:09:04.017Z",
20+
"scopes": [
21+
"secrets:get:project/taskcluster/gecko/hgfingerprint",
22+
"secrets:get:project/taskcluster/gecko/hgmointernal",
23+
"project:releng:services/tooltool/api/download/public",
24+
"docker-worker:feature:allowPtrace",
25+
"docker-worker:cache:gecko-level-3-checkouts-v3-75316e4022f196ea1700",
26+
"docker-worker:cache:gecko-level-3-tooltool-cache-v3-75316e4022f196ea1700"
27+
],
28+
"payload": {
29+
"onExitStatus": {
30+
"retry": [
31+
4,
32+
72
33+
],
34+
"purgeCaches": [
35+
72
36+
]
37+
},
38+
"maxRunTime": 3600,
39+
"image": {
40+
"path": "public/image.tar.zst",
41+
"type": "task-image",
42+
"taskId": "LLq0pXcjRQSeeqX39y0LIg"
43+
},
44+
"cache": {
45+
"gecko-level-3-checkouts-v3-75316e4022f196ea1700": "/builds/worker/checkouts",
46+
"gecko-level-3-tooltool-cache-v3-75316e4022f196ea1700": "/builds/worker/tooltool-cache"
47+
},
48+
"artifacts": {
49+
"public/logs/": {
50+
"path": "/builds/worker/workspace/logs/",
51+
"expires": "2021-01-02T16:09:04.017Z",
52+
"type": "directory"
53+
},
54+
"public/test": {
55+
"path": "/builds/worker/artifacts/",
56+
"expires": "2021-01-02T16:09:04.017Z",
57+
"type": "directory"
58+
},
59+
"public/test_info/": {
60+
"path": "/builds/worker/workspace/build/blobber_upload_dir/",
61+
"expires": "2021-01-02T16:09:04.017Z",
62+
"type": "directory"
63+
}
64+
},
65+
"command": [
66+
"/builds/worker/bin/run-task",
67+
"--fetch-hgfingerprint",
68+
"--",
69+
"/builds/worker/bin/test-linux.sh",
70+
"--cppunittest-suite=cppunittest",
71+
"--code-coverage",
72+
"--disable-e10s",
73+
"--allow-software-gl-layers",
74+
"--download-symbols=ondemand"
75+
],
76+
"env": {
77+
"MOZ_AUTOMATION": "1",
78+
"TOOLTOOL_CACHE": "/builds/worker/tooltool-cache",
79+
"MOZ_FETCHES_DIR": "fetches",
80+
"MOZHARNESS_SCRIPT": "desktop_unittest.py",
81+
"MOZ_NODE_PATH": "/usr/local/bin/node",
82+
"HG_STORE_PATH": "/builds/worker/checkouts/hg-store",
83+
"MOZILLA_BUILD_URL": "https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/T6iDE8yqQryKzJiVSvfpiQ/artifacts/public/build/target.tar.bz2",
84+
"GECKO_PATH": "/builds/worker/checkouts/gecko",
85+
"GECKO_HEAD_REPOSITORY": "https://hg.mozilla.org/mozilla-central",
86+
"EXTRA_MOZHARNESS_CONFIG": "{\"test_packages_url\": \"https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/T6iDE8yqQryKzJiVSvfpiQ/artifacts/public/build/target.test_packages.json\", \"installer_url\": \"https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/T6iDE8yqQryKzJiVSvfpiQ/artifacts/public/build/target.tar.bz2\"}",
87+
"SCCACHE_DISABLE": "1",
88+
"GECKO_HEAD_REV": "1fd87ec46d80675d2a8b18b47029f53a28d43a38",
89+
"NEED_COMPIZ": "false",
90+
"MOZ_SCM_LEVEL": "3",
91+
"TASKCLUSTER_VOLUMES": "/builds/worker/.cache;/builds/worker/checkouts;/builds/worker/tooltool-cache;/builds/worker/workspace",
92+
"MOZHARNESS_URL": "https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/T6iDE8yqQryKzJiVSvfpiQ/artifacts/public/build/mozharness.zip",
93+
"GECKO_BASE_REPOSITORY": "https://hg.mozilla.org/mozilla-unified",
94+
"MOZ_FETCHES": "[{\"artifact\": \"public/build/grcov.tar.xz\", \"extract\": true, \"task\": \"cCf9pNwMTp-U1DLCivF6ew\"}]",
95+
"TASKCLUSTER_CACHES": "/builds/worker/checkouts;/builds/worker/tooltool-cache",
96+
"WORKING_DIR": "/builds/worker",
97+
"NEED_PULSEAUDIO": "true",
98+
"ENABLE_E10S": "false",
99+
"NEED_WINDOW_MANAGER": "true",
100+
"MOZHARNESS_CONFIG": "unittests/linux_unittest.py remove_executables.py"
101+
},
102+
"features": {
103+
"taskclusterProxy": true,
104+
"allowPtrace": true
105+
}
106+
},
107+
"metadata": {
108+
"owner": "malexandru@mozilla.com",
109+
"source": "https://hg.mozilla.org/mozilla-central/file/1fd87ec46d80675d2a8b18b47029f53a28d43a38/taskcluster/ci/test",
110+
"description": "CPP Unit Tests ([Treeherder push](https://treeherder.mozilla.org/#/jobs?repo=mozilla-central&revision=1fd87ec46d80675d2a8b18b47029f53a28d43a38))",
111+
"name": "test-linux1804-64-ccov/opt-cppunit-1proc"
112+
},
113+
"tags": {
114+
"kind": "test",
115+
"worker-implementation": "docker-worker",
116+
"createdForUser": "malexandru@mozilla.com",
117+
"retrigger": "true",
118+
"label": "test-linux1804-64-ccov/opt-cppunit-1proc",
119+
"os": "linux"
120+
},
121+
"extra": {
122+
"index": {
123+
"rank": 0
124+
},
125+
"parent": "S5_GgKsuQvuxsHqLKGXpow",
126+
"chunks": {
127+
"current": 1,
128+
"total": 1
129+
},
130+
"suite": "cppunittest",
131+
"treeherder": {
132+
"machine": {
133+
"platform": "linux1804-64-ccov"
134+
},
135+
"tier": 2,
136+
"symbol": "cppunit",
137+
"jobKind": "test",
138+
"collection": {
139+
"opt": true
140+
}
141+
},
142+
"treeherder-platform": "linux1804-64-ccov/opt"
143+
}
144+
}

0 commit comments

Comments
 (0)