The officially official Devuan Forum!

You are not logged in.

#1 2021-05-08 09:42:31

emojifreak
Member
Registered: 2020-10-06
Posts: 15  

autopkgtest qemu test

autopkgtest is a tool for automated tests of Debian derivatives, as explained at
https://www.kali.org/docs/development/c … ime-tests/

The upstream (Debian/Ubuntu) autopkgtest assumes upstart or systemd as /sbin/init,
and some trick is needed to run automated tests on Devuan packages.
The following is steps to build a qemu testbed (other methods for running testbeds are lxc and schroot).

1. Install Devuan Chimaera (I tested only on amd64). Beowulf probably does not work.
2.

apt-get install autopkgtest vmdb2 qemu-system-x86 qemu-system-gui qemu-utils ovmf seabios ipxe-qemu dosfstools autodep8 arch-test

3.

 autopkgtest-build-qemu --arch amd64 --mirror http://deb.devuan.org/merged --script /root/setup-devuan-autopkgtest.sh --size 25G ceres /var/tmp/ceres-amd64.qcow2

A testbed of Devuan Ceres amd64 is made. This command should produce the following output:

Load spec file /tmp/tmprmuimhb9/vmdb2.yaml
Exec: ['dpkg', '--print-architecture']
Exec: ['qemu-img', 'create', '-f', 'raw', '/var/tmp/ceres-amd64.qcow2.raw', '25G']
Exec: ['parted', '-s', '/var/tmp/ceres-amd64.qcow2.raw', 'mklabel', 'msdos']
Exec: ['parted', '-m', '/var/tmp/ceres-amd64.qcow2.raw', 'print']
Exec: ['parted', '-s', '/var/tmp/ceres-amd64.qcow2.raw', '--', 'mkpart', 'primary', 'ext2', '0%', '100%']
Exec: ['parted', '-m', '/var/tmp/ceres-amd64.qcow2.raw', 'print']
Exec: ['kpartx', '-asv', '/var/tmp/ceres-amd64.qcow2.raw']
remembering /dev/mapper/loop0p1 as root
Exec: ['/sbin/mkfs', '-t', 'ext4', '/dev/mapper/loop0p1']
Exec: ['mount', '/dev/mapper/loop0p1', '/tmp/tmpqwh8w58o']
Exec: ['debootstrap', '--variant', '-', 'ceres', '/tmp/tmpqwh8w58o', 'http://deb.devuan.org/merged']
Exec: ['chroot', '/tmp/tmpqwh8w58o', 'apt-get', 'update']
Exec: ['chroot', '/tmp/tmpqwh8w58o', 'apt-get', 'update']
Exec: ['chroot', '/tmp/tmpqwh8w58o', 'apt-get', '-y', '--no-show-progress', 'install', 'eatmydata']
Exec: ['chroot', '/tmp/tmpqwh8w58o', 'eatmydata', 'apt-get', 'update']
Exec: ['chroot', '/tmp/tmpqwh8w58o', 'eatmydata', 'apt-get', '-y', '--no-show-progress', 'install', 'linux-image-amd64', 'ifupdown']
Exec: ['chroot', '/tmp/tmpqwh8w58o', 'apt-get', 'clean']
Installing GRUB for BIOS
Exec: ['mount', '--bind', '/dev', '/tmp/tmpqwh8w58o/dev']
Exec: ['mount', '--bind', '/sys', '/tmp/tmpqwh8w58o/sys']
Exec: ['mount', '--bind', '/proc', '/tmp/tmpqwh8w58o/proc']
Exec: ['chroot', '/tmp/tmpqwh8w58o', 'apt-get', '-y', '--no-show-progress', 'install', 'grub-pc']
Exec: ['chroot', '/tmp/tmpqwh8w58o', 'grub-mkconfig', '-o', '/boot/grub/grub.cfg']
Exec: ['chroot', '/tmp/tmpqwh8w58o', 'grub-install', '--target=i386-pc', '--no-nvram', '--force-extra-removable', '--no-floppy', '--modules=part_msdos part_gpt', '--grub-mkdevicemap=/boot/grub/device.map', '/dev/loop0']
Exec: ['chroot', '/tmp/tmpqwh8w58o', 'sh', '-ec', "passwd --delete root\nuseradd --home-dir /home/user --create-home user\npasswd --delete user\necho host > /etc/hostname\necho '127.0.1.1\thost' >> /etc/hosts"]
Exec: ['sh', '-ec', 'rootdev=$(ls -1 /dev/mapper/loop* | sort | tail -1)\nuuid=$(blkid -c /dev/null -o value -s UUID "$rootdev")\necho "UUID=$uuid / ext4 errors=remount-ro 0 1" > "$ROOT/etc/fstab"']
Exec: ['sh', '-ec', '/usr/share/autopkgtest/setup-commands/setup-testbed "$ROOT"']
Exec: ['sh', '-ec', '/root/setup-devuan-autopkgtest.sh "$ROOT"']
Exec: ['kpartx', '-dsv', '/var/tmp/ceres-amd64.qcow2.raw']
All went fine.

4. Run test scripts in a selected package on the made testbed, e.g.

 autopkgtest -u user -B gpsd  -- qemu /var/tmp/ceres-amd64.qcow2 

.

The script setup-devuan-autopkgtest.sh in Step 3 is

#!/bin/sh
chroot $1 apt-get -q -y update
chroot $1 apt-get -q -y --purge --autoremove install sysvinit-core sysvinit sysvinit-utils sysv-rc init initscripts devuan-keyring debian-keyring gpg libpam-elogind eudev
echo 'S0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100' >>$1/etc/inittab

Last edited by emojifreak (2021-05-08 09:48:09)

Offline

Board footer