crosvm/infra/recipes/build_linux.py
Dennis Kempin 1dab58a2cf Update all copyright headers to match new style
This search/replace updates all copyright notices to drop the
"All rights reserved", Use "ChromiumOS" instead of "Chromium OS"
and drops the trailing dots.

This fulfills the request from legal and unifies our notices.

./tools/health-check has been updated to only accept this style.

BUG=b:246579983
TEST=./tools/health-check

Change-Id: I87a80701dc651f1baf4820e5cc42469d7c5f5bf7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894243
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-13 18:41:29 +00:00

118 lines
3.6 KiB
Python

# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from recipe_engine.recipe_api import Property
from recipe_engine.post_process import DropExpectation, StatusFailure, Filter
from PB.recipes.crosvm.build_linux import BuildLinuxProperties
PYTHON_VERSION_COMPATIBILITY = "PY3"
DEPS = [
"crosvm",
"recipe_engine/buildbucket",
"recipe_engine/context",
"recipe_engine/properties",
"recipe_engine/step",
]
PROPERTIES = BuildLinuxProperties
COVERAGE_FILE = "coverage.lcov"
def get_test_args(api, properties):
"Returns architecture specific arguments for ./tools/run_tests"
# TODO(denniskempin): Move this logic into ./tools/presubmit
test_arch = properties.test_arch
args = []
if test_arch == "" or test_arch == "x86_64":
args += ["--target=host"]
elif test_arch == "aarch64":
args += ["--target=vm:aarch64"]
elif test_arch == "armhf":
args += ["--target=vm:aarch64", "--build-target=armhf"]
else:
raise api.step.StepFailure("Unknown test_arch " + test_arch)
if properties.crosvm_direct:
args += ["--crosvm-direct"]
if properties.coverage:
args += ["--generate-lcov", COVERAGE_FILE]
return args
def RunSteps(api, properties):
with api.crosvm.container_build_context():
api.crosvm.step_in_container(
"Build crosvm tests",
[
"./tools/run_tests",
"--verbose",
"--build-only",
]
+ get_test_args(api, properties),
)
api.crosvm.step_in_container(
"Run crosvm tests",
[
"./tools/run_tests",
"--verbose",
"--retry=" + str(properties.retry_tests or 0),
"--repeat=" + str(properties.repeat_tests or 1),
]
+ get_test_args(api, properties),
)
if properties.coverage:
api.crosvm.upload_coverage(COVERAGE_FILE)
def GenTests(api):
filter_steps = Filter("Build crosvm tests", "Run crosvm tests")
yield (
api.test(
"build_x86_64",
api.buildbucket.ci_build(project="crosvm/crosvm"),
)
+ api.properties(BuildLinuxProperties(test_arch="x86_64"))
+ api.post_process(filter_steps)
)
yield (
api.test(
"build_x86_64_coverage",
api.buildbucket.ci_build(project="crosvm/crosvm"),
)
+ api.properties(BuildLinuxProperties(test_arch="x86_64", coverage=True))
)
yield (
api.test(
"build_x86_64_direct",
api.buildbucket.ci_build(project="crosvm/crosvm"),
)
+ api.properties(BuildLinuxProperties(test_arch="x86_64", crosvm_direct=True))
+ api.post_process(filter_steps)
)
yield (
api.test(
"build_aarch64",
api.buildbucket.ci_build(project="crosvm/crosvm"),
)
+ api.properties(BuildLinuxProperties(test_arch="aarch64"))
+ api.post_process(filter_steps)
)
yield (
api.test(
"build_armhf",
api.buildbucket.ci_build(project="crosvm/crosvm"),
)
+ api.properties(BuildLinuxProperties(test_arch="armhf"))
+ api.post_process(filter_steps)
)
yield (
api.test(
"build_unknown",
api.buildbucket.ci_build(project="crosvm/crosvm"),
)
+ api.properties(BuildLinuxProperties(test_arch="foobar"))
+ api.post_process(StatusFailure)
+ api.post_process(DropExpectation)
)