From: Richard Maw Date: Sat, 17 Feb 2024 21:42:45 +0000 (+0000) Subject: TEST-35-LOGIN: Handle multiple lock messages per sleep X-Git-Tag: v256-rc2~139^2~17 X-Git-Url: http://git-history.diyao.me/?a=commitdiff_plain;h=37029ce7691050e59aeeb0700045b2d495604111;p=systemd%2F.git TEST-35-LOGIN: Handle multiple lock messages per sleep If 3 lock messages get sent when going to sleep then we can falsely assume we have woken up if we only assume we have at least two so checking we have more than we did before sleeping addresses that issue. --- diff --git a/test/units/testsuite-35.sh b/test/units/testsuite-35.sh index e9af67f358..4ca312d6ba 100755 --- a/test/units/testsuite-35.sh +++ b/test/units/testsuite-35.sh @@ -524,11 +524,15 @@ EOF # least one session, so minimum of 2 "Lock" signals must have been sent. timeout 35 bash -c "while [[ \"\$(journalctl -b -u systemd-logind.service --since=$ts | grep -c 'Sent message type=signal .* member=Lock')\" -lt 1 ]]; do sleep 1; done" + # We need to know that a new message was sent after waking up, + # so we must track how many happened before sleeping to check we have extra. + locks="$(journalctl -b -u systemd-logind.service --since="$ts" | grep -c 'Sent message type=signal .* member=Lock')" + # Wakeup touch /dev/tty2 # Wait again - timeout 35 bash -c "while [[ \"\$(journalctl -b -u systemd-logind.service --since=$ts | grep -c 'Sent message type=signal .* member=Lock')\" -lt 2 ]]; do sleep 1; done" + timeout 35 bash -c "while [[ \"\$(journalctl -b -u systemd-logind.service --since=$ts | grep -c 'Sent message type=signal .* member=Lock')\" -lt $((locks + 1)) ]]; do sleep 1; done" if [[ "$(journalctl -b -u systemd-logind.service --since="$ts" | grep -c 'System idle. Will be locked now.')" -lt 2 ]]; then echo >&2 "System haven't entered idle state at least 2 times."