Shellcheck -oall warnings fixed:
  - exit 1 if `cd tests` failes (SC2164)

  - Double quote `./${atest}` to prevent globbing and word splitting. (SC2086)

  - Check the test exit code directly intead of using $? (SC2181)

Other fixes:
  - The shebang sould traditionally be /usr/bin/env sh in case
    sh is not located in /bin.

  - Do not remove tests.log for every test.

Signed-off-by: Adam Duskett <[email protected]>
---
 meta-oe/recipes-devtools/libtoml11/files/run-ptest | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/meta-oe/recipes-devtools/libtoml11/files/run-ptest 
b/meta-oe/recipes-devtools/libtoml11/files/run-ptest
index 9bc480aa7f..4da9e68cc5 100755
--- a/meta-oe/recipes-devtools/libtoml11/files/run-ptest
+++ b/meta-oe/recipes-devtools/libtoml11/files/run-ptest
@@ -1,10 +1,11 @@
-#!/bin/sh
+#!/usr/bin/env sh
+
+cd tests || exit 1
+
+rm -rf tests.log
 
-cd tests
 for atest in test_* ; do
-    rm -rf tests.log
-    ./${atest} > tests.log 2>&1
-    if [ $? = 0 ] ; then
+    if ./"${atest}" >> tests.log 2>&1; then
         echo "PASS: ${atest}"
     else
         echo "FAIL: ${atest}"
-- 
2.53.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#124461): 
https://lists.openembedded.org/g/openembedded-devel/message/124461
Mute This Topic: https://lists.openembedded.org/mt/117858407/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to