Skip to content

Commit

Permalink
report: Support cases where a push doesn't contain a Linux coverage b…
Browse files Browse the repository at this point in the history
…uild (#373)
  • Loading branch information
marco-c authored Jan 13, 2020
1 parent e55bb16 commit 8c4ecce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
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

0 comments on commit 8c4ecce

Please sign in to comment.