From 2ffc8b23f08a08ad7fde0fddf2ed3c7dd12f55bc Mon Sep 17 00:00:00 2001 From: Adrian Vovk Date: Tue, 2 Jul 2024 14:56:27 -0400 Subject: [PATCH] sysupdate: Add tests for optional features Makes sure we don't regress on #33343 and #33344 --- test/units/TEST-72-SYSUPDATE.sh | 70 +++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 8 deletions(-) diff --git a/test/units/TEST-72-SYSUPDATE.sh b/test/units/TEST-72-SYSUPDATE.sh index 4dcdf5dced..0598ef2c39 100755 --- a/test/units/TEST-72-SYSUPDATE.sh +++ b/test/units/TEST-72-SYSUPDATE.sh @@ -72,6 +72,9 @@ new_version() { # Create a random extra payload echo $RANDOM >"$WORKDIR/source/uki-extra-$version.efi" + # Create a random optional payload + echo $RANDOM >"$WORKDIR/source/optional-$version.efi" + # Create tarball of a directory mkdir -p "$WORKDIR/source/dir-$version" echo $RANDOM >"$WORKDIR/source/dir-$version/foo.txt" @@ -155,7 +158,7 @@ EOF mkdir -p "$d" done - cat >"$CONFIGDIR/01-first.conf" <"$CONFIGDIR/01-first.transfer" <"$CONFIGDIR/02-second.conf" <"$CONFIGDIR/02-second.transfer" <"$CONFIGDIR/03-third.conf" <"$CONFIGDIR/03-third.transfer" <"$CONFIGDIR/04-fourth.conf" <"$CONFIGDIR/04-fourth.transfer" <"$CONFIGDIR/05-fifth.conf" <"$CONFIGDIR/05-fifth.transfer" <"$CONFIGDIR/optional.feature" <"$CONFIGDIR/99-optional.transfer" < "$CONFIGDIR/optional.feature.d/enable.conf" + "$SYSUPDATE" --offline list v5 | grep -q "incomplete" + update_now + "$SYSUPDATE" --offline list v5 | grep -qv "incomplete" + verify_version "$blockdev" "$sector_size" v3 1 + verify_version_current "$blockdev" "$sector_size" v5 2 + test -f "$WORKDIR/xbootldr/EFI/Linux/uki_v5.efi.extra.d/optional.efi" + + # And now let's disable it and make sure it gets cleaned up + rm -r "$CONFIGDIR/optional.feature.d" + (! "$SYSUPDATE" --verify=no check-new) + "$SYSUPDATE" vacuum + "$SYSUPDATE" --offline list v5 | grep -qv "incomplete" + verify_version "$blockdev" "$sector_size" v3 1 + verify_version_current "$blockdev" "$sector_size" v5 2 + test ! -f "$WORKDIR/xbootldr/EFI/Linux/uki_v5.efi.extra.d/optional.efi" + # Create sixth version, update using updatectl and verify it replaced the # correct version new_version "$sector_size" v6 @@ -299,7 +345,7 @@ EOF # component so that updatectl has multiple targets to list. if [[ -x "$SYSUPDATED" ]] && command -v updatectl; then mkdir -p /run/sysupdate.test.d/ - cp "$CONFIGDIR/01-first.conf" /run/sysupdate.test.d/01-first.conf + cp "$CONFIGDIR/01-first.transfer" /run/sysupdate.test.d/01-first.transfer updatectl list updatectl list host updatectl list host@v6 @@ -315,7 +361,7 @@ EOF # see above) new_version "$sector_size" v7 - cat >"$CONFIGDIR/02-second.conf" <"$CONFIGDIR/02-second.transfer" <"$CONFIGDIR/03-third.conf" <"$CONFIGDIR/03-third.transfer" <