mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 12:09:31 +00:00
The recipe will use the newly added --generate-lcov flag to generate a profile, which is then uploaded to codecov.io. The codecov.io uploader is stored in CIPD, and our upload token is kept secure by Secret Manager. To prevent token from being leaked in a log, the token is downloaded and added by a wrapper shell script. BUG=b:239255082 TEST=./recipes.py run build_coverage Change-Id: Ie8197864d9ecc12ebefe81235f2d62bd7342d0c7 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3805832 Tested-by: Dennis Kempin <denniskempin@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Dennis Kempin <denniskempin@google.com>
56 lines
1.5 KiB
Python
56 lines
1.5 KiB
Python
# Copyright 2022 The Chromium OS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
from recipe_engine.post_process import Filter
|
|
|
|
PYTHON_VERSION_COMPATIBILITY = "PY3"
|
|
|
|
DEPS = [
|
|
"crosvm",
|
|
"recipe_engine/buildbucket",
|
|
"recipe_engine/context",
|
|
"recipe_engine/cipd",
|
|
"recipe_engine/step",
|
|
]
|
|
|
|
|
|
def RunSteps(api):
|
|
with api.crosvm.container_build_context():
|
|
api.crosvm.step_in_container(
|
|
"Run crosvm tests",
|
|
[
|
|
"./tools/run_tests",
|
|
"--verbose",
|
|
"--generate-lcov=coverage.lcov",
|
|
],
|
|
)
|
|
codecov = api.cipd.ensure_tool("crosvm/codecov/${platform}", "latest")
|
|
sha = api.crosvm.get_git_sha()
|
|
api.step(
|
|
"Uploading to covecov.io",
|
|
[
|
|
"bash",
|
|
api.resource("codecov_wrapper.sh"),
|
|
codecov,
|
|
"--nonZero", # Enables error codes
|
|
"--slug",
|
|
"google/crosvm",
|
|
"--sha",
|
|
sha,
|
|
"--branch",
|
|
"main",
|
|
"-f",
|
|
"coverage.lcov",
|
|
],
|
|
)
|
|
|
|
|
|
def GenTests(api):
|
|
filter_steps = Filter("Run crosvm tests", "Uploading to covecov.io")
|
|
yield (
|
|
api.test(
|
|
"generate_coverage",
|
|
api.buildbucket.ci_build(project="crosvm/crosvm"),
|
|
)
|
|
+ api.post_process(filter_steps)
|
|
)
|