From bd26a57bdc6f60552f046027fa078f3aa992cac9 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 7 Jan 2025 11:55:37 +0900 Subject: [PATCH] [CI] Switch to source-based code coverage for rust --- CI/decision.py | 12 +----------- CI/tools.py | 11 ++--------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/CI/decision.py b/CI/decision.py index 1cd7634b..c203457a 100644 --- a/CI/decision.py +++ b/CI/decision.py @@ -416,19 +416,9 @@ def main(): coverage_mounts = [ {f"file:cov-{task.id}.zip": task} for task in TestTask.coverage ] - task = Build.by_name("linux.coverage") - coverage_mounts.append( - { - "file:gcno-build.zip": { - "artifact": task.artifacts[1], - "taskId": task.id, - } - } - ) - merge_coverage.extend( [ - "grcov -s repo -t lcov -o repo/coverage.lcov gcno-build.zip " + "grcov -s repo -t lcov -o repo/coverage.lcov " + " ".join(f"cov-{task.id}.zip" for task in TestTask.coverage), ] ) diff --git a/CI/tools.py b/CI/tools.py index c72caed1..cbe7f512 100644 --- a/CI/tools.py +++ b/CI/tools.py @@ -396,7 +396,6 @@ def prefix(p, s): hash = None head = None desc_variant = variant - extra_commands = [] environ = {} cargo_flags = ["-vv", "--release"] cargo_features = ["self-update", "gitdev", "xz2/static", "bzip2/static"] @@ -430,14 +429,9 @@ def prefix(p, s): "-fPIC", ] ) - artifacts += ["coverage.zip"] - extra_commands = [ - "(cd repo && zip $ARTIFACTS/coverage.zip" - ' $(find . -name "*.gcno" -not -name "build_script*"))', - ] environ["RUSTFLAGS"] = " ".join( [ - "-Zprofile", + "-Cinstrument-coverage", "-Ccodegen-units=1", "-Cinline-threshold=0", ] @@ -543,8 +537,7 @@ def prefix(p, s): "release" if "--release" in cargo_flags else "debug", artifact, ), - ] - + extra_commands, + ], artifacts=artifacts, env=environ, )