Skip to content

report: Support cases where a push doesn't contain a Linux coverage build #373

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 2 commits into from
Jan 13, 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
11 changes: 7 additions & 4 deletions report/firefox_code_coverage/codecoverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ def is_taskcluster_loaner():

def get_task(branch, revision):
task = get_json(
"https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.v2.%s.revision.%s.firefox.linux64-ccov-opt"
% (branch, revision)
f"https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.v2.{branch}.revision.{revision}.firefox.decision"
)
return task["taskId"]

Expand Down Expand Up @@ -150,15 +149,19 @@ def get_task_status(task_id):


def download_coverage_artifacts(
build_task_id, suites, platforms, artifacts_path, suites_to_ignore=["talos", "awsy"]
decision_task_id,
suites,
platforms,
artifacts_path,
suites_to_ignore=["talos", "awsy"],
):
try:
os.mkdir(artifacts_path)
except OSError as e:
if e.errno != errno.EEXIST:
raise e

task_data = get_task_details(build_task_id)
task_data = get_task_details(decision_task_id)

# Returns True if the task is a test-related coverage task (build tasks are included).
def _is_test_task(t):
Expand Down
8 changes: 4 additions & 4 deletions report/tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test(self):
self.assertTrue(task_id)

task_data = codecoverage.get_task_details(task_id)
self.assertEqual(task_data["metadata"]["name"], "build-linux64-ccov/opt")
self.assertEqual(task_data["metadata"]["name"], "Gecko Decision Task")

revision = task_data["payload"]["env"]["GECKO_HEAD_REV"]
task_id_2 = codecoverage.get_task("mozilla-central", revision)
Expand All @@ -39,7 +39,7 @@ def test(self):
artifacts = codecoverage.get_task_artifacts(task_id)
chosen_artifact = None
for artifact in artifacts:
if artifact["name"] == "public/build/target.txt":
if artifact["name"] == "public/target-tasks.json":
chosen_artifact = artifact
self.assertIsNotNone(chosen_artifact)

Expand All @@ -53,8 +53,8 @@ def test(self):
raise e

codecoverage.download_artifact(task_id, chosen_artifact, "ccov-artifacts")
self.assertTrue(os.path.exists("ccov-artifacts/%s_target.txt" % task_id))
os.remove("ccov-artifacts/%s_target.txt" % task_id)
self.assertTrue(os.path.exists("ccov-artifacts/%s_target-tasks.json" % task_id))
os.remove("ccov-artifacts/%s_target-tasks.json" % task_id)

artifact_paths = codecoverage.download_coverage_artifacts(
task_id, "gtest-1proc", None, "ccov-artifacts"
Expand Down