ci: Run x86_64-linux-android tests on Cuttlefish virtual devices#5269
Open
10ne1 wants to merge 1 commit into
Open
ci: Run x86_64-linux-android tests on Cuttlefish virtual devices#526910ne1 wants to merge 1 commit into
10ne1 wants to merge 1 commit into
Conversation
Collaborator
|
Some changes occurred in an Android module cc @maurer |
Contributor
|
Thank you for getting this going! I know extremely little about android CI so pinging the maintainers for help: @chriswailes @jfgoog @maurer @pirama-arumuga-nainar |
tgross35
reviewed
Jul 10, 2026
tgross35
reviewed
Jul 10, 2026
tgross35
reviewed
Jul 10, 2026
10ne1
added a commit
to 10ne1/libc
that referenced
this pull request
Jul 10, 2026
Instead of the script escalating privileges itself with internal sudo calls, make the CI job invoke it with sudo and fail fast when run as a plain user, so nobody accidentally reconfigures their machine by running it locally with passwordless sudo. The fetch/launch phase still has to run unprivileged because cvd refuses to run as root, so re-exec it as the sudo-invoking user via runuser, which also picks up the freshly added kvm/cvdnetwork/render group memberships without a relogin (runuser does initgroups and resets HOME to that user's home, which is where the device directory lives). Requested-by: Trevor Gross <tmgross@umich.edu> Link: rust-lang#5269 (comment) Assisted-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
10ne1
added a commit
to 10ne1/libc
that referenced
this pull request
Jul 10, 2026
Instead of a dedicated collection script and upload-artifact step, stop the device with an inline CI step (so its logs are flushed) and let create-artifacts.py bundle whatever logs the boot produced into the existing inspection archive, using a second positional tar -C pointing at the device's runtime directory. Requested-by: Trevor Gross <tmgross@umich.edu> Link: rust-lang#5269 (comment) Assisted-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
10ne1
added a commit
to 10ne1/libc
that referenced
this pull request
Jul 10, 2026
Instead of a dedicated collection script and upload-artifact step, stop the device with an inline CI step (so its logs are flushed) and let create-artifacts.py bundle whatever logs the boot produced into the existing inspection archive, using a second positional tar -C pointing at the device's runtime directory. Requested-by: Trevor Gross <tmgross@umich.edu> Link: rust-lang#5269 (comment) Assisted-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
9c7959c to
9056199
Compare
Collaborator
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Author
|
@tgross35 I addressed all your requests, so I kindly ask for a re-review (it's only 1 commit now). I'll address the detecting targeted Android version from headers in a separate PR, since by doing that I uncovered another, pre-existing, bug. |
The new ci/cuttlefish-setup.sh is heavily inspired by Mesa CI's cuttlefish-runner.sh, credited in the script. For more details, see the following issue, of which this is part of: rust-lang#5262 In a nutshell, the libc x86_64 job never booted Android: it extracted bionic from a 2016-era (API 24) image and ran the test binaries directly on the Ubuntu host kernel. This makes the CI test boot the official stock Android 17 image via Cuttlefish. The virtual device boots inside the test container, self-contained: Cuttlefish host packages are installed in the x86_64-linux-android image and the container entrypoint creates the tap networking via the deb's sysv script as root, then drops to an unprivileged user. The container needs only the virtualization device nodes plus CAP_NET_ADMIN, the same flags upstream uses for its own containerized Cuttlefish CI, so nothing on the CI host is mutated and a local run reduces to the usual ./ci/run-docker.sh with no host setup beyond KVM. The container still cross-compiles with the NDK and drives the device over adb, reusing the runtest-android.rs wrapper unchanged. Device logs are uploaded as CI artifacts (again similar to Mesa). The other Android targets stay on the legacy SDK emulator for now. Assisted-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
9056199 to
a621872
Compare
This was referenced Jul 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Part of #5262 (please see it for background and discussion).
This migrates
x86_64-linux-androidtesting off the deprecated 2016-era infrastructure and onto the modern Cuttlefish-based images and contains just one commit for the migration itself.Further PRs will be posted for the Android toolchain version ask by Trevor as well as to migrate the aarch64 CI.
Some observations from my testing and validation:
malloptand related constants for Android #4459, which crashes the old emulator, passes. We will also need the aarch64 migration to fully unblock it (I'm working on it).-guest_enforce_security=false. This means we keep the env as close to real devices as possible.One implementation decision is worth highlighting (or changing):
I had to pass
-enable_sandbox=false, which disables crosvm's minijail device sandbox, because Ubuntu >= 24.04 uses AppArmor to block the unprivileged user namespaces minijail requires. I opted to disable it because the sandbox value in this environment is basically null, it's a defense-in-depth against a hostile guest, but CI runners are ephemeral, there are no untrusted Android apps and the test code already runs unsandboxed on the host in every other non-Cuttlefish/crosvm job.MesaCI doesn't have this problem because it's running Debian images which are not as restrictive. AFAIK only Ubuntu is available on the GitHub runners, not Debian. In effect, I mirrored the Debian runtime behavior.
If reviewers/maintainers wish, I can try two alternatives (feel free to suggest others):
kernel.apparmor_restrict_unprivileged_userns=0. This allows unprivileged userns host-wide so minijail works, however it weakens the whole host runner for a single process.A libc-0.2 backport might be desired to get the new Android CI infra there as well, but I'll leave it up to the maintainers / reviewers to decide.
Sources
No library/API changes; CI-only. Infrastructure references:
Checklist
CI-only change: no
src/orlibc-test/semvermodifications.Relevant tests in(N/A)libc-test/semverhave been updatedNo placeholder or unstable values(N/A)AI disclosure
This PR was written with the help of Claude Code, but was not vibe-coded. I'm not a fan of vibe-coding.
I used AI to better understand the codebase myself (asked it a lot of questions), review both my code and any code generated by AI, used it especially to detect bugs and corner-cases and suggest fixes, however I very carefully reviewed & edited each code/comment lines, the commit messages and so on, until I was satisfied with the result.
Even this PR description was written entirely by myself and only reviewed by AI for errors.