linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] selftests: gpio: gpio-sim: remove bashisms
@ 2021-12-13 16:26 Bartosz Golaszewski
  2021-12-13 16:38 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Bartosz Golaszewski @ 2021-12-13 16:26 UTC (permalink / raw)
  To: Kent Gibson, Linus Walleij, Andy Shevchenko, Shuah Khan,
	Geert Uytterhoeven, Viresh Kumar
  Cc: linux-gpio, linux-kernel, linux-kselftest, Bartosz Golaszewski

'==' is a bashisms and not understood by POSIX shell. Drop it from
gpio-sim selftests.

Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
I ran the newly applied patches on a different system and noticed the
tests now fail. I missed '==' operators for string comparison I used in
some places.

 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 d335a975890c..c913d5aec768 100755
--- a/tools/testing/selftests/gpio/gpio-sim.sh
+++ b/tools/testing/selftests/gpio/gpio-sim.sh
@@ -23,12 +23,12 @@ remove_chip() {
 
 	for FILE in $CONFIGFS_DIR/$CHIP/*; do
 		BANK=`basename $FILE`
-		if [ "$BANK" == "live" ] || [ "$BANK" == "dev_name" ]; then
+		if [ "$BANK" = "live" ] || [ "$BANK" = "dev_name" ]; then
 			continue
 		fi
 
 		LINES=`ls $CONFIGFS_DIR/$CHIP/$BANK/ | egrep ^line`
-		if [ "$?" == 0 ]; then
+		if [ "$?" = 0 ]; then
 			for LINE in $LINES; do
 				if [ -e $CONFIGFS_DIR/$CHIP/$BANK/$LINE/hog ]; then
 					rmdir $CONFIGFS_DIR/$CHIP/$BANK/$LINE/hog || \
-- 
2.30.1


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

* Re: [PATCH -next] selftests: gpio: gpio-sim: remove bashisms
  2021-12-13 16:26 [PATCH -next] selftests: gpio: gpio-sim: remove bashisms Bartosz Golaszewski
@ 2021-12-13 16:38 ` Andy Shevchenko
  2021-12-13 18:30   ` Bartosz Golaszewski
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2021-12-13 16:38 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Kent Gibson, Linus Walleij, Shuah Khan, Geert Uytterhoeven,
	Viresh Kumar, linux-gpio, linux-kernel, linux-kselftest

On Mon, Dec 13, 2021 at 05:26:25PM +0100, Bartosz Golaszewski wrote:
> '==' is a bashisms and not understood by POSIX shell. Drop it from
> gpio-sim selftests.

> -		if [ "$BANK" == "live" ] || [ "$BANK" == "dev_name" ]; then
> +		if [ "$BANK" = "live" ] || [ "$BANK" = "dev_name" ]; then

While at it, no need to fork `test` twice, isn't it?

		if [ "$BANK" = "live" -o "$BANK" = "dev_name" ]; then

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH -next] selftests: gpio: gpio-sim: remove bashisms
  2021-12-13 16:38 ` Andy Shevchenko
@ 2021-12-13 18:30   ` Bartosz Golaszewski
  0 siblings, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2021-12-13 18:30 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Kent Gibson, Linus Walleij, Shuah Khan, Geert Uytterhoeven,
	Viresh Kumar, open list:GPIO SUBSYSTEM,
	Linux Kernel Mailing List, linux-kselftest

On Mon, Dec 13, 2021 at 5:39 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, Dec 13, 2021 at 05:26:25PM +0100, Bartosz Golaszewski wrote:
> > '==' is a bashisms and not understood by POSIX shell. Drop it from
> > gpio-sim selftests.
>
> > -             if [ "$BANK" == "live" ] || [ "$BANK" == "dev_name" ]; then
> > +             if [ "$BANK" = "live" ] || [ "$BANK" = "dev_name" ]; then
>
> While at it, no need to fork `test` twice, isn't it?
>
>                 if [ "$BANK" = "live" -o "$BANK" = "dev_name" ]; then
>
> --
> With Best Regards,
> Andy Shevchenko
>
>

I'll send a follow-up for that, thanks for spotting it.

Bart

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

end of thread, other threads:[~2021-12-13 18:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-13 16:26 [PATCH -next] selftests: gpio: gpio-sim: remove bashisms Bartosz Golaszewski
2021-12-13 16:38 ` Andy Shevchenko
2021-12-13 18:30   ` Bartosz Golaszewski

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).