[Fuego] [PATCH] Modify the following 5 points in all scripts: 1. do not use echo -e 2. succedded->succeeded 3. add indication for all failures 4. if [$? = 0] modification 5. delete the whitespace at the end of the line

Wang, Mingyu wangmy at cn.fujitsu.com
Thu Jul 19 08:49:12 UTC 2018


Hi Tim

Please ignore the previous mail, because I do not check the name of the patch.
I'm very sorry.

by Wangmy

-----Original Message-----
From: Wang, Mingyu/王 鸣瑜 
Sent: Thursday, July 19, 2018 4:34 PM
To: fuego at lists.linuxfoundation.org
Cc: Wang, Mingyu/王 鸣瑜 <wangmy at cn.fujitsu.com>
Subject: [PATCH] Modify the following 5 points in all scripts: 1. do not use echo -e 2. succedded->succeeded 3. add indication for all failures 4. if [$? = 0] modification 5. delete the whitespace at the end of the line

Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
 engine/tests/Functional.busybox/fuego_test.sh      |  2 +-
 .../Functional.busybox/tests/busybox_chgrp1.sh     |  5 ++--
 .../Functional.busybox/tests/busybox_chgrp2.sh     |  3 ++-
 .../Functional.busybox/tests/busybox_chmod1.sh     |  7 ++++--
 .../Functional.busybox/tests/busybox_chmod2.sh     |  1 +
 .../Functional.busybox/tests/busybox_chown1.sh     |  4 +++-
 .../Functional.busybox/tests/busybox_chown2.sh     |  8 +++----
 .../Functional.busybox/tests/busybox_chroot.sh     |  3 +--
 .../tests/Functional.busybox/tests/busybox_chvt.sh |  5 ++--
 .../Functional.busybox/tests/busybox_clear.sh      |  3 +--
 .../tests/Functional.busybox/tests/busybox_cmp.sh  |  2 ++
 .../tests/Functional.busybox/tests/busybox_cp.sh   |  7 ++----
 .../tests/Functional.busybox/tests/busybox_dd.sh   |  1 +
 .../Functional.busybox/tests/busybox_deallocvt.sh  |  3 +--
 .../Functional.busybox/tests/busybox_egrep.sh      |  1 +
 .../tests/Functional.busybox/tests/busybox_free.sh |  3 +--  .../tests/Functional.busybox/tests/busybox_grep.sh |  6 +++--
 .../Functional.busybox/tests/busybox_gunzip.sh     |  3 ++-
 .../tests/Functional.busybox/tests/busybox_gzip.sh | 27 ++++++++++++----------
 19 files changed, 52 insertions(+), 42 deletions(-)

diff --git a/engine/tests/Functional.busybox/fuego_test.sh b/engine/tests/Functional.busybox/fuego_test.sh
index e2597ac..861cf24 100755
--- a/engine/tests/Functional.busybox/fuego_test.sh
+++ b/engine/tests/Functional.busybox/fuego_test.sh
@@ -44,7 +44,7 @@ function test_pre_check {
     echo "Tests skipped depending on the availability of a command on the target"
     touch ${LOGDIR}/skiplist.txt
     skip_if_command_unavailable expect "busybox_ash.sh"
-    skip_if_command_unavailable tr "busybox_chgrp1.sh busybox_chgrp2.sh busybox_chmod1.sh busybox_chmod2.sh busybox_chown1.sh busybox_chown2.sh busybox_gunzip.sh busybox_gzip.sh"
+    skip_if_command_unavailable tr "busybox_chgrp1.sh busybox_chgrp2.sh busybox_chmod1.sh busybox_chmod2.sh busybox_chown1.sh busybox_chown2.sh"
     skip_if_not_root "busybox_chroot.sh"
 }
 
diff --git a/engine/tests/Functional.busybox/tests/busybox_chgrp1.sh b/engine/tests/Functional.busybox/tests/busybox_chgrp1.sh
index 4459d81..ce0a6b5 100644
--- a/engine/tests/Functional.busybox/tests/busybox_chgrp1.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_chgrp1.sh
@@ -10,9 +10,10 @@ touch test_dir/test1
 group=$(id -n -g | cut -b -8)
 if [ "$(busybox ls -l ./test_dir | grep -v "total" | tr -s ' ' | cut -d' ' -f4 | cut -b -8)" = "$group" ]  then
-    echo " -> $test: Group info display succedded."
+    echo " -> $test: Group info display succeeded."
 else
-    echo " -> $test: FAIL"
+    echo " -> $test: Group info display failed."
+    echo " -> $test: TEST-FAIL"
     rm -rf test_dir
     exit
 fi;
diff --git a/engine/tests/Functional.busybox/tests/busybox_chgrp2.sh b/engine/tests/Functional.busybox/tests/busybox_chgrp2.sh
index b2dc7a6..c596bbf 100644
--- a/engine/tests/Functional.busybox/tests/busybox_chgrp2.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_chgrp2.sh
@@ -12,8 +12,9 @@ group=$(id -n -g | cut -b -8)  busybox ls -l ./test_dir | grep -v "total" | tr -s ' ' | cut -d' ' -f4 | cut -b -8 > log1  if [ "$(head -n 1 log1)" = "$group" ] && [  "$(tail -n 1 log1)" = "$group" ]  then
-    echo " -> $test: Group info display succedded."
+    echo " -> $test: Group info display succeeded."
 else
+    echo " -> $test: Group info display faild."
     echo " -> $test: TEST-FAIL"
     rm log1
     rm -rf test_dir
diff --git a/engine/tests/Functional.busybox/tests/busybox_chmod1.sh b/engine/tests/Functional.busybox/tests/busybox_chmod1.sh
index 2033bbd..cdc7d18 100644
--- a/engine/tests/Functional.busybox/tests/busybox_chmod1.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_chmod1.sh
@@ -14,6 +14,7 @@ if [ $(busybox ls -l ./test_dir | grep -v "total" | tr -s ' ' | cut -d' ' -f9) =  then
     echo " -> $test: test_dir contents verification succeeded."
 else
+    echo " -> $test: test_dir contents verification failed."
     echo " -> $test: TEST-FAIL"
     rm -rf ./test_dir
     exit
@@ -22,8 +23,9 @@ fi;
 busybox chmod g+x ./test_dir/test1
 if [ "$(busybox ls -l ./test_dir | grep -v "total" | cut -b 1-3)" = "-rw" ]  then
-    echo " -> $test: Changed file permissions verification2 succeeded."
+    echo " -> $test: Changed file permissions verification#2 succeeded."
 else
+    echo " -> $test: Changed file permissions verification#2 failed."
     echo " -> $test: TEST-FAIL"
     rm -rf ./test_dir
     exit
@@ -32,8 +34,9 @@ fi;
 busybox chmod o+x ./test_dir/test1
 if [ "$(busybox ls -l ./test_dir | grep -v "total" | tr -s ' ' | cut -d' ' -f1,9  | cut -b 9-16)" = "-x test1" ]  then
-    echo " -> $test: Changed file permissions verification3 succeeded."
+    echo " -> $test: Changed file permissions verification#3 succeeded."
 else
+    echo " -> $test: Changed file permissions verification#3 failed."
     echo " -> $test: TEST-FAIL"
     rm -rf ./test_dir
     exit
diff --git a/engine/tests/Functional.busybox/tests/busybox_chmod2.sh b/engine/tests/Functional.busybox/tests/busybox_chmod2.sh
index ae627e9..eb15d4e 100644
--- a/engine/tests/Functional.busybox/tests/busybox_chmod2.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_chmod2.sh
@@ -14,6 +14,7 @@ if [ "$(head -n 1 log1 | cut -b 12-16)" = "test1" ] && [ "$(tail -n 1 log1 | cut  then
     echo " -> $test: test_dir contents verification succeeded."
 else
+    echo " -> $test: test_dir contents verification failed."
     echo " -> $test: TEST-FAIL"
     rm -rf ./test_dir;
     rm log1;
diff --git a/engine/tests/Functional.busybox/tests/busybox_chown1.sh b/engine/tests/Functional.busybox/tests/busybox_chown1.sh
index 6824dea..a04bcf6 100644
--- a/engine/tests/Functional.busybox/tests/busybox_chown1.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_chown1.sh
@@ -13,6 +13,7 @@ if [ "$(busybox ls -l ./test_dir | grep -v "total" | tr -s ' ' | cut -d' ' -f1,3  then
     echo " -> $test: test_dir contents verification succeeded."
 else
+    echo " -> $test: test_dir contents verification failed."
     echo " -> $test: TEST-FAIL"
     rm -rf ./test_dir;
     exit
@@ -21,8 +22,9 @@ fi;
 busybox chown bin ./test_dir/test1
 if [ "$(busybox ls -l ./test_dir | grep -v "total" | tr -s ' ' | cut -d' ' -f1,3,4,9 | cut -b 12-)" = "bin $orig_group test1" ]  then
-    echo " -> $test: test_dir contents verification succeeded."
+    echo " -> $test: test_dir contents verification#2 succeeded."
 else
+    echo " -> $test: test_dir contents verification#2 failed."
     echo " -> $test: TEST-FAIL"
     rm -rf ./test_dir;
     exit
diff --git a/engine/tests/Functional.busybox/tests/busybox_chown2.sh b/engine/tests/Functional.busybox/tests/busybox_chown2.sh
index f722d7b..e0d48e9 100644
--- a/engine/tests/Functional.busybox/tests/busybox_chown2.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_chown2.sh
@@ -15,7 +15,7 @@ if [ "$(head -n 1 log1)" = "$orig_user $orig_group test1" ] && [ "$(tail -n 1 lo  then
     echo " -> $test: test_dir contents verification succeeded."
 else
-    echo "$test: test_dir contents verification failed"
+    echo " -> $test: test_dir contents verification failed."
     echo " -> $test: TEST-FAIL"
     rm log1
     rm -rf ./test_dir
@@ -28,7 +28,7 @@ if [ "$(head -n 1 log2)" = "bin $orig_group test1" ] && [ "$(tail -n 1 log2)" =  then
     echo " -> $test: group change for multiple files (-R) succeeded"
 else
-    echo "$test: group change for multiple files (-R) not found"
+    echo " -> $test: group change for multiple files (-R) not found."
     echo " -> $test: TEST-FAIL"
     rm log1 log2
     rm -rf ./test_dir
@@ -39,10 +39,10 @@ busybox chown -R bin.bin ./test_dir  busybox ls -l ./test_dir | grep -v "total" | tr -s ' ' | cut -d' ' -f3,4,9 > log3  if [ "$(head -n 1 log3)" = "bin bin test1" ] && [ "$(tail -n 1 log3)" = "bin bin test2" ]  then
-    echo "$test: user and group change for multiple files (-R) succeeded"
+    echo " -> $test: user and group change for multiple files (-R) succeeded"
     echo " -> $test: TEST-PASS"
 else
-    echo "$test: user and group change for multiple files (-R) not found"
+    echo " -> $test: user and group change for multiple files (-R) not found"
     echo " -> $test: TEST-FAIL"
 fi;
 rm log1 log2 log3;
diff --git a/engine/tests/Functional.busybox/tests/busybox_chroot.sh b/engine/tests/Functional.busybox/tests/busybox_chroot.sh
index d78b029..f25610e 100644
--- a/engine/tests/Functional.busybox/tests/busybox_chroot.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_chroot.sh
@@ -19,8 +19,7 @@ for lib in $libs; do
    mkdir -p ${test_dir}${lib_dirname}
    cp -v $lib ${test_dir}${lib_dirname}  done -busybox chroot $test_dir /bin/ls -if [ $? = 0 ]
+if busybox chroot $test_dir /bin/ls
 then
     echo " -> $test: TEST-PASS"
 else
diff --git a/engine/tests/Functional.busybox/tests/busybox_chvt.sh b/engine/tests/Functional.busybox/tests/busybox_chvt.sh
index 3f69d01..6630dec 100644
--- a/engine/tests/Functional.busybox/tests/busybox_chvt.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_chvt.sh
@@ -6,7 +6,7 @@
 test="chvt"
 
 if tty | grep "^not" ; then
-    echo "$test: test script not running in a changable tty"
+    echo " -> $test: test script not running in a changable tty"
     echo " -> $test: TEST-SKIP"
     exit 0
 fi
@@ -21,8 +21,7 @@ else
     bnum=$(($anum-1))
 fi
 echo "$test: Changing to VT $bnum"
-busybox chvt $bnum
-if [ $? = 0 ]
+if busybox chvt $bnum
 then
     echo " -> $test: TEST-PASS"
 else
diff --git a/engine/tests/Functional.busybox/tests/busybox_clear.sh b/engine/tests/Functional.busybox/tests/busybox_clear.sh
index aaa1d06..3d1ddc5 100644
--- a/engine/tests/Functional.busybox/tests/busybox_clear.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_clear.sh
@@ -5,8 +5,7 @@
 
 test="clear"
 
-busybox clear
-if [ $? = 0 ]
+if busybox clear
 then
     echo " -> $test: TEST-PASS"
 else
diff --git a/engine/tests/Functional.busybox/tests/busybox_cmp.sh b/engine/tests/Functional.busybox/tests/busybox_cmp.sh
index 6692300..74ab817 100644
--- a/engine/tests/Functional.busybox/tests/busybox_cmp.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_cmp.sh
@@ -12,6 +12,7 @@ if [ "$(busybox cmp test_dir/test1 test_dir/test2)" = "test_dir/test1 test_dir/t  then
     echo " -> $test: command cmp succeeded."
 else
+    echo " -> $test: command cmp failed."
     echo " -> $test: TEST-FAIL"
     rm -rf test_dir
     exit
@@ -23,6 +24,7 @@ if [ "$(busybox cmp -l test_dir/test1 test_dir/test2)" = "19  61  62" ]  then
     echo " -> $test: command cmp -l succeeded."
 else
+    echo " -> $test: command cmp -l failed."
     echo " -> $test: TEST-FAIL"
     rm -rf test_dir
     exit
diff --git a/engine/tests/Functional.busybox/tests/busybox_cp.sh b/engine/tests/Functional.busybox/tests/busybox_cp.sh
index 6a387d1..36cd650 100644
--- a/engine/tests/Functional.busybox/tests/busybox_cp.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_cp.sh
@@ -11,8 +11,9 @@ echo "cp test" > test_dir_src/test1  busybox cp test_dir_src/test1 test_dir_dest/  if [ "$(cat test_dir_dest/test1)" = "cp test" ]  then
-    echo " -> $test: cp succeed."
+    echo " -> $test: cp succeeded."
 else
+    echo " -> $test: cp failed."
     echo " -> &test: TEST-FAIL"
     rm -rf test_dir_src
     rm -rf test_dir_dest
@@ -25,10 +26,6 @@ then
     echo " -> $test: TEST-PASS"
 else
     echo "-> $test: TEST-FAIL"
-    rm cp.log
-    rm -rf test_dir_src
-    rm -rf test_dir_dest
-    exit
 fi
 rm cp.log
 rm -rf test_dir_src
diff --git a/engine/tests/Functional.busybox/tests/busybox_dd.sh b/engine/tests/Functional.busybox/tests/busybox_dd.sh
index 2aa89b4..d5ad2a2 100644
--- a/engine/tests/Functional.busybox/tests/busybox_dd.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_dd.sh
@@ -13,6 +13,7 @@ if  tail -n 1 log | grep "0+1\ records\ out" && head -n 1 log | grep "0+1\ recor  then
     echo " -> $test: grep succeeded."
 else
+    echo " -> $test: grep failed."
     echo " -> $test: TEST-FAIL"
     rm -fr test1 test2
     rm log
diff --git a/engine/tests/Functional.busybox/tests/busybox_deallocvt.sh b/engine/tests/Functional.busybox/tests/busybox_deallocvt.sh
index 88941cc..2ba40cd 100644
--- a/engine/tests/Functional.busybox/tests/busybox_deallocvt.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_deallocvt.sh
@@ -7,8 +7,7 @@ test="deallocvt"
 
 openvt -f -c 4 ls
 sleep 1
-busybox deallocvt 4
-if [ $? = 0 ]
+if busybox deallocvt 4
 then
     echo " -> $test: TEST-PASS"
 else
diff --git a/engine/tests/Functional.busybox/tests/busybox_egrep.sh b/engine/tests/Functional.busybox/tests/busybox_egrep.sh
index 2ac7a61..ecab535 100644
--- a/engine/tests/Functional.busybox/tests/busybox_egrep.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_egrep.sh
@@ -13,6 +13,7 @@ if [ "$(head -n 1 log1)" = "test file" ] && [ "$(tail -n 1 log1)" = "extended gr  then
     echo " -> $test: Egrep output verification#1 succeeded."
 else
+    echo " -> $test: Egrep output verification#1 failed."
     echo " -> $test: TEST-FAIL"
     rm log1
     rm -rf test1
diff --git a/engine/tests/Functional.busybox/tests/busybox_free.sh b/engine/tests/Functional.busybox/tests/busybox_free.sh
index e69e6f2..0f7c9fb 100644
--- a/engine/tests/Functional.busybox/tests/busybox_free.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_free.sh
@@ -1,8 +1,7 @@
 #!/bin/sh
 test="free"
 
-busybox free
-if [ $? = 0 ]
+if busybox free
 then
     echo " -> $test: TEST-PASS"
 else
diff --git a/engine/tests/Functional.busybox/tests/busybox_grep.sh b/engine/tests/Functional.busybox/tests/busybox_grep.sh
index 6479be6..5ad8c14 100644
--- a/engine/tests/Functional.busybox/tests/busybox_grep.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_grep.sh
@@ -8,8 +8,9 @@ test="grep"
 echo -e "Fixed String\nIn pattern\nFor grep" >test1  if [ "$(busybox grep -H in ./test1)" = "./test1:Fixed String" ]  then
-    echo " -> $test: grep option -H verification#1 succedded."
+    echo " -> $test: option -H verification#1 succeeded."
 else
+    echo " -> $test: option -H verification#1 failed."
     echo " -> $test: TEST-FAIL"
     rm -rf test1
     exit
@@ -17,8 +18,9 @@ fi;
 
 if [ "$(busybox grep -h in ./test1)" = "Fixed String" ]  then
-    echo " -> $test: grep option -h verification#2 succedded."
+    echo " -> $test: option -h verification#2 succeeded."
 else
+    echo " -> $test: option -h verification#2 failed."
     echo " -> $test: TEST-FAIL"
     rm -rf test1
     exit
diff --git a/engine/tests/Functional.busybox/tests/busybox_gunzip.sh b/engine/tests/Functional.busybox/tests/busybox_gunzip.sh
index 1e8aa76..611b9c3 100644
--- a/engine/tests/Functional.busybox/tests/busybox_gunzip.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_gunzip.sh
@@ -8,10 +8,11 @@ test="gunzip"
 mkdir test_dir
 echo "This is a file to test gunzip." > ./test_dir/test1  gzip ./test_dir/test1 -if [ "$(busybox ls -l ./test_dir | tr -s ' ' | cut -d' ' -f9)" = "test1.gz" ]
+if [ "$(ls ./test_dir)" = "test1.gz" ]
 then
     echo " -> $test: File test1.gz created."
 else
+    echo " -> $test: File test1.gz creation failure."
     echo " -> $test: TEST-FAIL"
     rm -rf test_dir
     exit
diff --git a/engine/tests/Functional.busybox/tests/busybox_gzip.sh b/engine/tests/Functional.busybox/tests/busybox_gzip.sh
index 9310896..4aee3dc 100644
--- a/engine/tests/Functional.busybox/tests/busybox_gzip.sh
+++ b/engine/tests/Functional.busybox/tests/busybox_gzip.sh
@@ -8,10 +8,11 @@ test="gzip"
 mkdir test_dir
 echo "This is a file to test gzip." > ./test_dir/test1  busybox gzip ./test_dir/test1 -if [ "$(busybox ls -l ./test_dir | tr -s ' ' | cut -d' ' -f9)" = "test1.gz" ]
+if [ "$(ls ./test_dir)" = "test1.gz" ]
 then
     echo " -> $test: File test1.gz created."
 else
+    echo " -> $test: File test1.gz creation failure."
     echo " -> $test: TEST-FAIL"
     rm -rf test_dir
     exit
@@ -19,18 +20,19 @@ fi;
 
 if [ "$(busybox gzip -cd ./test_dir/test1.gz)" = "This is a file to test gzip." ]  then
-    echo " -> $test: gzip option -cd verification#1 succedded."
+    echo " -> $test: gzip option -cd verification#1 succeeded."
 else
+    echo " -> $test: gzip option -cd verification#1 failed."
     echo " -> $test: TEST-FAIL"
     rm -rf test_dir
     exit
 fi;
 
-gunzip -t ./test_dir/test1.gz
-if [ $? = 0 ]
+if gunzip -t ./test_dir/test1.gz
 then
-    echo " -> $test: gzip option -t verification#2 succedded."
+    echo " -> $test: gzip option -t verification#2 succeeded."
 else
+    echo " -> $test: gzip option -t verification#2 failed."
     echo " -> $test: TEST-FAIL"
     rm -rf test_dir
     exit
@@ -38,24 +40,25 @@ fi;
 
 if [ "$(gunzip -c ./test_dir/test1.gz)" = "This is a file to test gzip." ]  then
-    echo " -> $test: gzip option -c verification#3 succedded."
+    echo " -> $test: gzip option -c verification#3 succeeded."
 else
-    echo " -> $test: TEST-FAIL"    
+    echo " -> $test: gzip option -c verification#3 failed."
+    echo " -> $test: TEST-FAIL"
     rm -rf test_dir
     exit
 fi;
 
-busybox gzip -d ./test_dir/test1.gz
-if [ $? = 0 ]
+if busybox gzip -d ./test_dir/test1.gz
 then
-    echo " -> $test: gzip option -d verification#4 succedded."
+    echo " -> $test: gzip option -d verification#4 succeeded."
 else
-    echo " -> $test: TEST-FAIL"
+    echo " -> $test: gzip option -d verification#4 failed."
+    echo " -> $test: TEST-FAIL  option -d verification#4"
     rm -rf test_dir
     exit
 fi;
 
-if [ "$(busybox ls -l ./test_dir | tr -s ' ' | cut -d' ' -f9)" = "test1" ]
+if [ "$(ls ./test_dir)" = "test1" ]
 then
     echo " -> $test: TEST-PASS"
 else
--
1.8.3.1





More information about the Fuego mailing list