diff mbox series

[-next] selftests: gpio: gpio-sim: remove bashisms

Message ID 20211213162625.18081-1-brgl@bgdev.pl (mailing list archive)
State Accepted
Commit f7eda6fe03226b8a608a5d52a1e8273a14fba07c
Headers show
Series [-next] selftests: gpio: gpio-sim: remove bashisms | expand

Commit Message

Bartosz Golaszewski Dec. 13, 2021, 4:26 p.m. UTC
'==' 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(-)

Comments

Andy Shevchenko Dec. 13, 2021, 4:38 p.m. UTC | #1
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
Bartosz Golaszewski Dec. 13, 2021, 6:30 p.m. UTC | #2
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
diff mbox series

Patch

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 || \