Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1565103

[PATCH 3/7] tools: firmware: check for distro fallback udev cancel rule

From "Luis R. Rodriguez" <mcgrof@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 3/7] tools: firmware: check for distro fallback udev cancel rule
Date 2017-01-23 17:20 +0100
Message-ID <t2PvA-cN-33@gated-at.bofh.it> (permalink)
References <t14Iq-91-9@gated-at.bofh.it> <t2Pvz-cN-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 tools/testing/selftests/firmware/fw_userhelper.sh | 28 +++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/firmware/fw_userhelper.sh b/tools/testing/selftests/firmware/fw_userhelper.sh
index b9983f8e09f6..01c626a1f226 100755
--- a/tools/testing/selftests/firmware/fw_userhelper.sh
+++ b/tools/testing/selftests/firmware/fw_userhelper.sh
@@ -64,9 +64,33 @@ trap "test_finish" EXIT
 echo "ABCD0123" >"$FW"
 NAME=$(basename "$FW")
 
+DEVPATH="$DIR"/"nope-$NAME"/loading
+
 # Test failure when doing nothing (timeout works).
-echo 1 >/sys/class/firmware/timeout
-echo -n "$NAME" >"$DIR"/trigger_request
+echo -n 2 >/sys/class/firmware/timeout
+echo -n "nope-$NAME" >"$DIR"/trigger_request 2>/dev/null &
+
+# Give the kernel some time to load the loading file, must be less
+# than the timeout above.
+sleep 1
+if [ ! -f $DEVPATH ]; then
+	echo "$0: fallback mechanism immediately cancelled"
+	echo ""
+	echo "The file never appeared: $DEVPATH"
+	echo ""
+	echo "This might be a distribution udev rule setup by your distribution"
+	echo "to immediately cancel all fallback requests, this must be"
+	echo "removed before running these tests. To confirm look for"
+	echo "a firmware rule like /lib/udev/rules.d/50-firmware.rules"
+	echo "and see if you have something like this:"
+	echo ""
+	echo "SUBSYSTEM==\"firmware\", ACTION==\"add\", ATTR{loading}=\"-1\""
+	echo ""
+	echo "If you do remove this file or comment out this line before"
+	echo "proceeding with these tests."
+	exit 1
+fi
+
 if diff -q "$FW" /dev/test_firmware >/dev/null ; then
 	echo "$0: firmware was not expected to match" >&2
 	exit 1
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv2] firmware: Correct handling of fw_state_wait_timeout() return value Jakub Kicinski <jakub.kicinski@netronome.com> - 2017-01-17 16:40 +0100
  Re: [PATCHv2] firmware: Correct handling of fw_state_wait_timeout()  return value "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-17 17:20 +0100
    Re: [PATCHv2] firmware: Correct handling of fw_state_wait_timeout()  return value "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-17 17:30 +0100
      Re: [PATCHv2] firmware: Correct handling of fw_state_wait_timeout()  return value Jakub Kicinski <jakub.kicinski@netronome.com> - 2017-01-17 17:40 +0100
        Re: [PATCHv2] firmware: Correct handling of fw_state_wait_timeout()  return value "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-17 18:40 +0100
          Re: [PATCHv2] firmware: Correct handling of fw_state_wait_timeout()  return value Jakub Kicinski <jakub.kicinski@netronome.com> - 2017-01-17 19:10 +0100
            Re: [PATCHv2] firmware: Correct handling of fw_state_wait_timeout()  return value Jakub Kicinski <jakub.kicinski@netronome.com> - 2017-01-17 22:20 +0100
              RE: [PATCHv2] firmware: Correct handling of fw_state_wait_timeout()  return value linux-kernel-dev <linux-kernel-dev@beckhoff.com> - 2017-01-18 07:40 +0100
                Re: [PATCHv2] firmware: Correct handling of fw_state_wait_timeout()  return value "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-18 21:10 +0100
                [PATCH 1/7] test_firmware: move misc_device down "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-23 17:20 +0100
                [PATCH 4/7] tools: firmware: rename fallback mechanism script "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-23 17:20 +0100
                [PATCH 7/7] firmware: firmware: fix NULL pointer dereference in __fw_load_abort() "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-23 17:20 +0100
                Re: [PATCH 7/7] firmware: firmware: fix NULL pointer dereference in  __fw_load_abort() Greg KH <gregkh@linuxfoundation.org> - 2017-01-25 12:00 +0100
                Re: [PATCH 7/7] firmware: firmware: fix NULL pointer dereference in  __fw_load_abort() "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-25 14:40 +0100
                Re: [PATCH 7/7] firmware: firmware: fix NULL pointer dereference in  __fw_load_abort() "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-25 14:50 +0100
                Re: [PATCH 7/7] firmware: firmware: fix NULL pointer dereference in  __fw_load_abort() Greg KH <gregkh@linuxfoundation.org> - 2017-01-25 15:50 +0100
                [PATCH v2] firmware: fix NULL pointer dereference in __fw_load_abort() "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-25 16:30 +0100
                Re: [PATCH v2] firmware: fix NULL pointer dereference in  __fw_load_abort() Greg KH <gregkh@linuxfoundation.org> - 2017-01-25 16:50 +0100
                Re: [PATCH v2] firmware: fix NULL pointer dereference in  __fw_load_abort() "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-25 19:40 +0100
                [PATCH v3] firmware: fix NULL pointer dereference in __fw_load_abort() "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-25 19:40 +0100
                [PATCH 5/7] tools: firmware: add fallback cancelation testing "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-23 17:20 +0100
                [PATCH 6/7] test_firmware: add test custom fallback trigger "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-23 17:20 +0100
                [PATCH 2/7] test_firmware: use device attribute groups "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-23 17:20 +0100
                [PATCH 3/7] tools: firmware: check for distro fallback udev cancel rule "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-23 17:20 +0100
                [PATCH 0/7] firmware: expand test units for fallback mechanism "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-23 17:20 +0100
            Re: [PATCHv2] firmware: Correct handling of fw_state_wait_timeout()  return value "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-01-17 22:40 +0100

csiph-web