1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
summary: Check that the core-fixup-sh script works
details: |
Ubuntu Core systems previous to UC20 have a service which is used to fix
broken uboot environments. This has been added because of this issue
https://bugs.launchpad.net/snappy/+bug/1769669
This test verifies that having a broken uboot environment (two uboot.env files),
running the core-fixup script is able to correct the problem and fix the image.
# currently no fixups for UC20, so don't run this test there
systems: [ubuntu-core-1*]
restore: |
umount /boot/uboot
execute: |
echo "Ensure we have a clean and writable /boot/uboot to mess around"
mount -t tmpfs none /boot/uboot
touch /boot/uboot/uboot.env.unrelated
touch /boot/uboot/unrelated.uboot.env
touch /boot/uboot/uboot.env
systemctl restart snapd.core-fixup.service
if [ ! -f /boot/uboot/uboot.env.unrelated ] || [ ! -f /boot/uboot/unrelated.uboot.env ]; then
echo "snapd.core-fixup.service destroyed unrelated files"
exit 1
fi
if [ ! -f /boot/uboot/uboot.env ]; then
echo "snapd.core-fixup.service destroyed the uboot.env file"
exit 1
fi
umount /boot/uboot
echo "Now test with the real corrupted image"
# We use tar instead of unxz because it is available in all the core systems
tar zxvf test.img.tar.gz
mount -t vfat test.img /boot/uboot
n=$(find /boot/uboot -name uboot.env| wc -l)
if [ "$n" != "2" ]; then
echo "Image not broken in the right way, expected two uboot.env files"
ls /boot/uboot
exit 1
fi
echo "Trigger cleanup"
systemctl restart snapd.core-fixup.service
n=$(find /boot/uboot -name uboot.env| wc -l)
if [ "$n" != "1" ]; then
echo "Image not repaired"
ls /boot/uboot
exit 1
fi
|