Commit 4505e215 authored by Kees Cook's avatar Kees Cook Committed by Greg Kroah-Hartman

selftest/firmware: Add selftest timeout in settings

The firmware tests would always time out for me. Add a correct timeout,
including details on how the value was reached. Additionally allow the
test harness to skip comments in settings files and report how long a
given timeout was.
Reviewed-by: default avatarSeongJae Park <sjpark@amazon.de>
Acked-by: default avatarScott Branden <scott.branden@broadcom.com>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20200724213640.389191-3-keescook@chromium.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2d38dbf8
# The async firmware timeout is set to 1 second (but ends up being effectively
# 2 seconds). There are 3 test configs, each done with and without firmware
# present, each with 2 "nowait" functions tested 5 times. Expected time for a
# normal execution should be 2 * 3 * 2 * 2 * 5 = 120 seconds for those alone.
# Additionally, fw_fallback may take 5 seconds for internal timeouts in each
# of the 3 configs, so at least another 15 seconds are needed. Add another
# 10 seconds for each testing config: 120 + 15 + 30
timeout=165
...@@ -53,6 +53,10 @@ run_one() ...@@ -53,6 +53,10 @@ run_one()
settings="$BASE_DIR/$DIR/settings" settings="$BASE_DIR/$DIR/settings"
if [ -r "$settings" ] ; then if [ -r "$settings" ] ; then
while read line ; do while read line ; do
# Skip comments.
if echo "$line" | grep -q '^#'; then
continue
fi
field=$(echo "$line" | cut -d= -f1) field=$(echo "$line" | cut -d= -f1)
value=$(echo "$line" | cut -d= -f2-) value=$(echo "$line" | cut -d= -f2-)
eval "kselftest_$field"="$value" eval "kselftest_$field"="$value"
...@@ -80,7 +84,7 @@ run_one() ...@@ -80,7 +84,7 @@ run_one()
echo "not ok $test_num $TEST_HDR_MSG # SKIP" echo "not ok $test_num $TEST_HDR_MSG # SKIP"
elif [ $rc -eq $timeout_rc ]; then \ elif [ $rc -eq $timeout_rc ]; then \
echo "#" echo "#"
echo "not ok $test_num $TEST_HDR_MSG # TIMEOUT" echo "not ok $test_num $TEST_HDR_MSG # TIMEOUT $kselftest_timeout seconds"
else else
echo "not ok $test_num $TEST_HDR_MSG # exit=$rc" echo "not ok $test_num $TEST_HDR_MSG # exit=$rc"
fi) fi)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment