linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] selftests: firmware: skip testing unsupported features
@ 2017-11-08 19:40 Amit Pundir
  2017-11-08 19:40 ` [PATCH v2 1/2] selftests: firmware: skip unsupported async loading tests Amit Pundir
  2017-11-08 19:40 ` [PATCH v2 2/2] selftests: firmware: skip unsupported custom firmware fallback tests Amit Pundir
  0 siblings, 2 replies; 3+ messages in thread
From: Amit Pundir @ 2017-11-08 19:40 UTC (permalink / raw)
  To: kselftest, lkml
  Cc: Shuah Khan, Greg Kroah-Hartman, Luis R . Rodriguez,
	Masami Hiramatsu, Sumit Semwal

Hi,

At Linaro we run mainline/linux-next selftests on LTS releases and
run into few test failures due to kernel mismatch or missing upstream
functionality in older kernels. Discussed at length here:
https://lkml.org/lkml/2017/6/15/652

This patch series is an attempt to modify selftest firmware test scripts.
The proposed changes skip/ignore testing the upstream functionality
missing in the older kernel releases.

v2:
 Changed the display message to make it consistent across all
 the firmware test scripts. Added Fixes tag.

Regards,
Amit Pundir


Amit Pundir (2):
  selftests: firmware: skip unsupported async loading tests
  selftests: firmware: skip unsupported custom firmware fallback tests

 tools/testing/selftests/firmware/fw_fallback.sh   | 38 ++++++++++++++++-------
 tools/testing/selftests/firmware/fw_filesystem.sh | 34 ++++++++++++--------
 2 files changed, 47 insertions(+), 25 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/2] selftests: firmware: skip unsupported async loading tests
  2017-11-08 19:40 [PATCH v2 0/2] selftests: firmware: skip testing unsupported features Amit Pundir
@ 2017-11-08 19:40 ` Amit Pundir
  2017-11-08 19:40 ` [PATCH v2 2/2] selftests: firmware: skip unsupported custom firmware fallback tests Amit Pundir
  1 sibling, 0 replies; 3+ messages in thread
From: Amit Pundir @ 2017-11-08 19:40 UTC (permalink / raw)
  To: kselftest, lkml
  Cc: Shuah Khan, Greg Kroah-Hartman, Luis R . Rodriguez,
	Masami Hiramatsu, Sumit Semwal

Ignore async firmware loading tests on older kernel releases,
which do not support this feature.

Fixes: 1b1fe542b6f0 ("selftests: firmware: add empty string and async tests")
Reviewed-by: Sumit Semwal <sumit.semwal@linaro.org>
Acked-by: Luis R. Rodriguez <mcgrof@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
---
v2:
 Changed the display message to make it consistent across all
 the firmware test scripts. Added Fixes tag.

 tools/testing/selftests/firmware/fw_filesystem.sh | 34 ++++++++++++++---------
 1 file changed, 21 insertions(+), 13 deletions(-)

diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh
index 62f2d6f54929..b1f20fef36c7 100755
--- a/tools/testing/selftests/firmware/fw_filesystem.sh
+++ b/tools/testing/selftests/firmware/fw_filesystem.sh
@@ -70,9 +70,13 @@ if printf '\000' >"$DIR"/trigger_request 2> /dev/null; then
 	exit 1
 fi
 
-if printf '\000' >"$DIR"/trigger_async_request 2> /dev/null; then
-	echo "$0: empty filename should not succeed (async)" >&2
-	exit 1
+if [ ! -e "$DIR"/trigger_async_request ]; then
+	echo "$0: empty filename: async trigger not present, ignoring test" >&2
+else
+	if printf '\000' >"$DIR"/trigger_async_request 2> /dev/null; then
+		echo "$0: empty filename should not succeed (async)" >&2
+		exit 1
+	fi
 fi
 
 # Request a firmware that doesn't exist, it should fail.
@@ -105,17 +109,21 @@ else
 fi
 
 # Try the asynchronous version too
-if ! echo -n "$NAME" >"$DIR"/trigger_async_request ; then
-	echo "$0: could not trigger async request" >&2
-	exit 1
-fi
-
-# Verify the contents are what we expect.
-if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
-	echo "$0: firmware was not loaded (async)" >&2
-	exit 1
+if [ ! -e "$DIR"/trigger_async_request ]; then
+	echo "$0: firmware loading: async trigger not present, ignoring test" >&2
 else
-	echo "$0: async filesystem loading works"
+	if ! echo -n "$NAME" >"$DIR"/trigger_async_request ; then
+		echo "$0: could not trigger async request" >&2
+		exit 1
+	fi
+
+	# Verify the contents are what we expect.
+	if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
+		echo "$0: firmware was not loaded (async)" >&2
+		exit 1
+	else
+		echo "$0: async filesystem loading works"
+	fi
 fi
 
 ### Batched requests tests
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] selftests: firmware: skip unsupported custom firmware fallback tests
  2017-11-08 19:40 [PATCH v2 0/2] selftests: firmware: skip testing unsupported features Amit Pundir
  2017-11-08 19:40 ` [PATCH v2 1/2] selftests: firmware: skip unsupported async loading tests Amit Pundir
@ 2017-11-08 19:40 ` Amit Pundir
  1 sibling, 0 replies; 3+ messages in thread
From: Amit Pundir @ 2017-11-08 19:40 UTC (permalink / raw)
  To: kselftest, lkml
  Cc: Shuah Khan, Greg Kroah-Hartman, Luis R . Rodriguez,
	Masami Hiramatsu, Sumit Semwal

Ignore custom firmware loading and cancellation tests on older
kernel releases, which do not support this feature.

Fixes: 061132d2b9c9 ("test_firmware: add test custom fallback trigger")
Reviewed-by: Sumit Semwal <sumit.semwal@linaro.org>
Acked-by: Luis R. Rodriguez <mcgrof@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
---
v2:
 Changed the display message to make it consistent across all
 the firmware test scripts. Added Fixes tag.

 tools/testing/selftests/firmware/fw_fallback.sh | 38 +++++++++++++++++--------
 1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/tools/testing/selftests/firmware/fw_fallback.sh b/tools/testing/selftests/firmware/fw_fallback.sh
index a52a3bab532b..72858c921eed 100755
--- a/tools/testing/selftests/firmware/fw_fallback.sh
+++ b/tools/testing/selftests/firmware/fw_fallback.sh
@@ -86,6 +86,11 @@ load_fw_cancel()
 
 load_fw_custom()
 {
+	if [ ! -e "$DIR"/trigger_custom_fallback ]; then
+		echo "$0: custom fallback trigger not present, ignoring test" >&2
+		return 1
+	fi
+
 	local name="$1"
 	local file="$2"
 
@@ -108,11 +113,17 @@ load_fw_custom()
 
 	# Wait for request to finish.
 	wait
+	return 0
 }
 
 
 load_fw_custom_cancel()
 {
+	if [ ! -e "$DIR"/trigger_custom_fallback ]; then
+		echo "$0: canceling custom fallback trigger not present, ignoring test" >&2
+		return 1
+	fi
+
 	local name="$1"
 	local file="$2"
 
@@ -133,6 +144,7 @@ load_fw_custom_cancel()
 
 	# Wait for request to finish.
 	wait
+	return 0
 }
 
 load_fw_fallback_with_child()
@@ -227,20 +239,22 @@ else
 	echo "$0: cancelling fallback mechanism works"
 fi
 
-load_fw_custom "$NAME" "$FW"
-if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
-	echo "$0: firmware was not loaded" >&2
-	exit 1
-else
-	echo "$0: custom fallback loading mechanism works"
+if load_fw_custom "$NAME" "$FW" ; then
+	if ! diff -q "$FW" /dev/test_firmware >/dev/null ; then
+		echo "$0: firmware was not loaded" >&2
+		exit 1
+	else
+		echo "$0: custom fallback loading mechanism works"
+	fi
 fi
 
-load_fw_custom_cancel "nope-$NAME" "$FW"
-if diff -q "$FW" /dev/test_firmware >/dev/null ; then
-	echo "$0: firmware was expected to be cancelled" >&2
-	exit 1
-else
-	echo "$0: cancelling custom fallback mechanism works"
+if load_fw_custom_cancel "nope-$NAME" "$FW" ; then
+	if diff -q "$FW" /dev/test_firmware >/dev/null ; then
+		echo "$0: firmware was expected to be cancelled" >&2
+		exit 1
+	else
+		echo "$0: cancelling custom fallback mechanism works"
+	fi
 fi
 
 set +e
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-08 19:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-08 19:40 [PATCH v2 0/2] selftests: firmware: skip testing unsupported features Amit Pundir
2017-11-08 19:40 ` [PATCH v2 1/2] selftests: firmware: skip unsupported async loading tests Amit Pundir
2017-11-08 19:40 ` [PATCH v2 2/2] selftests: firmware: skip unsupported custom firmware fallback tests Amit Pundir

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).