Skip to content

Commit d0cfebd

Browse files
mcgrofgregkh
authored andcommitted
tools: firmware: check for distro fallback udev cancel rule
commit afb999cdef69148f366839e74470d8f5375ba5f1 upstream. Some distributions (Debian, OpenSUSE) have a udev rule in place to cancel all fallback mechanism uevents immediately. This would obviously make it hard to test against the fallback mechanism test interface, so we need to check for this. Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Signed-off-by: Amit Pundir <amit.pundir@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4afaa49 commit d0cfebd

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

tools/testing/selftests/firmware/fw_userhelper.sh

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,33 @@ trap "test_finish" EXIT
6464
echo "ABCD0123" >"$FW"
6565
NAME=$(basename "$FW")
6666

67+
DEVPATH="$DIR"/"nope-$NAME"/loading
68+
6769
# Test failure when doing nothing (timeout works).
68-
echo 1 >/sys/class/firmware/timeout
69-
echo -n "$NAME" >"$DIR"/trigger_request
70+
echo -n 2 >/sys/class/firmware/timeout
71+
echo -n "nope-$NAME" >"$DIR"/trigger_request 2>/dev/null &
72+
73+
# Give the kernel some time to load the loading file, must be less
74+
# than the timeout above.
75+
sleep 1
76+
if [ ! -f $DEVPATH ]; then
77+
echo "$0: fallback mechanism immediately cancelled"
78+
echo ""
79+
echo "The file never appeared: $DEVPATH"
80+
echo ""
81+
echo "This might be a distribution udev rule setup by your distribution"
82+
echo "to immediately cancel all fallback requests, this must be"
83+
echo "removed before running these tests. To confirm look for"
84+
echo "a firmware rule like /lib/udev/rules.d/50-firmware.rules"
85+
echo "and see if you have something like this:"
86+
echo ""
87+
echo "SUBSYSTEM==\"firmware\", ACTION==\"add\", ATTR{loading}=\"-1\""
88+
echo ""
89+
echo "If you do remove this file or comment out this line before"
90+
echo "proceeding with these tests."
91+
exit 1
92+
fi
93+
7094
if diff -q "$FW" /dev/test_firmware >/dev/null ; then
7195
echo "$0: firmware was not expected to match" >&2
7296
exit 1

0 commit comments

Comments
 (0)