Skip to contentSkip to conversation

selftests/powerpc: make the test check in eeh-basic.sh posix compliant

PATCH Applied Po-Hsu Lin 3 participants 3 messages Dec 28, 2020 – Feb 3, 2021

Subsystems (2)
lore
Share & tools
lore

Po-Hsu Lin

author
#0 lore raw

PATCH 1/1 selftests/powerpc: make the test check in eeh-basic.sh posix compliant

The == operand is a bash extension, thus this will fail on Ubuntu with

As the /bin/sh on Ubuntu is pointed to DASH.

Use -eq to fix this posix compatibility issue.

Fixes 996f9e0f93f162 ("selftests/powerpc: Fix eeh-basic.sh exit codes")
---
 tools/testing/selftests/powerpc/eeh/eeh-basic.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/powerpc/eeh/eeh-basic.sh +1 -1
index 0d783e1..64779f0 100755
@@ -86,5 +86,5 @@ echo "$failed devices failed to recover ($dev_count tested)"
 lspci | diff -u $pre_lspci -
 rm -f $pre_lspci
 
-test "$failed" == 0
+test "$failed" -eq 0
 exit $?
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Po-Hsu Lin

The == operand is a bash extension, thus this will fail on Ubuntu with

Error message is somehow missing. It should read:
"./eeh-basic.sh: 89: test: 2: unexpected operator"

Quoted 7 lines

As the /bin/sh on Ubuntu is pointed to DASH.

Use -eq to fix this posix compatibility issue.

Fixes 996f9e0f93f162 ("selftests/powerpc: Fix eeh-basic.sh exit codes")

---

With the above,

Thanks!

Quoted 15 lines
  tools/testing/selftests/powerpc/eeh/eeh-basic.sh | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/powerpc/eeh/eeh-basic.sh +1 -1
index 0d783e1..64779f0 100755
@@ -86,5 +86,5 @@ echo "$failed devices failed to recover ($dev_count tested)"
  lspci | diff -u $pre_lspci -
  rm -f $pre_lspci
 
-test "$failed" == 0
+test "$failed" -eq 0
  exit $?