Skip to contentSkip to conversation

Some fixes of shell scripts of tests

PATCH Subrata Modak 1 participant 1 message Oct 26, 2009 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 7 lines · Jiri Palecek

Hello,

this patch fixes some minor bugs in the code of LTP shell scripts.

- quote arguments of test(1) in some places concerning redhat detection

Quoted 6 lines

- don't execute the result of type(1), it makes no sense - even more when the output of it should be redirected

Regards
Jiri Palecek

Thanks.

Regards--
Subrata

Quoted 111 lines
---
 testcases/commands/ade/file/file_test.sh  |    2 +-
 testcases/commands/cron/cron_allow01      |    2 +-
 testcases/commands/cron/cron_deny01       |    2 +-
 testcases/commands/cron/cron_pos_tests.sh |    2 +-
 testcases/commands/mail/mail_tests.sh     |    2 +-
 testcases/commands/su/su01                |    6 +++---
 testcases/network/tcp_cmds/rdist/rdist01  |    2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)
testcases/commands/ade/file/file_test.sh +1 -1
index e5de1ed..652b441 100755
@@ -474,7 +474,7 @@ export TCID=file09
 export TST_COUNT=9
 
 $LTPBIN/tst_resm TINFO "TEST #9: file command recognizes RPM files"
-`type rpm &> /dev/null`
+type rpm > /dev/null 2>&1
 if [ $? = 0 ]; then
 bDIR=$(rpm --eval "%{_topdir}")
 bCMD=rpmbuild
testcases/commands/cron/cron_allow01 +1 -1
index 404ca28..9a941dd 100755
@@ -29,7 +29,7 @@ iam=`whoami`
 tvar=${MACHTYPE%-*}
 tvar=${tvar#*-}
 
-if [ $tvar = "redhat" -o $tvar = "redhat-linux" ] 
+if [ "$tvar" = "redhat" -o "$tvar" = "redhat-linux" ] 
 then
 CRON_ALLOW="/etc/cron.allow"
 else
testcases/commands/cron/cron_deny01 +1 -1
index 563f857..89ca66c 100755
@@ -29,7 +29,7 @@ iam=`whoami`
 tvar=${MACHTYPE%-*}
 tvar=${tvar#*-}
 
-if [ $tvar = "redhat" -o $tvar = "redhat-linux" ] 
+if [ "$tvar" = "redhat" -o "$tvar" = "redhat-linux" ] 
 then
 CRON_DENY="/etc/cron.deny"
 CRON_ALLOW="/etc/cron.allow"
testcases/commands/cron/cron_pos_tests.sh +1 -1
index 9b5c9f7..acc08cb 100755
@@ -7,7 +7,7 @@ iam=`whoami`
 tvar=${MACHTYPE%-*}
 tvar=${tvar#*-}
 
-if [ $tvar = "redhat" -o $tvar = "redhat-linux" ] 
+if [ "$tvar" = "redhat" -o "$tvar" = "redhat-linux" ] 
 then
 	CRON_ALLOW="/etc/cron.allow"
 else
testcases/commands/mail/mail_tests.sh +1 -1
index 45bac93..cee08d6 100755
@@ -60,7 +60,7 @@ export TCID=SETUP
 export TST_COUNT=1
 
 MAIL_NOT_INSTALLED=
-`type mail &> /dev/null`
+type mail > /dev/null 2>&1
 if [ $? != 0 ]; then
     MAIL_NOT_INSTALLED=1
 fi
testcases/commands/su/su01 +3 -3
index 91548c7..1228c01 100755
@@ -43,7 +43,7 @@ tvar=${tvar#*-}
 export tvar
 printf "Machine type is: $tvar\n\n"
 
-if [ $tvar = "redhat" -o $tvar = "redhat-linux" ] 
+if [ "$tvar" = "redhat" -o "$tvar" = "redhat-linux" ] 
 # Need to also set group for TEST_USER2
 then
 export TEST_USER1_GROUP="wheel"
@@ -99,7 +99,7 @@ rm -f $TEST_ENV_FILE > /dev/null 2>&1
 
 	#create users home directory (SLES 8 does not do this, even when specified in adduser)
 # Only do this if not RH; RH creates the directory.
-	if [ $tvar != "redhat" -a $tvar != "redhat-linux" ]
+	if [ "$tvar" != "redhat" -a "$tvar" != "redhat-linux" ]
 	then {
           USER_UID=`id -u $TEST_USER1`
           USER_GID=`id -g $TEST_USER1`
@@ -135,7 +135,7 @@ rm -f $TEST_ENV_FILE > /dev/null 2>&1
 
 	#create users home diretory (SLES 8 does not do this, even when specified in adduser)
 # Only do this if not RH; RH creates the directory.
-        if [ $tvar != "redhat" -a $tvar != "redhat-linux" ]
+        if [ "$tvar" != "redhat" -a "$tvar" != "redhat-linux" ]
         then {
           USER_UID=`id -u $TEST_USER2`
           USER_GID=`id -g $TEST_USER2`
testcases/network/tcp_cmds/rdist/rdist01 +0 -0
index 624fd12..d03dd73 100755

testcases/network/tcp_cmds/rdist/rdist01 check_result() · line 181

Quoted 8 lines
testcases/network/tcp_cmds/rdist/rdist01 +1 -1
@@ -175,7 +175,7 @@ check_result()
                x=\$(( \$x + \$i ))
             done
             echo \$x`
-         if [ $TOTAL_SUM = $LSUM ]; then 
+         if [ "$TOTAL_SUM" = "$LSUM" ]; then 
             tst_resm TINFO "Success rdist in $c_ruser@$c_rhost "
   	    rsh -n -l $c_ruser $c_rhost "rm -rf $FILES $DIRECTORIES"
          else

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list