From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751533AbdAWQLb (ORCPT ); Mon, 23 Jan 2017 11:11:31 -0500 Received: from mail.kernel.org ([198.145.29.136]:42406 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750723AbdAWQL2 (ORCPT ); Mon, 23 Jan 2017 11:11:28 -0500 From: "Luis R. Rodriguez" To: gregkh@linuxfoundation.org Cc: ming.lei@canonical.com, keescook@chromium.org, linux-kernel-dev@beckhoff.com, jakub.kicinski@netronome.com, chris@chris-wilson.co.uk, oss-drivers@netronome.com, johannes@sipsolutions.net, j@w1.fi, teg@jklm.no, kay@vrfy.org, jwboyer@fedoraproject.org, dmitry.torokhov@gmail.com, seth.forshee@canonical.com, bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org, wagi@monom.org, stephen.boyd@linaro.org, zohar@linux.vnet.ibm.com, tiwai@suse.de, dwmw2@infradead.org, fengguang.wu@intel.com, dhowells@redhat.com, arend.vanspriel@broadcom.com, kvalo@codeaurora.org, "Luis R. Rodriguez" Subject: [PATCH 3/7] tools: firmware: check for distro fallback udev cancel rule Date: Mon, 23 Jan 2017 08:11:07 -0800 Message-Id: <20170123161111.5925-4-mcgrof@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170123161111.5925-1-mcgrof@kernel.org> References: <20170118200141.GH13946@wotan.suse.de> <20170123161111.5925-1-mcgrof@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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