Thursday, 6 February 2020

Run Focal i386 autopkgtests locally

The i386 removal works great and after the dust settled it comes mostly down to adding a few more hints in recent weeks. But sometimes there are i386 tests that are valid to run, but fail and need debugging.

If you happen to face such a case the old common pattern won't work anymore:

$ sudo autopkgtest-buildvm-ubuntu-cloud -a i386 -r bionic -s 15G
$ sudo ~/work/autopkgtest/autopkgtest/runner/autopkgtest <YOUR>.dsc \
  -- qemu ~/work/autopkgtest-focal-amd64.img

The above was fine in the past, but with Focal you that won't work due to:
$ sudo autopkgtest-buildvm-ubuntu-cloud -a i386 -r focal -s 15G
No image exists for this release/architecture

Steve was so kind to help me with the case I was facing and after a bit I learned how to locally run my i386 tests in a VM and wanted to share that with you.

First of all, you probably need a more recent autopkgtest to get the features you need.
So you need to clone git and run it from there.

$ git clone git+ssh://
[for me that is in ~/work/autopkgtest/autopkgtest]

And then - since you only have amd64 images - to run it you have to add
# to select the architecture for the test
  -a i386
# to get the arch available in the test env before the testing starts
  --setup-commands="dpkg --add-architecture i386; apt-get update"

Overall for me it then worked like:
$ sudo ~/work/autopkgtest/autopkgtest/runner/autopkgtest <YOUR>.dsc \
  --setup-commands="dpkg --add-architecture i386; apt-get update" -a i386 \
  -- qemu ~/work/autopkgtest-focal-amd64.img

I hope this helps some other people as well.
And if anyone knows more tweaks to get this local i386 test to run even better please reply and let us all know.

P.S. of course my commandline never is that simple, the above is just for illustration.
In reality it was more like:
$ sudo ~/work/autopkgtest/autopkgtest/runner/autopkgtest --no-built-binaries --apt-upgrade --apt-pocket=proposed=src:re2c --setup-commands="dpkg --add-architecture i386; apt-get update" --shell-fail -a i386 re2c_1.3-1.dsc -- qemu --qemu-options='-cpu host' --ram-size=2048 --cpus 2 ~/work/autopkgtest-focal-amd64.img

Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd