]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Revert "TEST-82-SOFTREBOOT: add test case for uevents generated during soft-reboot"
authorLuca Boccassi <luca.boccassi@gmail.com>
Tue, 20 May 2025 13:13:05 +0000 (14:13 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 20 May 2025 14:52:01 +0000 (15:52 +0100)
This reverts commit e8b3b46921ee5aacd9f5d5132c64af79b685d941.

Post-merge review found problems:
https://github.com/systemd/systemd/pull/37222#pullrequestreview-2848299600

test/units/TEST-82-SOFTREBOOT.sh

index 261dcb9c6100a2edc0867d2691eaf7daaa7ef315..bf3cfb5276dbf212c67b9f488212b7b1703aa627 100755 (executable)
@@ -34,56 +34,6 @@ if [[ -L /run/nextroot ]]; then
     rm -f /run/nextroot
 fi
 
-trigger_uevent() {
-    local rule=/run/udev/rules.d/99-softreboot.rules
-
-    if [[ ! -f "$rule" ]]; then
-        mkdir -p /run/udev/rules.d
-        cat >"$rule" <<EOF
-SUBSYSTEM!="mem", GOTO="end"
-KERNEL!="null", GOTO="end"
-ACTION=="remove", GOTO="end"
-
-IMPORT{db}="HISTORY"
-IMPORT{program}="/bin/bash -c 'systemctl show --property=SoftRebootsCount'"
-ENV{HISTORY}+="%E{ACTION}_%E{SEQNUM}_%E{SoftRebootsCount}"
-
-LABEL="end"
-EOF
-        udevadm control --reload
-    fi
-
-    systemd-run \
-        --unit=TEST-82-SOFTREBOOT-trigger.service \
-        --property DefaultDependencies=no \
-        --property Conflicts=soft-reboot.target \
-        --property Before=soft-reboot.target \
-        --property Before=systemd-soft-reboot.service \
-        --property Before=systemd-udevd.service \
-        --property RemainAfterExit=yes \
-        --property 'ExecStop=udevadm trigger --action bind /dev/null' \
-        true
-}
-
-check_device_property() {
-    local expected_count=${1:?}
-
-    udevadm info --no-pager /dev/null
-
-    local action seqnum softreboot_count
-    local previous_seqnum=0
-    local count=0
-    while read -r action seqnum softreboot_count; do
-        test "$seqnum" -gt "$previous_seqnum"
-        assert_eq "$action" "bind"
-        assert_eq "$softreboot_count" "$((++count))"
-
-        previous_seqnum="$seqnum"
-    done < <(udevadm info -q property --property=HISTORY --value /dev/null | sed -e 's/ /\n/g; s/_/ /g')
-
-    assert_eq "$count" "$expected_count"
-}
-
 systemd-analyze log-level debug
 
 export SYSTEMD_LOG_LEVEL=debug
@@ -120,8 +70,6 @@ if [ -f /run/TEST-82-SOFTREBOOT.touch3 ]; then
     journalctl -o short-monotonic --no-hostname --grep '(will soft-reboot|KILL|corrupt)'
     assert_eq "$(journalctl -q -o short-monotonic -u systemd-journald.service --grep 'corrupt')" ""
 
-    check_device_property 3
-
     # All succeeded, exit cleanly now
 
 elif [ -f /run/TEST-82-SOFTREBOOT.touch2 ]; then
@@ -162,9 +110,6 @@ elif [ -f /run/TEST-82-SOFTREBOOT.touch2 ]; then
     # Restart the unit that is not supposed to survive
     systemd-run --collect --service-type=exec --unit=TEST-82-SOFTREBOOT-nosurvive.service sleep infinity
 
-    check_device_property 2
-    trigger_uevent
-
     # Now issue the soft reboot. We should be right back soon.
     touch /run/TEST-82-SOFTREBOOT.touch3
     systemctl --no-block soft-reboot
@@ -231,9 +176,6 @@ elif [ -f /run/TEST-82-SOFTREBOOT.touch ]; then
         systemd-run --wait true
     done
 
-    check_device_property 1
-    trigger_uevent
-
     # Now issue the soft reboot. We should be right back soon. Given /run/nextroot exists, we should
     # automatically do a softreboot instead of normal reboot.
     touch /run/TEST-82-SOFTREBOOT.touch2
@@ -327,8 +269,6 @@ EOF
         systemd-run --wait false || true
     done
 
-    trigger_uevent
-
     # Now issue the soft reboot. We should be right back soon.
     touch /run/TEST-82-SOFTREBOOT.touch
     systemctl --no-block --check-inhibitors=yes soft-reboot