Skip to content

Commit 4505e21

Browse files
keesgregkh
authored andcommitted
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: SeongJae Park <[email protected]> Acked-by: Scott Branden <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2d38dbf commit 4505e21

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# The async firmware timeout is set to 1 second (but ends up being effectively
2+
# 2 seconds). There are 3 test configs, each done with and without firmware
3+
# present, each with 2 "nowait" functions tested 5 times. Expected time for a
4+
# normal execution should be 2 * 3 * 2 * 2 * 5 = 120 seconds for those alone.
5+
# Additionally, fw_fallback may take 5 seconds for internal timeouts in each
6+
# of the 3 configs, so at least another 15 seconds are needed. Add another
7+
# 10 seconds for each testing config: 120 + 15 + 30
8+
timeout=165

tools/testing/selftests/kselftest/runner.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ run_one()
5353
settings="$BASE_DIR/$DIR/settings"
5454
if [ -r "$settings" ] ; then
5555
while read line ; do
56+
# Skip comments.
57+
if echo "$line" | grep -q '^#'; then
58+
continue
59+
fi
5660
field=$(echo "$line" | cut -d= -f1)
5761
value=$(echo "$line" | cut -d= -f2-)
5862
eval "kselftest_$field"="$value"
@@ -80,7 +84,7 @@ run_one()
8084
echo "not ok $test_num $TEST_HDR_MSG # SKIP"
8185
elif [ $rc -eq $timeout_rc ]; then \
8286
echo "#"
83-
echo "not ok $test_num $TEST_HDR_MSG # TIMEOUT"
87+
echo "not ok $test_num $TEST_HDR_MSG # TIMEOUT $kselftest_timeout seconds"
8488
else
8589
echo "not ok $test_num $TEST_HDR_MSG # exit=$rc"
8690
fi)

0 commit comments

Comments
 (0)