ci/android: Add arm64 support for Android CTS

Android CTS for both arm64 and x86_64 Android targets always ships with
an x86_64 host JDK. Tradefed supports running on arm64 hosts though, so
provide a native JDK by installing Debian's openjdk-21-jdk-headless
package on arm64.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41440>
This commit is contained in:
Valentine Burley 2026-03-10 10:53:56 +01:00 committed by Marge Bot
parent aeb40ed23b
commit 03a84a1e03
4 changed files with 30 additions and 8 deletions

View file

@ -1,5 +1,5 @@
variables:
CONDITIONAL_BUILD_ANDROID_CTS_TAG: 363c33efa7f381a9be0d4c6af2dfaa1d
CONDITIONAL_BUILD_ANDROID_CTS_TAG: 3e87ed2c4c2d00d764321eb26dd70f48
CONDITIONAL_BUILD_ANGLE_TAG: 6ab21f6e04363ee652c71461e7fbe5f7
CONDITIONAL_BUILD_CROSVM_TAG: 7edabf28bbd50e00558e3b0bb2d94255
CONDITIONAL_BUILD_FLUSTER_TAG: e13f8521875ebd70e207ec0f6f3d3e5b

View file

@ -32,11 +32,15 @@ ANDROID_CTS_MODULES=(
)
ANDROID_CTS_VERSION="${ANDROID_VERSION}_r5"
ANDROID_CTS_DEVICE_ARCH="x86"
case "$ANDROID_ARCH" in
x86_64) ANDROID_CTS_ARCH=x86;;
arm64) ANDROID_CTS_ARCH=arm;;
esac
# Download the stripped CTS from S3, because the CTS download from Google can take 20 minutes
CTS_FILENAME="android-cts-${ANDROID_CTS_VERSION}-linux_x86-${ANDROID_CTS_DEVICE_ARCH}"
ARTIFACT_PATH="${DATA_STORAGE_PATH}/android-cts/${ANDROID_CTS_TAG}.tar.zst"
CTS_FILENAME="android-cts-${ANDROID_CTS_VERSION}-linux_x86-${ANDROID_CTS_ARCH}"
ARTIFACT_PATH="${DATA_STORAGE_PATH}/android-cts/${DEBIAN_ARCH}/${ANDROID_CTS_TAG}.tar.zst"
if FOUND_ARTIFACT_URL="$(find_s3_project_artifact "${ARTIFACT_PATH}")"; then
echo "Found Android CTS at: ${FOUND_ARTIFACT_URL}"
@ -56,6 +60,13 @@ else
ANDROID_CTS_MODULES_KEEP_EXPRESSION=$(printf "%s|" "${ANDROID_CTS_MODULES[@]}" | sed -e 's/|$//g')
find /android-cts/testcases/ -mindepth 1 -type d | grep -v -E "$ANDROID_CTS_MODULES_KEEP_EXPRESSION" | xargs rm -rf
# Android CTS bundles a JDK for x86_64 hosts.
# Replace this with the JDK we installed.
if [ "${DEBIAN_ARCH}" = "arm64" ]; then
rm -rf /android-cts/jdk
mv /usr/lib/jvm/java-21-openjdk-arm64 /android-cts/jdk
fi
# Using zstd compressed tarball instead of zip, the compression ratio is almost the same, but
# the extraction is faster, also LAVA overlays don't support zip compression.
tar --zstd -cf "${CTS_FILENAME}.tar.zst" /android-cts

View file

@ -55,7 +55,9 @@ if "${BUILD_CONTAINER}"; then
)
else
# We only need the build tools in build containers
EPHEMERAL=()
EPHEMERAL=(
unzip
)
fi
if "${TEST_CONTAINER}"; then
@ -66,6 +68,10 @@ if "${TEST_CONTAINER}"; then
cuttlefish-user
iproute2
)
# Android CTS only comes with x86_64 Java bundled, so we need to install it on arm64
if [ "${DEBIAN_ARCH}" = "arm64" ]; then
DEPS+=(openjdk-21-jdk-headless)
fi
else
DEPS=()
fi
@ -203,8 +209,7 @@ fi
############### Downloading Android CTS
# We currently only have x86_64 CTS jobs
if [ "${ANDROID_ARCH}" = "x86_64" ]; then
if "${TEST_CONTAINER}"; then
. .gitlab-ci/container/build-android-cts.sh
fi
@ -239,6 +244,12 @@ if "${BUILD_CONTAINER}"; then
rm -rf "/${ndk:?}"
fi
# We currently only have LAVA jobs on arm64, where we deploy Android CTS as a LAVA overlay.
# Remove it from the container image to save some space.
if "${TEST_CONTAINER}" && [ "${DEBIAN_ARCH}" = "arm64" ]; then
rm -rf "/android-cts"
fi
apt-get purge -y "${EPHEMERAL[@]}"
. .gitlab-ci/container/container_post_build.sh

View file

@ -83,7 +83,7 @@ if [ -n "${ANDROID_CTS_TAG:-}" ]; then
LAVA_EXTRA_OVERLAYS+=(
- append-overlay
--name=android-cts
--url="$(fdo_find_s3_path "${DATA_STORAGE_PATH}/android-cts/${ANDROID_CTS_TAG}.tar.zst")"
--url="$(fdo_find_s3_path "${DATA_STORAGE_PATH}/android-cts/${DEBIAN_ARCH}/${ANDROID_CTS_TAG}.tar.zst")"
--path="/"
--format=tar
--compression=zstd