pmaports/main/unl0kr/30-unl0kr-test.sh
Caleb Connolly c99a360a6e
unl0kr: add pmtest (MR 4420)
Add a test for CI that:
* ensures unl0kr runs for 10 seconds without crashing
* ensures that it doesn't print any errors

This sure isn't an "ideal" test, but it at least validates that the
framebuffer interface doesn't die horribly...

With a little more effort we should be able to run unl0kr and then pull
the framebuffer and check it against some known good unl0kr screenshot.

Signed-off-by: Caleb Connolly <caleb@connolly.tech>
2023-10-31 19:54:17 +00:00

30 lines
638 B
Bash

#!/bin/sh
# Checks that unl0kr starts properly and doesn't crash or exit
# immediately.
echo "Checking that unl0kr starts properly"
SECS=5
unl0kr -V
TIME=$(date +%s)
timeout $SECS unl0kr -v 2>&1 | tee /tmp/unl0kr.log
CODE=$?
EXIT_TIME=$(date +%s)
ELAPSED=$(($EXIT_TIME - $TIME))
if grep -i "error" /tmp/unl0kr.log; then
echo "unl0kr reported an error!"
exit 1
fi
if [ $CODE -eq 0 ] && [ $ELAPSED -eq $SECS ]; then
echo "PASS: unl0kr ran for $SECS without exiting!"
exit 0
fi
ELAPSED=$(($EXIT_TIME - $TIME))
echo "unl0kr exited with code $? after $ELAPSED seconds (expected timeout after $SECS)"
echo "SKIP: broken test"
exit 0