From patchwork Wed Nov 8 19:54:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 118335 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp55141edl; Wed, 8 Nov 2017 11:54:38 -0800 (PST) X-Google-Smtp-Source: ABhQp+SwKW/SAxP8GO9H8pqVdSvCit01LvIBOZmjEjoQ0pXDINVmIZ4ODK8QHPrXeuPkDF67Mc4Y X-Received: by 10.99.130.74 with SMTP id w71mr1507131pgd.25.1510170878783; Wed, 08 Nov 2017 11:54:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510170878; cv=none; d=google.com; s=arc-20160816; b=VRRWIP5tu9yyw/bczQiacymFWSzgj0wCVMT39w5F3vA3tHPPK5awgVWi4b8/PWBWj8 /5lLmLx6gd0xlz9+hjWLNls2y6k33P/4JlKrFAylq0COW+4KYmMdeAsiBQzJcLkoVO0q Z8p6a6eXd83g6IlS2H5X36NlemzkROvswwDzHCDjur0w8je36S/zK1OephG5orIJhrmx UxsqjlRRkSGOWGJVfrCsbMRhz25LCGnnsCuoeZVl+CiT0TuVSjbLTcyQ4R9RWJxv1P2I ex223xKuZ8ESu2R5lB9Lzg+yN2YxV1dIDJVTWWXmYbdP7yhw6WSGWQyZWl0Q7XunOoe8 M2ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=bjvjgAhB3pL1xfxu54Ts41+sRP9q1bZA8LQ4fcIAhMU=; b=pzsdlHdpN5vTv50f8nw5RsnlOLB4qHzGoAgFe9mnzvE7z5Klz3YGV6u81uOg395H5/ dY10jWT/KhY85+2/9IT+h0QCQhud/Iy0gVBLHfbB5EgP3Lwa2xscG7oqbIG7Ay7iZHMN yJeHX+hYgrAvpy0Y57DumQnES5f/pLEIb9BDHs3MD/u04ZQG/BUg0PrNzQmXUfyswhhV sDfvYzo2oSh/fFpeIWq5YkPdq0CMVRZsRin4vfBKspxMnrSNvHWMm0Ql2BRo9hcLq9Eb ckB5238il/22xBRYGzoTWr+D4GPElkCOD3YsJd0rbWRHlOOPZn1Kb2F5sA80lPVg6b5X 5gKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NDAOK6Xv; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si4413061plo.19.2017.11.08.11.54.38; Wed, 08 Nov 2017 11:54:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NDAOK6Xv; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752704AbdKHTyh (ORCPT + 9 others); Wed, 8 Nov 2017 14:54:37 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:43698 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752633AbdKHTye (ORCPT ); Wed, 8 Nov 2017 14:54:34 -0500 Received: by mail-pg0-f67.google.com with SMTP id s75so2737670pgs.0 for ; Wed, 08 Nov 2017 11:54:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bjvjgAhB3pL1xfxu54Ts41+sRP9q1bZA8LQ4fcIAhMU=; b=NDAOK6XvCkmd5ugfsidvKtkmWLnT/1iLcadBi3V3cht6N7ssCx4qTfdmVx719zm9x/ qEG/ce+5773QECajCRJQSNUGEE9jkIbYm9XK8Tm9rk54x5tlM7v+0/n5anY6qcZ+HbOe DNnhH9wp0tAkmqgf77RTsK0E1nug9+TQ5y/1E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bjvjgAhB3pL1xfxu54Ts41+sRP9q1bZA8LQ4fcIAhMU=; b=qJmpPAOOzLYKAulG3Rhe2glwpGMyp8qcO5+uC0Bim8OilO73VTvpbSn9FHNSUIghR+ adGddwVi/jLMZ51wUtr90QV4MaZbSFUkiQC9CINbaL67CArIlVx2m5DzCHoTKkJsIABv 7x8FI/e9X3i/43j9c+bm6nvZ5hV53IcNNNKtwKy7uQEq+dUo7/jpIqiW+lwky6axz2um ZUigTX0sghghTOX60bDRuLs+F37qqHJVYGaRwfExmNI8e4AjLo8Cz+XxWDwd/ohJ7zjh laoMwpfeJe7ihAYZ1U8oPh99pXxDbwlDXjv4+1dc9giXTy7RwM9TUddg73JAq5h7eAJO T8Kg== X-Gm-Message-State: AJaThX7WxJHVdFM2d2JJQEzOjeEkGB2wAZfZ2Dt37shvK7P8kKT3hlbU 7s6MoEcWuujSlBE60TO1SFn5WA== X-Received: by 10.101.71.132 with SMTP id e4mr1479881pgs.206.1510170874115; Wed, 08 Nov 2017 11:54:34 -0800 (PST) Received: from localhost.localdomain ([106.51.18.232]) by smtp.gmail.com with ESMTPSA id p83sm10021226pfd.61.2017.11.08.11.54.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Nov 2017 11:54:32 -0800 (PST) From: Amit Pundir To: Greg KH Cc: Stable , Fengguang Wu , Shuah Khan , "Luis R . Rodriguez" , Brian Norris , Sumit Semwal Subject: [PATCH for-4.4.y 4/4] tools: firmware: check for distro fallback udev cancel rule Date: Thu, 9 Nov 2017 01:24:12 +0530 Message-Id: <1510170852-32052-5-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510170852-32052-1-git-send-email-amit.pundir@linaro.org> References: <1510170852-32052-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: "Luis R. Rodriguez" 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 Signed-off-by: Greg Kroah-Hartman Signed-off-by: Amit Pundir --- tools/testing/selftests/firmware/fw_userhelper.sh | 28 +++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) -- 2.7.4 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