Skip to content

Stop relying on the task name prefix to detect coverage tasks #352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions bot/code_coverage_bot/chunk_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ def get_suites(revision):
"and": [
{"eq": {"repo.branch.name": "mozilla-central"}},
{"eq": {"repo.changeset.id12": revision[:12]}},
{
"or": [
{"prefix": {"run.key": "test-linux64-ccov"}},
{"prefix": {"run.key": "test-windows10-64-ccov"}},
]
},
{"regexp": {"run.key": ".*-ccov/.*"}},
]
},
"limit": 500000,
Expand All @@ -58,13 +53,6 @@ def get_suites(revision):

# Retrieve chunk -> tests mapping from ActiveData.
def get_tests_chunks(revision, platform, suite):
if platform == "linux":
run_key_prefix = "test-linux64-ccov"
elif platform == "windows":
run_key_prefix = "test-windows10-64-ccov"
else:
raise Exception("Unsupported platform {}".format(platform))

r = requests.post(
ACTIVEDATA_QUERY_URL,
json={
Expand All @@ -74,7 +62,7 @@ def get_tests_chunks(revision, platform, suite):
{"eq": {"repo.branch.name": "mozilla-central"}},
{"eq": {"repo.changeset.id12": revision[:12]}},
{"eq": {"run.suite.fullname": suite}},
{"prefix": {"run.key": run_key_prefix}},
{"regexp": {"run.key": f".*-{platform}.*-ccov/.*"}},
]
},
"limit": 50000,
Expand Down
34 changes: 9 additions & 25 deletions bot/code_coverage_bot/taskcluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
logger = structlog.getLogger(__name__)
taskcluster_config = TaskclusterConfig("https://firefox-ci-tc.services.mozilla.com")

NAME_PARTS_TO_SKIP = ("opt", "debug", "e10s", "1proc")


def get_task(branch, revision, platform):
if platform == "linux":
Expand Down Expand Up @@ -99,47 +101,29 @@ def perform_download():
retry(perform_download)


BUILD_PLATFORMS = [
"build-linux64-ccov/opt",
"build-win64-ccov/debug",
"build-android-test-ccov/opt",
]

TEST_PLATFORMS = [
"test-linux64-ccov/opt",
"test-windows10-64-ccov/debug",
"test-android-em-4.3-arm7-api-16-ccov/debug",
] + BUILD_PLATFORMS


def is_coverage_task(task):
return any(task["metadata"]["name"].startswith(t) for t in TEST_PLATFORMS)
return "ccov" in task["metadata"]["name"].split("/")[0].split("-")


def name_to_chunk(name):
def name_to_chunk(name: str):
"""
Helper to convert a task name to a chunk
Used by chunk mapping
"""
assert isinstance(name, str)

# Some tests are run on build machines, we define a placeholder chunk for those.
if name in BUILD_PLATFORMS:
if name.startswith("build-"):
return "build"

for t in TEST_PLATFORMS:
if name.startswith(t):
name = name[len(t) + 1 :]
break
return "-".join([p for p in name.split("-") if p != "e10s"])
name = name[name.find("/") + 1 :]

return "-".join([p for p in name.split("-") if p not in NAME_PARTS_TO_SKIP])


def chunk_to_suite(chunk):
def chunk_to_suite(chunk: str):
"""
Helper to convert a chunk to a suite (no numbers)
Used by chunk mapping
"""
assert isinstance(chunk, str)
return "-".join([p for p in chunk.split("-") if not p.isdigit()])


Expand Down
144 changes: 144 additions & 0 deletions bot/tests/fixtures/test-linux1804-64-ccov/opt-cppunit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
{
"provisionerId": "gecko-t",
"workerType": "t-linux-xlarge",
"schedulerId": "gecko-level-3",
"taskGroupId": "S5_GgKsuQvuxsHqLKGXpow",
"dependencies": [
"LLq0pXcjRQSeeqX39y0LIg",
"T6iDE8yqQryKzJiVSvfpiQ",
"cCf9pNwMTp-U1DLCivF6ew"
],
"requires": "all-completed",
"routes": [
"tc-treeherder.v2.mozilla-central.1fd87ec46d80675d2a8b18b47029f53a28d43a38.36976"
],
"priority": "medium",
"retries": 5,
"created": "2020-01-03T16:09:04.017Z",
"deadline": "2020-01-04T16:09:04.017Z",
"expires": "2021-01-02T16:09:04.017Z",
"scopes": [
"secrets:get:project/taskcluster/gecko/hgfingerprint",
"secrets:get:project/taskcluster/gecko/hgmointernal",
"project:releng:services/tooltool/api/download/public",
"docker-worker:feature:allowPtrace",
"docker-worker:cache:gecko-level-3-checkouts-v3-75316e4022f196ea1700",
"docker-worker:cache:gecko-level-3-tooltool-cache-v3-75316e4022f196ea1700"
],
"payload": {
"onExitStatus": {
"retry": [
4,
72
],
"purgeCaches": [
72
]
},
"maxRunTime": 3600,
"image": {
"path": "public/image.tar.zst",
"type": "task-image",
"taskId": "LLq0pXcjRQSeeqX39y0LIg"
},
"cache": {
"gecko-level-3-checkouts-v3-75316e4022f196ea1700": "/builds/worker/checkouts",
"gecko-level-3-tooltool-cache-v3-75316e4022f196ea1700": "/builds/worker/tooltool-cache"
},
"artifacts": {
"public/logs/": {
"path": "/builds/worker/workspace/logs/",
"expires": "2021-01-02T16:09:04.017Z",
"type": "directory"
},
"public/test": {
"path": "/builds/worker/artifacts/",
"expires": "2021-01-02T16:09:04.017Z",
"type": "directory"
},
"public/test_info/": {
"path": "/builds/worker/workspace/build/blobber_upload_dir/",
"expires": "2021-01-02T16:09:04.017Z",
"type": "directory"
}
},
"command": [
"/builds/worker/bin/run-task",
"--fetch-hgfingerprint",
"--",
"/builds/worker/bin/test-linux.sh",
"--cppunittest-suite=cppunittest",
"--code-coverage",
"--disable-e10s",
"--allow-software-gl-layers",
"--download-symbols=ondemand"
],
"env": {
"MOZ_AUTOMATION": "1",
"TOOLTOOL_CACHE": "/builds/worker/tooltool-cache",
"MOZ_FETCHES_DIR": "fetches",
"MOZHARNESS_SCRIPT": "desktop_unittest.py",
"MOZ_NODE_PATH": "/usr/local/bin/node",
"HG_STORE_PATH": "/builds/worker/checkouts/hg-store",
"MOZILLA_BUILD_URL": "https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/T6iDE8yqQryKzJiVSvfpiQ/artifacts/public/build/target.tar.bz2",
"GECKO_PATH": "/builds/worker/checkouts/gecko",
"GECKO_HEAD_REPOSITORY": "https://hg.mozilla.org/mozilla-central",
"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\"}",
"SCCACHE_DISABLE": "1",
"GECKO_HEAD_REV": "1fd87ec46d80675d2a8b18b47029f53a28d43a38",
"NEED_COMPIZ": "false",
"MOZ_SCM_LEVEL": "3",
"TASKCLUSTER_VOLUMES": "/builds/worker/.cache;/builds/worker/checkouts;/builds/worker/tooltool-cache;/builds/worker/workspace",
"MOZHARNESS_URL": "https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/T6iDE8yqQryKzJiVSvfpiQ/artifacts/public/build/mozharness.zip",
"GECKO_BASE_REPOSITORY": "https://hg.mozilla.org/mozilla-unified",
"MOZ_FETCHES": "[{\"artifact\": \"public/build/grcov.tar.xz\", \"extract\": true, \"task\": \"cCf9pNwMTp-U1DLCivF6ew\"}]",
"TASKCLUSTER_CACHES": "/builds/worker/checkouts;/builds/worker/tooltool-cache",
"WORKING_DIR": "/builds/worker",
"NEED_PULSEAUDIO": "true",
"ENABLE_E10S": "false",
"NEED_WINDOW_MANAGER": "true",
"MOZHARNESS_CONFIG": "unittests/linux_unittest.py remove_executables.py"
},
"features": {
"taskclusterProxy": true,
"allowPtrace": true
}
},
"metadata": {
"owner": "[email protected]",
"source": "https://hg.mozilla.org/mozilla-central/file/1fd87ec46d80675d2a8b18b47029f53a28d43a38/taskcluster/ci/test",
"description": "CPP Unit Tests ([Treeherder push](https://treeherder.mozilla.org/#/jobs?repo=mozilla-central&revision=1fd87ec46d80675d2a8b18b47029f53a28d43a38))",
"name": "test-linux1804-64-ccov/opt-cppunit-1proc"
},
"tags": {
"kind": "test",
"worker-implementation": "docker-worker",
"createdForUser": "[email protected]",
"retrigger": "true",
"label": "test-linux1804-64-ccov/opt-cppunit-1proc",
"os": "linux"
},
"extra": {
"index": {
"rank": 0
},
"parent": "S5_GgKsuQvuxsHqLKGXpow",
"chunks": {
"current": 1,
"total": 1
},
"suite": "cppunittest",
"treeherder": {
"machine": {
"platform": "linux1804-64-ccov"
},
"tier": 2,
"symbol": "cppunit",
"jobKind": "test",
"collection": {
"opt": true
}
},
"treeherder-platform": "linux1804-64-ccov/opt"
}
}
Loading