Stress testing suspend on Linux
Here’s a script you can use to stress test suspend on Linux:
#!/bin/sh
# Watch kernel logs for the word `corrupt`
dmesg -w | grep --color -i corrupt &
echo "Starting stress test in 5 seconds..."
sleep 5
# Stress test by repeatedly putting computer to sleep for 10s
for i in $(seq 100); do
echo "Iteration #$i..."
rtcwake -m mem -s 10
sleep 10
done
Save the file as stress-test-suspend.sh
, then run:
$ chmod +x stress-test-suspend.sh
$ sudo ./stress-test-suspend.sh
The idea comes from the page Best practice to debug Linux* suspend/hibernate issues.