crosvm/infra/recipes/health_check.py
Dennis Kempin a2b14f7061 infra: Use new health check script
The updated recipe will use --list-checks to iterate a list of
checks to run. Each check will be run separately and create a separate
luci step.

BUG=239255137
TEST=led get-builder luci.crosvm.try:health_check
  | led edit-recipe-bundle
  | led edit-cr-cl https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3830246
  | led launch

https://ci.chromium.org/swarming/task/5cacfaf0ecf10010

Change-Id: Ia67bfa8a2da9ec337174a6a9e686c72f43e84ebf
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3830246
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-08-15 18:52:02 +00:00

65 lines
1.9 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/raw_io",
"recipe_engine/buildbucket",
"recipe_engine/context",
"recipe_engine/properties",
"recipe_engine/step",
]
def RunSteps(api):
with api.crosvm.container_build_context():
api.step(
"Self-test dev-container",
[
"vpython3",
api.crosvm.source_dir.join("tools/dev_container"),
"--verbose",
"--self-test",
],
)
result = api.step(
"List checks to run",
[
"vpython3",
api.crosvm.source_dir.join("tools/health-check"),
"--list-checks",
],
stdout=api.raw_io.output(),
)
check_list = result.stdout.strip().decode("utf-8").split("\n")
for check in check_list:
api.crosvm.step_in_container(
"Checking %s" % check, ["./tools/health-check", "--all", check]
)
# TODO: Move these into health-check
api.crosvm.step_in_container("Checking mdbook", ["mdbook", "build", "docs/book/"])
api.crosvm.step_in_container(
"Checking cargo docs",
["./tools/cargo-doc"],
)
def GenTests(api):
yield (
api.test(
"basic",
api.buildbucket.ci_build(project="crosvm/crosvm"),
# Provide a fake response to --list-checks
api.step_data(
"List checks to run",
stdout=api.raw_io.output("a\nb"),
),
)
+ api.post_process(Filter().include_re(r"Checking.*"))
)