From: Mohammed Rayan <mohammedrah1289@gmail.com>
To: linux-gpio@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org,
Bamvor Jian Zhang <bamv2005@gmail.com>,
Shuah Khan <shuah@kernel.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Mohammed Rayan <mohammedrah1289@gmail.com>
Subject: [PATCH] selftests: gpio: Reject empty simulator names
Date: Sat, 21 Nov 2026 02:43:39 +0530 [thread overview]
Message-ID: <20261120211339.79567-1-mohammedrah1289@gmail.com> (raw)
The gpio-sim selftest checks that chip_name and dev_name are nonempty,
but the command substitutions in both checks are unquoted. If a read
produces no output, the shell removes the empty argument and leaves
"test -n", which succeeds instead of reporting the missing name.
Quote the substitutions so that an empty result fails the checks.
In a disposable QEMU guest, the original and modified scripts both
passed normally. With empty output or a failed read injected for each
attribute using a userspace wrapper, the original script passed and the
modified script failed as expected.
The issue was investigated with Codex assistance.
Fixes: 1d96b8f635d9 ("selftests: gpio: add test cases for gpio-sim")
Signed-off-by: Mohammed Rayan <mohammedrah1289@gmail.com>
---
tools/testing/selftests/gpio/gpio-sim.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/gpio/gpio-sim.sh b/tools/testing/selftests/gpio/gpio-sim.sh
index bbc29ed9c60a..2c9e354fe9ed 100755
--- a/tools/testing/selftests/gpio/gpio-sim.sh
+++ b/tools/testing/selftests/gpio/gpio-sim.sh
@@ -181,7 +181,7 @@ echo "1.1. Chip name is communicated to user"
create_chip chip
create_bank chip bank
enable_chip chip
-test -n `cat $CONFIGFS_DIR/chip/bank/chip_name` || fail "chip_name doesn't work"
+test -n "`cat $CONFIGFS_DIR/chip/bank/chip_name`" || fail "chip_name doesn't work"
disable_chip chip
remove_chip chip
@@ -196,7 +196,7 @@ echo "1.3. Device name is communicated to user"
create_chip chip
create_bank chip bank
enable_chip chip
-test -n `cat $CONFIGFS_DIR/chip/dev_name` || fail "dev_name doesn't work"
+test -n "`cat $CONFIGFS_DIR/chip/dev_name`" || fail "dev_name doesn't work"
disable_chip chip
remove_chip chip
--
2.34.1
reply other threads:[~2026-11-20 21:14 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=20261120211339.79567-1-mohammedrah1289@gmail.com \
--to=mohammedrah1289@gmail.com \
--cc=bamv2005@gmail.com \
--cc=brgl@bgdev.pl \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kselftest@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox