From: Danish Khateeb <danishkhateeb03@gmail.com>
To: Shuah Khan <shuah@kernel.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Russ Weight <russ.weight@linux.dev>,
driver-core@lists.linux.dev, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
Danish Khateeb <danishkhateeb03@gmail.com>
Subject: [PATCH] selftests: firmware: compare uploaded firmware through a pipe
Date: Wed, 28 Oct 2026 15:15:33 -0500 [thread overview]
Message-ID: <20261028201533.158536-1-danishkhateeb03@gmail.com> (raw)
verify_fw() checks the data read back from the upload_read sysfs file
with cmp, sending its output to /dev/null. When the output goes to
/dev/null, GNU cmp only needs the exit status and treats regular files
of different sizes as different without reading them. Sysfs attributes
report a size of 4096, so the check fails although the data matches, and
the test stops at the first upload:
./fw_upload.sh: firmware compare for fw1 did not match
Feed the sysfs file to cmp through a pipe, so that its contents are
compared.
Fixes: a37ddddd8603 ("selftests: firmware: Add firmware upload selftests")
Signed-off-by: Danish Khateeb <danishkhateeb03@gmail.com>
---
Notes:
Seen with GNU diffutils 3.12. Tested under virtme-ng on mainline
62c457528529 with CONFIG_TEST_FIRMWARE and CONFIG_FW_UPLOAD: without
this patch fw_upload.sh fails at the first compare, with it the test
passes in 3 of 3 runs. A copy of a sysfs file that differs in one byte
is still reported as different.
An LLM was used to help with this patch.
tools/testing/selftests/firmware/fw_upload.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/firmware/fw_upload.sh b/tools/testing/selftests/firmware/fw_upload.sh
index c7a6f06c9adb..1b234632b611 100755
--- a/tools/testing/selftests/firmware/fw_upload.sh
+++ b/tools/testing/selftests/firmware/fw_upload.sh
@@ -53,7 +53,7 @@ verify_fw() {
local file="$2"
echo -n "$name" > "$DIR"/config_upload_name
- if ! cmp "$file" "$DIR"/upload_read > /dev/null 2>&1; then
+ if ! cat "$DIR"/upload_read | cmp "$file" - > /dev/null 2>&1; then
echo "$0: firmware compare for $name did not match" >&2
exit 1
fi
base-commit: 62c457528529cdcfa32bc52b331ceca10f3937b6
--
2.56.0
reply other threads:[~2026-10-28 20:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261028201533.158536-1-danishkhateeb03@gmail.com \
--to=danishkhateeb03@gmail.com \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=russ.weight@linux.dev \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®