pmaports/main/postmarketos-test/90-suspend-test.sh
Pablo Correa Gómez 4dbd727be9
main/postmarketos-test: do not hardcode 90 as a prefix for _test function
Instead, use shell globbing to find the corresponding file. This
allows using the function for the -unl0kr subpackage, and improves the
consistency between the filenames

Signed-off-by: Pablo Correa Gómez <pabloyoyoista@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7881>
2026-03-12 19:17:18 +00:00

22 lines
570 B
Bash

#!/bin/sh
# Validate suspend/resume cycle
echo "Checking that suspend works"
SLEEP_TIME=6
if [ ! -e /sys/class/rtc/rtc0 ]; then
echo "SKIP: No RTC found"
exit 0
fi
time=$(($(cat /sys/class/rtc/rtc0/since_epoch) + $SLEEP_TIME))
echo $time | tee /sys/class/rtc/rtc0/wakealarm
echo mem | tee /sys/power/state
sleep 3 # wait for the system to suspend
if [ $(cat /sys/class/rtc/rtc0/since_epoch) -lt $time ]; then
echo "FAIL: System did not suspend"
exit 1
fi
echo "PASS: System suspended and woke up again"
# The other failure mode is that we don't wake up again...