Skip to content
Snippets Groups Projects
Commit 4d68aa44 authored by Emanuele Aina's avatar Emanuele Aina Committed by Frederic Danis
Browse files

apertis-update-manager-rollback: Merge the amd64 test


Merge the amd64 steps in the main testcase to avoid duplication.

Signed-off-by: Emanuele Aina's avatarEmanuele Aina <emanuele.aina@collabora.com>
parent 10ed7143
No related branches found
No related tags found
2 merge requests!435apertis-update-manager-rollback: Merge the amd64 test,!387apertis-update-manager-rollback: Merge the amd64 test
metadata:
name: apertis-update-manager-amd64-rollback
format: "Apertis Test Definition 1.0"
image-types:
fixedfunction: [ amd64 ]
image-deployment:
- OSTree
type: functional
exec-type: manual
priority: low
maintainer: "Apertis Project"
description: "Test the automatic rollback and blacklist mechanism of apertis-update-manager."
resources:
- "A static encrypted update bundle file of the same architecture, variant and version as the testing image"
- "A Fat32 USB flash drive, preloaded with the encrypted update bundle at the root of the disk"
- "The latest static encrypted update file can be downloaded at the same location than the Apertis image. It has the same basename, and a '.delta.enc' extension"
- "The static encrypted update file should be copied to the flash drive using the name 'static-update.bundle.enc'."
- "A PC must be connected to DUT serial port"
expected:
- "UEFI is able to detect rollback situation"
- "UEFI is able to use rollback configuration for bootloader"
- 'The "failed" update is rolled back'
- '"Failed" update is marked as blacklisted'
- 'Apertis-update-manager is able to detect blacklisted update and refuse to update the system with it'
run:
steps:
- "Check the initial deployment"
- $ sudo ostree admin status
- "Prepare the copy of commit and deploy to allow the upgrade to the same version"
- "Command below shows you an initial commit ID, for instance"
- |
$ export BOOTID=$(sudo ostree admin status | sed -n -e 's/^\* apertis \([0-9a-f]*\)\.[0-9]$/\1/p'); echo $BOOTID
- "Get the Collection ID and ref"
- $ export CID=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 1 -d ' '); echo COLLECTION_ID=$CID
- $ export REF=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 2 -d ' '); echo REF=$REF
- "Create the list of files to skip and ensure there are some files in these directories"
- $ ls -1d /usr/share/locale /usr/share/man /usr/share/zoneinfo > /tmp/skip
- $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
- "Create the commit with changed timestamp and skipped list from above to allow upgrade with recent update file"
- |
$ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago" --skip-list=/tmp/skip); echo "New commit: $NEWID"
- "Deploy the prepared commit"
- $ sudo ostree admin upgrade --allow-downgrade --deploy-only --override-commit=$NEWID --reboot
- "Wait until the system is booted again and check the deployment"
- $ sudo ostree admin status
- "The booted commit (started with '*') must have ID which we prepare and the initial commit ID should be marked as '(rollback)'"
- "Check booted deployment have no file objects which we skip"
- $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
- "Remove the initial deployment"
- $ sudo ostree admin undeploy 1
- "Reboot the system"
- "Check the current deployment"
- $ sudo ostree admin status
- "Start the user interface agent with mode preventing automatic system reboot after update"
- $ sudo updatectl --register-upgrade-handler &
- "Plug the USB flash drive into the device"
- "The update starts automatically"
- "After the update, the device does *not* reboot automatically"
- "Check that the user interface agent reports the pending update"
- |
>** Message: Upgrade status: Checking
** Message: An upgrade is pending
- "Remove the USB flash drive"
- "Check if there is pending deployment and reboot the DUT"
- $ sudo ostree admin status
- $ sudo reboot
- "When the >Shell prompt is seen execute bootx64"
- "Wait for 2 seconds and press the reboot button"
- "Repeat this 4 times followed by a reset and 1 more time to let it boot completely"
- "To check the bootcount status enter FS0:, then ls"
- |
$ Shell> FS0:
- |
$ FS0:\> ls
- |
>Directory of: FS0:\
12/14/2020 03:15 <DIR> 512 EFI
12/15/2020 09:21 <DIR> 512 loader
12/15/2020 08:37 <DIR> 512 ostree
0 File(s) 0 bytes
3 Dir(s)
- |
$ FS0:\> ls loader\entries
- |
>Directory of: FS0:\loader\entries\
12/14/2020 03:15 <DIR> 1,024 .
12/14/2020 03:15 <DIR> 512 ..
12/15/2020 08:37 565 ostree-0-1.conf
12/15/2020 08:37 565 ostree-0-2+0-4.conf
2 File(s) 1,130 bytes
2 Dir(s)
- "boot count is correctly set for ostree-0-2 +0-4 means there is 0 left boot and 4 tries"
- "Wait for system boot"
- "Wait a few seconds after the boot to allow ostree to undeploy the deployment. Check the update has been rolled back and that only single deployment exists."
- $ sudo ostree admin status
- "Start the user interface agent"
- $ sudo updatectl &
- "Plug the USB flash drive with the same update file into the device"
- "Check that the user interface agent reports the system is up to update"
- |
>** Message: 09:21:45.026: Upgrade status: Checking
** Message: 09:21:45.300: System is up to date
- "Check the journal log should mention that the update ID has been blacklisted"
- $ sudo journalctl -ef --unit apertis-update-manager
- |
>May 01 09:21:45 apertis apertis-update-[363]: mount added : /media/APERTIS
May 01 09:21:45 apertis apertis-update-[363]: mount added : /media/update
May 01 09:21:45 apertis apertis-update-[363]: Ostree static delta starting
May 01 09:21:45 apertis apertis-update-[363]: Metadata read from commit '710dbec2943510e4deb279cd6738a4a1a5b589eb6c4976e486d056e0308a02e1': {'ostree.ref-binding': <['apertis/v2023dev2/armhf-uboot/fixedfunction']>, 'ostree.collection-binding': <'org.apertis.os'>}
May 01 09:21:45 apertis apertis-update-[363]: Revision '710dbec2943510e4deb279cd6738a4a1a5b589eb6c4976e486d056e0308a02e1' is marked as blacklisted; skipping
May 01 09:21:45 apertis apertis-update-[363]: Ostree already up to date
......@@ -2,7 +2,7 @@ metadata:
name: apertis-update-manager-rollback
format: "Apertis Test Definition 1.0"
image-types:
fixedfunction: [ armhf, arm64 ]
fixedfunction: [ amd64, armhf, arm64 ]
image-deployment:
- OSTree
type: functional
......@@ -20,8 +20,8 @@ metadata:
- "A PC must be connected to DUT serial port"
expected:
- "U-Boot is able to detect rollback situation"
- "U-Boot is able to use rollback configuration for bootloader"
- "The system is able to detect rollback situation"
- "The system is able to use rollback configuration for bootloader"
- 'The "failed" update is rolled back'
- '"Failed" update is marked as blacklisted'
- 'Apertis-update-manager is able to detect blacklisted update and refuse to update the system with it'
......@@ -37,7 +37,7 @@ run:
- "Get the Collection ID and ref"
- $ export CID=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 1 -d ' '); echo COLLECTION_ID=$CID
- $ export REF=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 2 -d ' '); echo REF=$REF
- "Create the list of files to skip and enshure there are some files in these directories"
- "Create the list of files to skip and ensure there are some files in these directories"
- $ ls -1d /usr/share/locale /usr/share/man /usr/share/zoneinfo > /tmp/skip
- $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
- "Create the commit with changed timestamp and skipped list from above to allow upgrade with recent update file"
......@@ -68,15 +68,12 @@ run:
- "Check if there is pending deployment and reboot the DUT"
- $ sudo ostree admin status
- $ sudo reboot
- "In `U-Boot` console check the status of upgrade"
- $ printenv bootcount bootlimit
- |
>bootcount=1
bootlimit=3
- "Restart the device by pressing the restart button before the boot finishes."
- "Restart the device a first time by pressing the restart button before the boot finishes."
- "Restart the device a second time by pressing the restart button before the boot finishes."
- "Restart the device a third time by pressing the restart button before the boot finishes."
- "U-Boot should be able to detect the rollback mode and boot the system in rollback mode"
- "The system should be able to detect the rollback mode and boot the system in rollback mode"
- On platforms using U-Boot (iMX.6 SABRELite, Raspberry Pi, R-Car, etc.),
Boot should warn about initiating the rollback boot (altbootcmd)
- |
>Warning: Bootlimit (3) exceeded. Using altbootcmd.
Hit any key to stop autoboot: 0
......@@ -85,6 +82,21 @@ run:
Scanning mmc 0:1...
Found /extlinux/extlinux-rollback.conf
Retrieving file: /extlinux/extlinux-rollback.conf
- On platforms using UEFI (amd64), enter the UEFI shell to list the loader entries
- |
$ Shell> FS0:
$ FS0:\> ls loader\entries
- |
>Directory of: FS0:\loader\entries\
12/14/2020 03:15 <DIR> 1,024 .
12/14/2020 03:15 <DIR> 512 ..
12/15/2020 08:37 565 ostree-0-1.conf
12/15/2020 08:37 565 ostree-0-2+0-3.conf
2 File(s) 1,130 bytes
2 Dir(s)
- |
$ FS0:\> bootx64
- "The boot count should be set to ostree-0-2 +0-3 which means there is 0 left boot and 3 tries"
- "Wait for system boot"
- "Wait a few seconds after the boot to allow ostree to undeploy the deployment. Check the update has been rolled back and that only single deployment exists."
- $ sudo ostree admin status
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment