From: Philip Withnall Date: Mon, 19 Jan 2026 18:12:39 +0000 (+0000) Subject: test: Expand sysupdate test to test updatectl update X-Git-Tag: v260-rc1~38^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7537717aed389ce2cf207fc2007c52f8b5e0efc7;p=thirdparty%2Fsystemd.git test: Expand sysupdate test to test updatectl update This further expands the sysupdate test to run the suite a fourth time, testing that `updatectl update` behaves the same as `sysupdate update` and `sysupdate acquire; sysupdate update --offline`. Signed-off-by: Philip Withnall --- diff --git a/test/units/TEST-72-SYSUPDATE.sh b/test/units/TEST-72-SYSUPDATE.sh index 3fe125a26a6..46968d4372d 100755 --- a/test/units/TEST-72-SYSUPDATE.sh +++ b/test/units/TEST-72-SYSUPDATE.sh @@ -21,6 +21,8 @@ if [[ ! -x "$SYSUPDATE" ]]; then exit 77 fi +have_updatectl=$([[ -x "$SYSUPDATED" ]] && command -v updatectl) + # Loopback devices may not be supported. They are used because sfdisk cannot # change the sector size of a file, and we want to test both 512 and 4096 byte # sectors. If loopback devices are not supported, we can only test one sector @@ -112,6 +114,16 @@ update_now() { elif [[ "$update_type" == "split" ]]; then "$SYSUPDATE" --verify=no acquire "$SYSUPDATE" --verify=no update + elif [[ "$update_type" == "updatectl" ]]; then + if $have_updatectl; then + systemctl start systemd-sysupdated + updatectl update + else + # Gracefully fall back to sysupdate + "$SYSUPDATE" --verify=no update + fi + else + exit 1 fi (! "$SYSUPDATE" --verify=no check-new) } @@ -157,7 +169,7 @@ verify_object_fields() { } for sector_size in "${SECTOR_SIZES[@]}"; do -for update_type in monolithic split-offline split; do +for update_type in monolithic split-offline split updatectl; do # Disk size of: # - 1MB for GPT # - 4 partitions of 2048 sectors each @@ -358,7 +370,7 @@ EOF # Create sixth version, update using updatectl and verify it replaced the # correct version new_version "$sector_size" v6 - if [[ -x "$SYSUPDATED" ]] && command -v updatectl; then + if $have_updatectl; then systemctl start systemd-sysupdated "$SYSUPDATE" --verify=no check-new updatectl update @@ -376,7 +388,7 @@ EOF # testing for specific output, but this will at least catch obvious crashes # and allow updatectl to run under the various sanitizers. We create a # component so that updatectl has multiple targets to list. - if [[ -x "$SYSUPDATED" ]] && command -v updatectl; then + if $have_updatectl; then mkdir -p /run/sysupdate.test.d/ cp "$CONFIGDIR/01-first.transfer" /run/sysupdate.test.d/01-first.transfer verify_object_fields "$(updatectl list 2>&1)"