Bug 1742652 - Use topsrcdir from build task mozinfo.json instead of hardcoding the path for the gcov prefix. r=releng-reviewers,jmaher DONTBUILD

Differential Revision: https://phabricator.services.mozilla.com/D132147
This commit is contained in:
Marco Castelluccio 2021-11-29 11:09:29 +00:00
parent bf6d4c633d
commit f8e70b1514
2 changed files with 8 additions and 8 deletions

View File

@ -1184,6 +1184,7 @@ def enable_code_coverage(config, tasks):
task.setdefault("fetches", {})
task["fetches"].setdefault("fetch", [])
task["fetches"].setdefault("toolchain", [])
task["fetches"].setdefault("build", [])
if "linux" in task["build-platform"]:
task["fetches"]["toolchain"].append("linux64-grcov")
@ -1192,6 +1193,8 @@ def enable_code_coverage(config, tasks):
elif "win" in task["build-platform"]:
task["fetches"]["toolchain"].append("win64-grcov")
task["fetches"]["build"].append({"artifact": "target.mozinfo.json"})
if "talos" in task["test-name"]:
task["max-run-time"] = 7200
if "linux" in task["build-platform"]:

View File

@ -122,14 +122,11 @@ class CodeCoverageMixin(SingleTestMixin):
return False
def _setup_cpp_js_coverage_tools(self):
if mozinfo.os == "linux" or mozinfo.os == "mac":
self.prefix = "/builds/worker/checkouts/gecko"
elif mozinfo.os == "win":
# obj folder is z:/build/workspace/obj-build
# same strip count as prefix
self.prefix = "z:/build/build/src/"
else:
raise Exception("Unexpected OS: {}".format(mozinfo.os))
fetches_dir = os.environ["MOZ_FETCHES_DIR"]
with open(os.path.join(fetches_dir, "target.mozinfo.json"), "r") as f:
build_mozinfo = json.load(f)
self.prefix = build_mozinfo["topsrcdir"]
strip_count = len(list(filter(None, self.prefix.split("/"))))
os.environ["GCOV_PREFIX_STRIP"] = str(strip_count)