Skip to content

Android testbed emulator needs more RAM #144418

@mhsmith

Description

@mhsmith

Bug report

Bug description:

The Android testbed uses an emulator with 2 GB of RAM. This is barely enough to run the Python test suite, so on the buildbot machines I've had to manually edit the emulator configuration files after creation, as described in Android/README.md.

This approach wouldn't work on GitHub Actions, because they use a fresh VM for every job. Fortunately this issue hasn't affected GitHub Actions yet for Python itself, but it will affect other packages which use the testbed via cibuildwheel. For example, I encountered it when trying to build Pandas for Android.

Unfortunately the tools don't make it easy to configure the RAM programmatically. This is supposed to be controlled by the hardware device profile, but avdmanager ignores this and limits it to 2 GB.

So the simplest solution I can think of is to add a Gradle task as a dependency of each of the built-in emulator creation tasks (e.g. maxVersionSetup), which does the following:

  • Based on the managed device settings, and the ANDROID_USER_HOME environment variable if set, determine the location where Gradle would create the AVD.
  • If the AVD doesn't already exist, then download its system image with sdkmanager if necessary, then create it with avdmanager.
  • Edit the config files to set the RAM to 4 GB.

Notes:

  • Unlike the rest of the Android build process, we do support running the tesbed on Windows, where the locations of the AVD and the manager tools will be different.
  • The paragraph about RAM in the README should be removed.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Other

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-androidtestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions