Skip to content

Instantly share code, notes, and snippets.

@r41k0u
Last active September 9, 2024 10:24
Show Gist options
  • Select an option

  • Save r41k0u/b1754ab2759f36bcd9172125d34d10a6 to your computer and use it in GitHub Desktop.

Select an option

Save r41k0u/b1754ab2759f36bcd9172125d34d10a6 to your computer and use it in GitHub Desktop.
cross-arch autopkgtests

QEMU is able to emulate many different architecture. Even though it is much slower than accelerated VMs, it's still useful sometimes to have the tests run on a foreign architecture locally, for quicker debug loops.

First ensure you have a suitable VM image (the --timeout is almost necessary when it comes to emulation):

autopkgtest-buildvm-ubuntu-cloud -v --arch arm64 --release jammy --timeout 7200

Then run the tests by specifying the architecture to QEMU. The following command also increases the reboot timeout, because VMs are slower in emulation, and may not be able to reach the login prompt in less than one minute:

autopkgtest gzip -- qemu --qemu-architecture=aarch64 --timeout-reboot 90 autopkgtest-jammy-arm64.img

Foreign arch testing

A particular case of cross-arch testing, is running package for a foreign architecture than the VM's. The typical use-case is testing i386 packages on an amd64 VM. For that, you can specify the -a flag to autopkgtest, and it will automatically setup the required dpkg configuration and install the packages from the right sources (-U mostly here to make sure this example command still runs in the future):

autopkgtest mawk -a i386 -U -- qemu autopkgtest-jammy-amd64.img

Of course, this can be combined with emulated cross-arch, for example to test armhf on emulated arm64:

autopkgtest mawk -a armhf -U -- qemu --qemu-architecture=aarch64 --timeout-reboot 180 autopkgtest-jammy-arm64.img

More: Guide to Proposed Migration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment