Skip to content

Commit fd4269d

Browse files
committed
Add a kokoro boot test that substitutes bin/assemble_cvd and bin/run_cvd
We have been migrating executables to the GitHub source tree. Using the `debian_substitution_marker` field driven by the Android build, the device build can request certain executables are substituted with the latest version built from this source tree rather than use the one shipped with the device build. Some executables with migrated source have never been rolled out to production, and had no end-to-end test coverage. This has allowed broken versions of these executables to be included in releases, delaying the substitution and use of those executables. Adding the capability and execution of new tests on executables that are not yet rolled out will improve our chances at rolling out these executables later. Bug: b/461909300
1 parent c23dfd2 commit fd4269d

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

e2etests/cvd/BUILD.bazel

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,26 @@ cvd_command_boot_test(
5858
target = "aosp_cf_x86_64_only_phone-userdebug",
5959
)
6060

61+
cvd_command_boot_test(
62+
name = "aosp_additional_substitution",
63+
branch = "aosp-android-latest-release",
64+
target = "aosp_cf_x86_64_only_phone-userdebug",
65+
substitutions = [
66+
"bin/assemble_cvd",
67+
"bin/run_cvd",
68+
],
69+
)
70+
71+
cvd_command_boot_test(
72+
name = "git_main_additional_substitution",
73+
branch = "git_main",
74+
target = "aosp_cf_x86_64_only_phone-trunk_staging-userdebug",
75+
substitutions = [
76+
"bin/assemble_cvd",
77+
"bin/run_cvd",
78+
],
79+
)
80+
6181
cvd_command_boot_test(
6282
name = "take_bugreport",
6383
branch = "aosp-android-latest-release",

e2etests/cvd/boot_tests.bzl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ def cvd_load_boot_test(name, env_file, size = "medium", credential_source = ""):
3131
],
3232
)
3333

34-
def cvd_command_boot_test(name, branch, target, cvd_command, credential_source = ""):
34+
def cvd_command_boot_test(name, branch, target, cvd_command = [], credential_source = "", substitutions = ""):
3535
args = ["-b", branch, "-t", target]
3636
if credential_source:
3737
args += ["-c", credential_source]
38+
if substitutions:
39+
args += ["-s", ",".join(substitutions)]
3840
args += cvd_command
3941
native.sh_test(
4042
name = name,

e2etests/cvd/cvd_command_boot_test.sh

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ BRANCH=""
66
TARGET=""
77
CREDENTIAL_SOURCE="${CREDENTIAL_SOURCE:-}"
88

9-
while getopts "c:b:t:" opt; do
9+
while getopts "b:c:s:t:" opt; do
1010
case "${opt}" in
1111
b)
1212
BRANCH="${OPTARG}"
1313
;;
1414
c)
1515
CREDENTIAL_SOURCE="${OPTARG}"
1616
;;
17+
s)
18+
SUBSTITUTIONS="${OPTARG}"
19+
;;
1720
t)
1821
TARGET="${OPTARG}"
1922
;;
@@ -59,14 +62,25 @@ credential_arg=""
5962
if [[ -n "$CREDENTIAL_SOURCE" ]]; then
6063
credential_arg="--credential_source=${CREDENTIAL_SOURCE}"
6164
fi
65+
6266
cvd fetch \
6367
--default_build="${BRANCH}/${TARGET}" \
6468
--target_directory="${workdir}" \
6569
${credential_arg}
6670

71+
# This argument is supported at fetch and create time. Applying it to both
72+
# invocations would make it replace the debian_substition_marker list, applying
73+
# it only to one out of two cases makes it additive.
74+
substitution_arg=""
75+
if [[ -n "$SUBSTITUTIONS" ]]; then
76+
substitution_arg="--host_substitutions=${SUBSTITUTIONS}"
77+
fi
78+
6779
(
6880
cd "${workdir}"
69-
cvd create --report_anonymous_usage_stats=y --undefok=report_anonymous_usage_stats
70-
cvd "$@"
81+
cvd create ${substitution_arg} --report_anonymous_usage_stats=y --undefok=report_anonymous_usage_stats
82+
if (( $# > 0 )); then
83+
cvd "$@"
84+
fi
7185
cvd rm
7286
)

0 commit comments

Comments
 (0)