All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Rue <dan.rue@linaro.org>
To: linux-kernel@vger.kernel.org
Cc: Dan Rue <dan.rue@linaro.org>, Shuah Khan <shuah@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kees Cook <keescook@chromium.org>,
	"Luis R. Rodriguez" <mcgrof@kernel.org>,
	linux-kselftest@vger.kernel.org
Subject: [PATCH 1/2] selftests: firmware: remove use of non-standard diff -Z option
Date: Mon, 26 Nov 2018 21:12:15 -0600	[thread overview]
Message-ID: <20181127031218.24419-2-dan.rue@linaro.org> (raw)
In-Reply-To: <20181127031218.24419-1-dan.rue@linaro.org>

diff -Z is used to trim the trailing whitespace when comparing the
loaded firmware file with the source firmware file. However, per the
comment in the source code, -Z should not be necessary. In testing, the
input and output files are identical.

Additionally, -Z is not a standard option and is not available in
environments such as busybox. When -Z is not supported, diff fails with
a usage error, which is suppressed, but then causes read_firmwares() to
exit with a false failure message.

Signed-off-by: Dan Rue <dan.rue@linaro.org>
---
 tools/testing/selftests/firmware/fw_filesystem.sh | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh
index a4320c4b44dc..466cf2f91ba0 100755
--- a/tools/testing/selftests/firmware/fw_filesystem.sh
+++ b/tools/testing/selftests/firmware/fw_filesystem.sh
@@ -155,11 +155,8 @@ read_firmwares()
 {
 	for i in $(seq 0 3); do
 		config_set_read_fw_idx $i
-		# Verify the contents are what we expect.
-		# -Z required for now -- check for yourself, md5sum
-		# on $FW and DIR/read_firmware will yield the same. Even
-		# cmp agrees, so something is off.
-		if ! diff -q -Z "$FW" $DIR/read_firmware 2>/dev/null ; then
+		# Verify the contents match
+		if ! diff -q "$FW" $DIR/read_firmware 2>/dev/null ; then
 			echo "request #$i: firmware was not loaded" >&2
 			exit 1
 		fi
@@ -171,7 +168,7 @@ read_firmwares_expect_nofile()
 	for i in $(seq 0 3); do
 		config_set_read_fw_idx $i
 		# Ensures contents differ
-		if diff -q -Z "$FW" $DIR/read_firmware 2>/dev/null ; then
+		if diff -q "$FW" $DIR/read_firmware 2>/dev/null ; then
 			echo "request $i: file was not expected to match" >&2
 			exit 1
 		fi
-- 
2.19.1


WARNING: multiple messages have this Message-ID (diff)
From: dan.rue at linaro.org (Dan Rue)
Subject: [PATCH 1/2] selftests: firmware: remove use of non-standard diff -Z option
Date: Mon, 26 Nov 2018 21:12:15 -0600	[thread overview]
Message-ID: <20181127031218.24419-2-dan.rue@linaro.org> (raw)
In-Reply-To: <20181127031218.24419-1-dan.rue@linaro.org>

diff -Z is used to trim the trailing whitespace when comparing the
loaded firmware file with the source firmware file. However, per the
comment in the source code, -Z should not be necessary. In testing, the
input and output files are identical.

Additionally, -Z is not a standard option and is not available in
environments such as busybox. When -Z is not supported, diff fails with
a usage error, which is suppressed, but then causes read_firmwares() to
exit with a false failure message.

Signed-off-by: Dan Rue <dan.rue at linaro.org>
---
 tools/testing/selftests/firmware/fw_filesystem.sh | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh
index a4320c4b44dc..466cf2f91ba0 100755
--- a/tools/testing/selftests/firmware/fw_filesystem.sh
+++ b/tools/testing/selftests/firmware/fw_filesystem.sh
@@ -155,11 +155,8 @@ read_firmwares()
 {
 	for i in $(seq 0 3); do
 		config_set_read_fw_idx $i
-		# Verify the contents are what we expect.
-		# -Z required for now -- check for yourself, md5sum
-		# on $FW and DIR/read_firmware will yield the same. Even
-		# cmp agrees, so something is off.
-		if ! diff -q -Z "$FW" $DIR/read_firmware 2>/dev/null ; then
+		# Verify the contents match
+		if ! diff -q "$FW" $DIR/read_firmware 2>/dev/null ; then
 			echo "request #$i: firmware was not loaded" >&2
 			exit 1
 		fi
@@ -171,7 +168,7 @@ read_firmwares_expect_nofile()
 	for i in $(seq 0 3); do
 		config_set_read_fw_idx $i
 		# Ensures contents differ
-		if diff -q -Z "$FW" $DIR/read_firmware 2>/dev/null ; then
+		if diff -q "$FW" $DIR/read_firmware 2>/dev/null ; then
 			echo "request $i: file was not expected to match" >&2
 			exit 1
 		fi
-- 
2.19.1

WARNING: multiple messages have this Message-ID (diff)
From: dan.rue@linaro.org (Dan Rue)
Subject: [PATCH 1/2] selftests: firmware: remove use of non-standard diff -Z option
Date: Mon, 26 Nov 2018 21:12:15 -0600	[thread overview]
Message-ID: <20181127031218.24419-2-dan.rue@linaro.org> (raw)
Message-ID: <20181127031215.VyEWgeFgW9slkqiajXIzNtcndx7KcohINQPfMoGG6kI@z> (raw)
In-Reply-To: <20181127031218.24419-1-dan.rue@linaro.org>

diff -Z is used to trim the trailing whitespace when comparing the
loaded firmware file with the source firmware file. However, per the
comment in the source code, -Z should not be necessary. In testing, the
input and output files are identical.

Additionally, -Z is not a standard option and is not available in
environments such as busybox. When -Z is not supported, diff fails with
a usage error, which is suppressed, but then causes read_firmwares() to
exit with a false failure message.

Signed-off-by: Dan Rue <dan.rue at linaro.org>
---
 tools/testing/selftests/firmware/fw_filesystem.sh | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh
index a4320c4b44dc..466cf2f91ba0 100755
--- a/tools/testing/selftests/firmware/fw_filesystem.sh
+++ b/tools/testing/selftests/firmware/fw_filesystem.sh
@@ -155,11 +155,8 @@ read_firmwares()
 {
 	for i in $(seq 0 3); do
 		config_set_read_fw_idx $i
-		# Verify the contents are what we expect.
-		# -Z required for now -- check for yourself, md5sum
-		# on $FW and DIR/read_firmware will yield the same. Even
-		# cmp agrees, so something is off.
-		if ! diff -q -Z "$FW" $DIR/read_firmware 2>/dev/null ; then
+		# Verify the contents match
+		if ! diff -q "$FW" $DIR/read_firmware 2>/dev/null ; then
 			echo "request #$i: firmware was not loaded" >&2
 			exit 1
 		fi
@@ -171,7 +168,7 @@ read_firmwares_expect_nofile()
 	for i in $(seq 0 3); do
 		config_set_read_fw_idx $i
 		# Ensures contents differ
-		if diff -q -Z "$FW" $DIR/read_firmware 2>/dev/null ; then
+		if diff -q "$FW" $DIR/read_firmware 2>/dev/null ; then
 			echo "request $i: file was not expected to match" >&2
 			exit 1
 		fi
-- 
2.19.1

  reply	other threads:[~2018-11-27  3:12 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-27  3:12 [PATCH 0/2] selftests: firmware: fw_filesystem fix for busybox Dan Rue
2018-11-27  3:12 ` Dan Rue
2018-11-27  3:12 ` dan.rue
2018-11-27  3:12 ` Dan Rue [this message]
2018-11-27  3:12   ` [PATCH 1/2] selftests: firmware: remove use of non-standard diff -Z option Dan Rue
2018-11-27  3:12   ` dan.rue
2018-11-27 17:56   ` Kees Cook
2018-11-27 17:56     ` Kees Cook
2018-11-27 17:56     ` keescook
2018-11-30  2:37   ` Luis Chamberlain
2018-11-30  2:37     ` Luis Chamberlain
2018-11-30  2:37     ` mcgrof
2018-12-05 20:43     ` Dan Rue
2018-12-05 20:43       ` Dan Rue
2018-12-05 20:43       ` dan.rue
2019-02-07 18:20       ` Luis Chamberlain
2019-02-07 18:20         ` Luis Chamberlain
2019-02-07 18:20         ` mcgrof
2019-02-08 17:53         ` shuah
2019-02-08 17:53           ` shuah
2019-02-08 17:53           ` shuah
2018-11-27  3:12 ` [PATCH 2/2] selftests: firmware: add CONFIG_FW_LOADER_USER_HELPER_FALLBACK to config Dan Rue
2018-11-27  3:12   ` Dan Rue
2018-11-27  3:12   ` dan.rue
2018-11-27 17:56   ` Kees Cook
2018-11-27 17:56     ` Kees Cook
2018-11-27 17:56     ` keescook
2018-11-30  2:31   ` Luis Chamberlain
2018-11-30  2:31     ` Luis Chamberlain
2018-11-30  2:31     ` mcgrof
2019-02-04 23:39     ` Luis Chamberlain
2019-02-04 23:39       ` Luis Chamberlain
2019-02-04 23:39       ` mcgrof
2019-02-05  2:41       ` Dan Rue
2019-02-05  2:41         ` Dan Rue
2019-02-05  2:41         ` dan.rue
2019-02-05 19:14         ` Luis Chamberlain
2019-02-05 19:14           ` Luis Chamberlain
2019-02-05 19:14           ` mcgrof

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181127031218.24419-2-dan.rue@linaro.org \
    --to=dan.rue@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.