[oe-commits] Robert Yang : run-ptest: fix bashism

git at git.openembedded.org git at git.openembedded.org
Thu Aug 28 06:15:14 UTC 2014


Module: openembedded-core.git
Branch: master-next
Commit: 1105b8ee2dd6a37597083071746326e26fc4335c
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=1105b8ee2dd6a37597083071746326e26fc4335c

Author: Robert Yang <liezhi.yang at windriver.com>
Date:   Wed Aug 27 08:57:10 2014 -0700

run-ptest: fix bashism

These script use /bin/sh as the interpreter, but contains bashism:
    recipes-devtools/insserv/files/run-ptest
    recipes-devtools/quilt/quilt/run-ptest
    recipes-devtools/tcltk/tcl/run-ptest
    recipes-extended/gawk/gawk-4.1.1/run-ptest
    recipes-support/beecrypt/beecrypt/run-ptest

Fixed:
    "==" -> "=" (should be -eq when integer)
    "&>log" -> ">log 2>&1"

And quilt's test scripts requires bash, add bash to RDEPENDS_quilt-ptest

Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/recipes-devtools/insserv/files/run-ptest    | 2 +-
 meta/recipes-devtools/quilt/quilt-0.63.inc       | 2 +-
 meta/recipes-devtools/quilt/quilt/run-ptest      | 2 +-
 meta/recipes-devtools/tcltk/tcl/run-ptest        | 4 ++--
 meta/recipes-extended/gawk/gawk-4.1.1/run-ptest  | 4 ++--
 meta/recipes-support/beecrypt/beecrypt/run-ptest | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/meta/recipes-devtools/insserv/files/run-ptest b/meta/recipes-devtools/insserv/files/run-ptest
index 495d155..4a6da30 100644
--- a/meta/recipes-devtools/insserv/files/run-ptest
+++ b/meta/recipes-devtools/insserv/files/run-ptest
@@ -11,7 +11,7 @@ output() {
 }
 
 for i in test_simple_sequence test_undetected_loop; \
-  do $i &>/dev/null ; output; \
+  do $i >/dev/null 2>&1; output; \
 done
 
 rm -rf ${tmpdir}
diff --git a/meta/recipes-devtools/quilt/quilt-0.63.inc b/meta/recipes-devtools/quilt/quilt-0.63.inc
index f375785..433d6b4 100644
--- a/meta/recipes-devtools/quilt/quilt-0.63.inc
+++ b/meta/recipes-devtools/quilt/quilt-0.63.inc
@@ -55,5 +55,5 @@ do_install_ptest() {
 RDEPENDS_${PN}-ptest = "make file sed gawk diffutils findutils ed perl \
                         perl-module-filehandle perl-module-getopt-std \
                         perl-module-posix perl-module-file-temp \
-                        perl-module-text-parsewords \
+                        perl-module-text-parsewords bash \
 "
diff --git a/meta/recipes-devtools/quilt/quilt/run-ptest b/meta/recipes-devtools/quilt/quilt/run-ptest
index 1ea0dae..958a9df 100755
--- a/meta/recipes-devtools/quilt/quilt/run-ptest
+++ b/meta/recipes-devtools/quilt/quilt/run-ptest
@@ -1,5 +1,5 @@
 #!/bin/sh
 
 ln -sf /bin/ed /usr/bin/ed
-for i in `ls test/*.test |awk -F. '{print $1}' |awk -F/ '{print $2}'`; do make check-$i; if [ $? == 0 ]; then echo PASS: $i.test; else echo FAIL: $i.test; fi; done
+for i in `ls test/*.test |awk -F. '{print $1}' |awk -F/ '{print $2}'`; do make check-$i; if [ $? -eq 0 ]; then echo PASS: $i.test; else echo FAIL: $i.test; fi; done
 rm -f /usr/bin/ed
diff --git a/meta/recipes-devtools/tcltk/tcl/run-ptest b/meta/recipes-devtools/tcltk/tcl/run-ptest
index a5d6548..dadba65 100644
--- a/meta/recipes-devtools/tcltk/tcl/run-ptest
+++ b/meta/recipes-devtools/tcltk/tcl/run-ptest
@@ -1,8 +1,8 @@
 #!/bin/sh
 
 for i in `ls tests/*.test |awk -F/ '{print $2}'`; \
-    do TCL_LIBRARY=library ./tcltest tests/all.tcl -file $i &>$i.tmp; \
+    do TCL_LIBRARY=library ./tcltest tests/all.tcl -file $i >$i.tmp 2>&1; \
     grep -q "^Files with failing tests:" $i.tmp; \
-    if [ $? == 0 ]; then echo "FAIL: $i"; \
+    if [ $? -eq 0 ]; then echo "FAIL: $i"; \
     else echo "PASS: $i"; rm -f $i.tmp; fi; \
 done
diff --git a/meta/recipes-extended/gawk/gawk-4.1.1/run-ptest b/meta/recipes-extended/gawk/gawk-4.1.1/run-ptest
index 7d214ea..d23f0bf 100644
--- a/meta/recipes-extended/gawk/gawk-4.1.1/run-ptest
+++ b/meta/recipes-extended/gawk/gawk-4.1.1/run-ptest
@@ -3,8 +3,8 @@
 cd test
 for i in `grep -vE "@|^$|#|Gt-dummy" Maketests |awk -F: '{print $1}'`; \
   do LC_ALL=${GAWKLOCALE:-C} LANG=${GAWKLOCALE:-C} srcdir=`pwd` AWK=gawk CMP=cmp \
-  make -f Maketests $i &>$i.tmp; \
+  make -f Maketests $i >$i.tmp 2>&1; \
   grep -q "Error" $i.tmp; \
-  if [ $? == 0 ]; then echo "FAIL: $i"; \
+  if [ $? -eq 0 ]; then echo "FAIL: $i"; \
   else echo "PASS: $i"; rm -f $i.tmp; fi; \
 done
diff --git a/meta/recipes-support/beecrypt/beecrypt/run-ptest b/meta/recipes-support/beecrypt/beecrypt/run-ptest
index 5bc7460..2ee294d 100644
--- a/meta/recipes-support/beecrypt/beecrypt/run-ptest
+++ b/meta/recipes-support/beecrypt/beecrypt/run-ptest
@@ -1,5 +1,5 @@
 #!/bin/sh
 
 cd tests
-for i in `ls`; do ./$i; if [ $? == 0 ]; then echo "PASS: $i"; \
+for i in `ls`; do ./$i; if [ $? -eq 0 ]; then echo "PASS: $i"; \
     else echo "FAIL: $i"; fi; done



More information about the Openembedded-commits mailing list