2022-09-13 17:55:17 +00:00
|
|
|
# Copyright 2022 The ChromiumOS Authors
|
2022-05-18 17:06:46 +00:00
|
|
|
# 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
|
|
|
|
|
2022-08-08 21:56:01 +00:00
|
|
|
COVERAGE_FILE = "coverage.lcov"
|
|
|
|
|
2022-05-18 17:06:46 +00:00
|
|
|
|
2022-07-06 21:22:36 +00:00
|
|
|
def get_test_args(api, properties):
|
2022-05-18 17:06:46 +00:00
|
|
|
"Returns architecture specific arguments for ./tools/run_tests"
|
|
|
|
# TODO(denniskempin): Move this logic into ./tools/presubmit
|
2022-07-06 21:22:36 +00:00
|
|
|
test_arch = properties.test_arch
|
2022-10-18 19:55:32 +00:00
|
|
|
args = ["--platform=" + test_arch]
|
2022-07-06 21:22:36 +00:00
|
|
|
if properties.crosvm_direct:
|
|
|
|
args += ["--crosvm-direct"]
|
2022-08-08 21:56:01 +00:00
|
|
|
if properties.coverage:
|
|
|
|
args += ["--generate-lcov", COVERAGE_FILE]
|
2022-07-06 21:22:36 +00:00
|
|
|
return args
|
2022-05-18 17:06:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
def RunSteps(api, properties):
|
2022-06-22 21:13:09 +00:00
|
|
|
with api.crosvm.container_build_context():
|
2022-05-18 17:06:46 +00:00
|
|
|
api.crosvm.step_in_container(
|
|
|
|
"Build crosvm tests",
|
|
|
|
[
|
|
|
|
"./tools/run_tests",
|
|
|
|
"--verbose",
|
|
|
|
"--build-only",
|
|
|
|
]
|
2022-07-06 21:22:36 +00:00
|
|
|
+ get_test_args(api, properties),
|
2022-05-18 17:06:46 +00:00
|
|
|
)
|
|
|
|
api.crosvm.step_in_container(
|
|
|
|
"Run crosvm tests",
|
|
|
|
[
|
|
|
|
"./tools/run_tests",
|
|
|
|
"--verbose",
|
2022-07-08 00:57:45 +00:00
|
|
|
"--retry=" + str(properties.retry_tests or 0),
|
2022-07-07 21:14:50 +00:00
|
|
|
"--repeat=" + str(properties.repeat_tests or 1),
|
2022-05-18 17:06:46 +00:00
|
|
|
]
|
2022-07-06 21:22:36 +00:00
|
|
|
+ get_test_args(api, properties),
|
2022-05-18 17:06:46 +00:00
|
|
|
)
|
2022-08-08 21:56:01 +00:00
|
|
|
if properties.coverage:
|
|
|
|
api.crosvm.upload_coverage(COVERAGE_FILE)
|
2022-05-18 17:06:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
def GenTests(api):
|
2022-05-25 21:19:09 +00:00
|
|
|
filter_steps = Filter("Build crosvm tests", "Run crosvm tests")
|
2022-05-18 17:06:46 +00:00
|
|
|
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)
|
|
|
|
)
|
2022-08-08 21:56:01 +00:00
|
|
|
yield (
|
|
|
|
api.test(
|
|
|
|
"build_x86_64_coverage",
|
|
|
|
api.buildbucket.ci_build(project="crosvm/crosvm"),
|
|
|
|
)
|
|
|
|
+ api.properties(BuildLinuxProperties(test_arch="x86_64", coverage=True))
|
|
|
|
)
|
2022-07-06 21:22:36 +00:00
|
|
|
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)
|
|
|
|
)
|
2022-05-18 17:06:46 +00:00
|
|
|
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(
|
2022-10-18 19:55:32 +00:00
|
|
|
"build_mingw64",
|
2022-05-18 17:06:46 +00:00
|
|
|
api.buildbucket.ci_build(project="crosvm/crosvm"),
|
|
|
|
)
|
2022-10-18 19:55:32 +00:00
|
|
|
+ api.properties(BuildLinuxProperties(test_arch="mingw_64"))
|
|
|
|
+ api.post_process(filter_steps)
|
2022-05-18 17:06:46 +00:00
|
|
|
)
|