* [LTP] [PATCH] Fix some bashisms
@ 2009-07-07 8:35 Jiri Palecek
2009-07-07 15:32 ` Subrata Modak
2009-07-08 18:13 ` Subrata Modak
0 siblings, 2 replies; 28+ messages in thread
From: Jiri Palecek @ 2009-07-07 8:35 UTC (permalink / raw)
To: ltp-list
Hello,
this patch reflects the comments by various people to the previous versions. It uses "+=1" instead of postincrement because of dash, ['s boolean expressions, printf for the formatting. I've left the unzip pushd/popd and the signal names issue completely.
Regards
Jiri Palecek
---
runalltests.sh | 58 +++++++++---------
testcases/commands/cron/cron02 | 4 +-
testcases/commands/cron/cron03 | 2 +-
testcases/commands/cron/cron_allow01 | 10 ++--
testcases/commands/cron/cron_deny01 | 14 ++--
testcases/commands/su/su01 | 18 +++---
testcases/kernel/containers/netns/child.sh | 2 +-
testcases/kernel/containers/netns/child_1.sh | 2 +-
testcases/kernel/containers/netns/childipv6.sh | 4 +-
testcases/kernel/containers/netns/childns.sh | 4 +-
testcases/kernel/containers/netns/delchild.sh | 8 +-
testcases/kernel/containers/netns/par_ftp.sh | 2 +-
testcases/kernel/containers/netns/parent.sh | 2 +-
testcases/kernel/containers/netns/parent_1.sh | 2 +-
testcases/kernel/containers/netns/parent_2.sh | 2 +-
testcases/kernel/containers/netns/parentns.sh | 4 +-
testcases/kernel/containers/netns/paripv6.sh | 4 +-
testcases/kernel/containers/netns/rename_net.sh | 6 +-
testcases/kernel/power_management/runpwtests.sh | 32 +++++-----
.../hyperthreading/ht_enabled/smt_smp_enabled.sh | 2 +-
testcases/kernel/syscalls/ioctl/test_ioctl | 4 +-
testcases/misc/tcore_patch_test_suites/tcore.sh | 11 ++--
testcases/network/iproute/ip_tests.sh | 62 ++++++++++----------
testcases/network/ipv6/perf_lan6/perf_lan6 | 4 +-
testcases/network/ipv6/tcpdump6/tcpdump601 | 2 +-
testcases/network/multicast/mc_commo/mc_commo | 4 +-
testcases/network/multicast/mc_member/mc_member | 2 +-
testcases/network/multicast/mc_opts/mc_opts | 2 +-
testcases/network/nfs/nfs03/nfs03 | 26 ++++----
.../network/rpc/basic_tests/rpcinfo/rpcinfo01 | 6 +-
testcases/network/tcp_cmds/perf_lan/perf_lan | 4 +-
testcases/network/tcp_cmds/tcpdump/tcpdump01 | 2 +-
32 files changed, 156 insertions(+), 155 deletions(-)
diff --git a/runalltests.sh b/runalltests.sh
index aa7a7d5..b710469 100755
--- a/runalltests.sh
+++ b/runalltests.sh
@@ -29,17 +29,17 @@
## ##
################################################################################
-echo -e "*******************************************************************"
-echo -e "*******************************************************************"
-echo -e "** **"
-echo -e "** This script is being re-written to cover all aspects of **"
-echo -e "** testing LTP, which includes running all those tests which **"
-echo -e "** are not run by default with ./runltp script. Special setup **"
-echo -e "** in system environment will be done to run all those tests **"
-echo -e "** like the File System tests, SELinuxtest, etc **"
-echo -e "** **"
-echo -e "*******************************************************************"
-echo -e "*******************************************************************"
+echo "*******************************************************************"
+echo "*******************************************************************"
+echo "** **"
+echo "** This script is being re-written to cover all aspects of **"
+echo "** testing LTP, which includes running all those tests which **"
+echo "** are not run by default with ./runltp script. Special setup **"
+echo "** in system environment will be done to run all those tests **"
+echo "** like the File System tests, SELinuxtest, etc **"
+echo "** **"
+echo "*******************************************************************"
+echo "*******************************************************************"
export LTPROOT=${PWD}
export RUN_BALLISTA=0
@@ -210,19 +210,19 @@ export HTML_OUTPUT_FILE_NAME=$LTP_VERSION_$HOSTNAME_$KERNEL_VERSION_$HARDWARE_TY
## The First one i plan to run is the default LTP run ##
## START => Test Series 1 ##
-echo -e "Running Default LTP..."
+echo "Running Default LTP..."
./runltp -g $HTML_OUTPUT_FILE_NAME
-echo -e "Completed running Default LTP\n\n"
+printf "Completed running Default LTP\n\n\n"
## END => Test Series 1 ##
## The next one i plan to run is ballista ##
## START => Test Series 2 ##
if [ $RUN_BALLISTA -eq 1 ]
then
- echo -e "Running Ballista..."
+ echo "Running Ballista..."
export TEST_START_TIME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`
./runltp -f ballista -o $LTP_VERSION-BALLISTA_RUN_ON-$HOSTNAME-$KERNEL_VERSION-$HARDWARE_TYPE-$TEST_START_TIME.out
- echo -e "Completed running Ballista\n\n"
+ printf "Completed running Ballista\n\n\n"
fi
## END => Test Series 2 ##
@@ -230,9 +230,9 @@ fi
## START => Test Series 3 ##
if [ $RUN_OPENPOSIX -eq 1 ]
then
- echo -e "Running Open Posix Tests..."
+ echo "Running Open Posix Tests..."
(cd testcases/open_posix_testsuite; make)
- echo -e "Completed running Open Posix Tests\n\n"
+ printf "Completed running Open Posix Tests\n\n\n"
fi
## END => Test Series 3 ##
@@ -242,9 +242,9 @@ fi
## START => Test Series 4 ##
if [ $RUN_MM_CORE_APIS -eq 1 ]
then
- echo -e "Initializing ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
+ echo "Initializing ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
# Check to see if User is Root
- if [ $EUID -ne 0 ]
+ if [ $(id -u) -ne 0 ]
then
echo You need to be root to Install libmm and run mem/libmm/mm_core_apis
echo Aborting ltp/testcases/kernel/mem/libmm/mm_core_apis
@@ -262,13 +262,13 @@ then
else
echo libmm-1.4.2 already installed in your system
fi
- echo -e "Running ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
+ echo "Running ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
(cd testcases/kernel/mem/libmm; \
make; \
make install; \
$LTPROOT/testcases/bin/mm_core_apis; )
fi
- echo -e "Completed running ltp/testcases/kernel/mem/libmm/mm_core_apis...\n\n"
+ printf "Completed running ltp/testcases/kernel/mem/libmm/mm_core_apis...\n\n\n"
fi
## END => Test Series 4 ##
@@ -278,9 +278,9 @@ fi
## START => Test Series 5 ##
if [ $RUN_AIOTESTS -eq 1 ]
then
- echo -e "Initializing ltp/testcases/kernel/io/aio ..."
+ echo "Initializing ltp/testcases/kernel/io/aio ..."
# Check to see if User is Root
- if [ $EUID -ne 0 ]
+ if [ $(id -u) -ne 0 ]
then
echo You need to be root to Install libaio-0.3.92 and run ltp/testcases/kernel/io/aio
echo Aborting ltp/testcases/kernel/io/aio
@@ -298,13 +298,13 @@ if [ $RUN_AIOTESTS -eq 1 ]
else
echo libaio-0.3.92 already installed in your system
fi
- echo -e "Building & Running ltp/testcases/kernel/io/aio..."
+ echo "Building & Running ltp/testcases/kernel/io/aio..."
(cd testcases/kernel/io/aio; \
make > /dev/null; \
./aio01/aio01; \
./aio02/runfstests.sh -a aio02/cases/aio_tio; \
make clean 1>&2 > /dev/null )
- echo -e "Completed running ltp/testcases/kernel/io/aio...\n\n"
+ printf "Completed running ltp/testcases/kernel/io/aio...\n\n\n"
fi
fi
## END => Test Series 5 ##
@@ -316,9 +316,9 @@ fi
## START => Test Series 6 ##
if [ $RUN_FILECAPS -eq 1 ]
then
- echo -e "Initializing ltp/testcases/kernel/security/filecaps ..."
+ echo "Initializing ltp/testcases/kernel/security/filecaps ..."
# Check to see if User is Root
- if [ $EUID -ne 0 ]
+ if [ $(id -u) -ne 0 ]
then
echo You need to be root to Install libcaps and run ltp/testcases/kernel/security/filecaps
echo Aborting ltp/testcases/kernel/security/filecaps
@@ -336,11 +336,11 @@ then
else
echo libcaps already installed in your system
fi
- echo -e "Building & Running ltp/testcases/kernel/security/filecaps"
+ echo "Building & Running ltp/testcases/kernel/security/filecaps"
(cd ltp/testcases/kernel/security/filecaps; \
make && make install > /dev/null; )
./runltp -f filecaps
- echo -e "Completed running ltp/testcases/kernel/io/aio...\n\n"
+ printf "Completed running ltp/testcases/kernel/io/aio...\n\n\n"
fi
fi
## END => Test Series 6 ##
diff --git a/testcases/commands/cron/cron02 b/testcases/commands/cron/cron02
index c1dc245..6e4d8fe 100755
--- a/testcases/commands/cron/cron02
+++ b/testcases/commands/cron/cron02
@@ -37,7 +37,7 @@ TEST_USER_HOMEDIR="/home/$TEST_USER"
do_setup(){
#erase any data from potential defunt cron test
- rm -rf /tmp/crontest &> /dev/null
+ rm -rf /tmp/crontest > /dev/null 2>&1
#erase user if he may exist , so we can have a clean env
rm -rf /home/$TEST_USER
@@ -56,7 +56,7 @@ do_setup(){
# Red Hat uses crond, SuSE/Other uses cron. Check if this is Red Hat/SuSE/Other
tvar=${MACHTYPE%-*}
tvar=${tvar#*-}
-echo "Distro type is: $tvar \n"
+printf "Distro type is: $tvar\n\n"
if [ $tvar != "redhat" -a $tvar != "redhat-linux" ]; then
diff --git a/testcases/commands/cron/cron03 b/testcases/commands/cron/cron03
index 58fbe1b..9448cc4 100755
--- a/testcases/commands/cron/cron03
+++ b/testcases/commands/cron/cron03
@@ -59,7 +59,7 @@ do_setup(){
# Red Hat uses crond, SuSE/Other uses cron. Check if this is Red Hat/SuSE/Other
tvar=${MACHTYPE%-*}
tvar=${tvar#*-}
-echo "Distro type is: $tvar \n"
+printf "Distro type is: $tvar\n\n"
if [ $tvar != "redhat" -a $tvar != "redhat-linux" ]; then
diff --git a/testcases/commands/cron/cron_allow01 b/testcases/commands/cron/cron_allow01
index 839ad81..266700a 100755
--- a/testcases/commands/cron/cron_allow01
+++ b/testcases/commands/cron/cron_allow01
@@ -47,9 +47,9 @@ TEST_USER2_HOME="/home/$TEST_USER2"
do_setup() {
#move any files that may get in the way
- rm /tmp/cron_allow_test &> /dev/null
- rm /tmp/cron_allow_test1 &> /dev/null
- mv $CRON_ALLOW $CRON_ALLOW.old &> /dev/null
+ rm /tmp/cron_allow_test > /dev/null 2>&1
+ rm /tmp/cron_allow_test1 > /dev/null 2>&1
+ mv $CRON_ALLOW $CRON_ALLOW.old > /dev/null 2>&1
#remove users for clean enviroment
su $TEST_USER1 -c "crontab -r"
@@ -90,8 +90,8 @@ do_cleanup(){
userdel $TEST_USER1
userdel $TEST_USER2
rm $CRON_ALLOW
- mv $CRON_ALLOW.old $CRON_ALLOW &> /dev/null
- rm /tmp/cron_allow_test &>/dev/null
+ mv $CRON_ALLOW.old $CRON_ALLOW > /dev/null 2>&1
+ rm /tmp/cron_allow_test >/dev/null 2>&1
}
#-----------------------------------------------------------------------
diff --git a/testcases/commands/cron/cron_deny01 b/testcases/commands/cron/cron_deny01
index f7f8fd4..527d79c 100755
--- a/testcases/commands/cron/cron_deny01
+++ b/testcases/commands/cron/cron_deny01
@@ -49,11 +49,11 @@ TEST_USER2_HOME="/home/$TEST_USER2"
do_setup() {
#move any files that may get in the way
- rm /tmp/cron_deny_test &> /dev/null
- rm /tmp/cron_deny_test1 &> /dev/null
+ rm /tmp/cron_deny_test > /dev/null 2>&1
+ rm /tmp/cron_deny_test1 > /dev/null 2>&1
- mv $CRON_DENY $CRON_DENY.old &> /dev/null
- mv $CRON_ALLOW $CRON_ALLOW.old &> /dev/null
+ mv $CRON_DENY $CRON_DENY.old > /dev/null 2>&1
+ mv $CRON_ALLOW $CRON_ALLOW.old > /dev/null 2>&1
#remove users for clean enviroment
su $TEST_USER1 -c "crontab -r"
@@ -94,9 +94,9 @@ do_cleanup(){
userdel $TEST_USER1
userdel $TEST_USER2
rm $CRON_DENY
- mv $CRON_DENY.old $CRON_DENY &> /dev/null
- mv $CRON_ALLOW.old $CRON_ALLOW &> /dev/null
- rm /tmp/cron_allow_test &>/dev/null
+ mv $CRON_DENY.old $CRON_DENY > /dev/null 2>&1
+ mv $CRON_ALLOW.old $CRON_ALLOW > /dev/null 2>&1
+ rm /tmp/cron_allow_test >/dev/null 2>&1
}
#-----------------------------------------------------------------------
diff --git a/testcases/commands/su/su01 b/testcases/commands/su/su01
index e6b8a05..91548c7 100755
--- a/testcases/commands/su/su01
+++ b/testcases/commands/su/su01
@@ -41,7 +41,7 @@ tvar=${tvar#*-}
# need to export tvar for su01_s1
export tvar
-echo "Machine type is: $tvar \n"
+printf "Machine type is: $tvar\n\n"
if [ $tvar = "redhat" -o $tvar = "redhat-linux" ]
# Need to also set group for TEST_USER2
@@ -76,9 +76,9 @@ export TEST_ENV_FILE2="/tmp/TEST_ENV_FILE_ROOT2"
do_setup(){
#REMOVE ANY TEMPOARY FILES THAT MAY STILL BE AROUND
-rm -f $TEST_ENV_FILE_USER &> /dev/null
-rm -f $TEST_ENV_FILE2 &> /dev/null
-rm -f $TEST_ENV_FILE &> /dev/null
+rm -f $TEST_ENV_FILE_USER > /dev/null 2>&1
+rm -f $TEST_ENV_FILE2 > /dev/null 2>&1
+rm -f $TEST_ENV_FILE > /dev/null 2>&1
#Create 1st test user
@@ -108,7 +108,7 @@ rm -f $TEST_ENV_FILE &> /dev/null
}
fi
- usermod -p $TEST_USER1_ENCRYPTED_PASSWD $TEST_USER1 &> /dev/null
+ usermod -p $TEST_USER1_ENCRYPTED_PASSWD $TEST_USER1 > /dev/null 2>&1
if [ $? != 0 ]
then {
echo "Could not set password for test user $TEST_USER1"
@@ -144,7 +144,7 @@ rm -f $TEST_ENV_FILE &> /dev/null
}
fi
- usermod -p $TEST_USER2_ENCRYPTED_PASSWD $TEST_USER2 &> /dev/null
+ usermod -p $TEST_USER2_ENCRYPTED_PASSWD $TEST_USER2 > /dev/null 2>&1
if [ $? != 0 ]
then {
echo "Could not set password for test user $TEST_USER2"
@@ -164,9 +164,9 @@ do_cleanup() {
userdel $TEST_USER1
userdel $TEST_USER2
#REMOVE ANY TEMPOARY FILES THAT MAY STILL BE AROUND
- rm -f $TEST_ENV_FILE_USER &> /dev/null
- rm -f $TEST_ENV_FILE2 &> /dev/null
- rm -f $TEST_ENV_FILE &> /dev/null
+ rm -f $TEST_ENV_FILE_USER > /dev/null 2>&1
+ rm -f $TEST_ENV_FILE2 > /dev/null 2>&1
+ rm -f $TEST_ENV_FILE > /dev/null 2>&1
}
#-----------------------------------------------------------------------
diff --git a/testcases/kernel/containers/netns/child.sh b/testcases/kernel/containers/netns/child.sh
index a7fbc4b..6e8ed62 100755
--- a/testcases/kernel/containers/netns/child.sh
+++ b/testcases/kernel/containers/netns/child.sh
@@ -34,7 +34,7 @@ export TST_TOTAL
ping -qc 2 $IP1 > /dev/null
- if [ $? == 0 ] ; then
+ if [ $? = 0 ] ; then
tst_resm TINFO "PASS: Pinging ParentNS from ChildNS"
status=0
else
diff --git a/testcases/kernel/containers/netns/child_1.sh b/testcases/kernel/containers/netns/child_1.sh
index d44eebd..1fa71a7 100755
--- a/testcases/kernel/containers/netns/child_1.sh
+++ b/testcases/kernel/containers/netns/child_1.sh
@@ -65,7 +65,7 @@ export TST_TOTAL
# Pinging CHILD2 from CHILD1
debug "INFO: Trying for pinging CHILD2..."
ping -qc 2 $IP4 > /dev/null
- if [ $? == 0 ];
+ if [ $? = 0 ];
then
tst_resm TINFO "PASS: Child2 is pinging from CHILD1 !"
else
diff --git a/testcases/kernel/containers/netns/childipv6.sh b/testcases/kernel/containers/netns/childipv6.sh
index 4e904be..54bd6e6 100755
--- a/testcases/kernel/containers/netns/childipv6.sh
+++ b/testcases/kernel/containers/netns/childipv6.sh
@@ -52,7 +52,7 @@ status=0
#starting the sshd inside the child NS
/usr/sbin/sshd -p $PORT
- if [ $? == 0 ]; then
+ if [ $? = 0 ]; then
debug "INFO: started the sshd @ port no $PORT"
sshpid=`ps -ef | grep "sshd -p $PORT" | awk '{ print $2 ; exit 0} ' `
else
@@ -68,7 +68,7 @@ status=0
# checking if parent ns responding
ping6 -I $vnet1 -qc 2 $parIPv6 >/dev/null 2>&1
- if [ $? == 0 ] ; then
+ if [ $? = 0 ] ; then
tst_resm TINFO "IPv6: Pinging Parent from Child: PASS"
else
tst_resm TFAIL "IPv6: Pinging Parent from Child: FAIL"
diff --git a/testcases/kernel/containers/netns/childns.sh b/testcases/kernel/containers/netns/childns.sh
index 6fe47ab..5a831ba 100755
--- a/testcases/kernel/containers/netns/childns.sh
+++ b/testcases/kernel/containers/netns/childns.sh
@@ -41,7 +41,7 @@ export TST_TOTAL
. initialize.sh
status=0
- if [ $# == 1 ] ; then
+ if [ $# = 1 ] ; then
childscrpt=$1
debug "INFO: The script to be executed in child NS is $childscrpt"
fi
@@ -63,7 +63,7 @@ status=0
#starting the sshd inside the child NS
/usr/sbin/sshd -p $PORT
- if [ $? == 0 ]; then
+ if [ $? = 0 ]; then
debug "INFO: started the sshd @ port no $PORT"
sshpid=`ps -ef | grep "sshd -p $PORT" | awk '{ print $2 ; exit 0} ' `
else
diff --git a/testcases/kernel/containers/netns/delchild.sh b/testcases/kernel/containers/netns/delchild.sh
index 88822f2..d294e26 100755
--- a/testcases/kernel/containers/netns/delchild.sh
+++ b/testcases/kernel/containers/netns/delchild.sh
@@ -41,7 +41,7 @@ export TST_TOTAL
newnet=`cat /tmp/FIFO4`
debug "INFO: new dev is $newnet"
- if [ $newnet == -1 ] ; then
+ if [ $newnet = -1 ] ; then
status=-1
fi
@@ -50,17 +50,17 @@ export TST_TOTAL
debug "INFO: Deleting the child NS created.. "
debug "INFO: Killing processes $sshpid $pid"
kill -9 $sshpid $pid > /dev/null 2>&1
sleep 1
ls /sys/class/net > /tmp/sys_aftr_child_killed
diff -q /tmp/sys_b4_child_killed /tmp/sys_aftr_child_killed
- if [ $? == 0 ] ; then
+ if [ $? = 0 ] ; then
debug "INFO: No difference in the contents of sysfs after deleting the child"
else
grep -qw $newnet /tmp/sys_aftr_child_killed
- if [ $? == 0 ]; then
+ if [ $? = 0 ]; then
debug "INFO: Device $newnet is moved to ParentNS"
else
debug "INFO: Device $newnet is moved under diff name in ParentNS"
diff --git a/testcases/kernel/containers/netns/par_ftp.sh b/testcases/kernel/containers/netns/par_ftp.sh
index fa672a4..3bfb47b 100755
--- a/testcases/kernel/containers/netns/par_ftp.sh
+++ b/testcases/kernel/containers/netns/par_ftp.sh
@@ -35,7 +35,7 @@ export TST_TOTAL
ping -q -c 2 $IP2 > /dev/null
- if [ $? == 0 ] ; then
+ if [ $? = 0 ] ; then
tst_resm TINFO "Pinging ChildNS from ParentNS"
else
tst_resm TFAIL "Error: Unable to ping ChildNS from ParentNS"
diff --git a/testcases/kernel/containers/netns/parent.sh b/testcases/kernel/containers/netns/parent.sh
index a12f284..61bb500 100755
--- a/testcases/kernel/containers/netns/parent.sh
+++ b/testcases/kernel/containers/netns/parent.sh
@@ -33,7 +33,7 @@ export TST_COUNT
export TST_TOTAL
ping -q -c 2 $IP2 > /dev/null
- if [ $? == 0 ] ; then
+ if [ $? = 0 ] ; then
tst_resm TINFO "PASS: Pinging ChildNS from ParentNS"
status=0
else
diff --git a/testcases/kernel/containers/netns/parent_1.sh b/testcases/kernel/containers/netns/parent_1.sh
index b42436e..1b91a58 100755
--- a/testcases/kernel/containers/netns/parent_1.sh
+++ b/testcases/kernel/containers/netns/parent_1.sh
@@ -38,7 +38,7 @@ export TST_TOTAL
create_veth
vnet0=$dev0
vnet1=$dev1
- if [[ -z $vnet0 || -z $vnet1 ]] ; then
+ if [ -z "$vnet0" -o -z "$vnet1" ] ; then
tst_resm TFAIL "Error: unable to create veth pair in $0"
exit -1
else
diff --git a/testcases/kernel/containers/netns/parent_2.sh b/testcases/kernel/containers/netns/parent_2.sh
index 86eb172..c39bc7c 100755
--- a/testcases/kernel/containers/netns/parent_2.sh
+++ b/testcases/kernel/containers/netns/parent_2.sh
@@ -35,7 +35,7 @@ export TST_TOTAL
vnet2=$dev0
vnet3=$dev1
- if [[ -z $vnet2 || -z $vnet3 ]] ; then
+ if [ -z "$vnet2" -o -z "$vnet3" ] ; then
tst_resm TFAIL "Error: unable to create veth pair in $0"
exit -1
else
diff --git a/testcases/kernel/containers/netns/parentns.sh b/testcases/kernel/containers/netns/parentns.sh
index 43cdcdb..b6488a4 100755
--- a/testcases/kernel/containers/netns/parentns.sh
+++ b/testcases/kernel/containers/netns/parentns.sh
@@ -43,7 +43,7 @@ export TST_TOTAL
status=0
# Checks if any script is passed as argument.
- if [ $# == 2 ]; then
+ if [ $# = 2 ]; then
scrpt=$1
debug "INFO: Script to be executed in parent NS is $scrpt"
fi
@@ -56,7 +56,7 @@ status=0
create_veth
vnet0=$dev0
vnet1=$dev1
- if [[ -z $vnet0 || -z $vnet1 ]] ; then
+ if [ -z "$vnet0" -o -z "$vnet1" ] ; then
tst_resm TFAIL "Error: unable to create veth pair"
exit -1
else
diff --git a/testcases/kernel/containers/netns/paripv6.sh b/testcases/kernel/containers/netns/paripv6.sh
index 568c86f..67c8636 100755
--- a/testcases/kernel/containers/netns/paripv6.sh
+++ b/testcases/kernel/containers/netns/paripv6.sh
@@ -49,7 +49,7 @@ status=0
create_veth
vnet0=$dev0
vnet1=$dev1
- if [[ -z $vnet0 || -z $vnet1 ]] ; then
+ if [ -z "$vnet0" -o -z "$vnet1" ] ; then
tst_resm TFAIL "Error: unable to create veth pair"
exit -1
else
@@ -76,7 +76,7 @@ status=0
echo $parIPv6 > /tmp/FIFO4
ping6 -I $vnet0 -qc 2 $childIPv6 >/dev/null 2>&1
- if [ $? == 0 ] ; then
+ if [ $? = 0 ] ; then
tst_resm TINFO "IPv6: Pinging child from parent: PASS"
status=0
else
diff --git a/testcases/kernel/containers/netns/rename_net.sh b/testcases/kernel/containers/netns/rename_net.sh
index cadf7e2..ffbe07f 100755
--- a/testcases/kernel/containers/netns/rename_net.sh
+++ b/testcases/kernel/containers/netns/rename_net.sh
@@ -46,9 +46,9 @@ export TST_TOTAL
ip link set $vnet1 name $newdev
ifconfig $newdev $IP2/24 up > /dev/null 2>&1
- if [ $? == 0 ] ; then
+ if [ $? = 0 ] ; then
tst_resm TINFO "Successfully Renamed device to $newdev"
- if [ DEBUG == 1 ]; then
+ if [ "$DEBUG" = 1 ]; then
ifconfig
fi
else
@@ -56,7 +56,7 @@ export TST_TOTAL
status=-1
fi
- if [ $status == 0 ] ; then
+ if [ $status = 0 ] ; then
echo $sshpid > /tmp/FIFO3
echo $newdev > /tmp/FIFO4
else
diff --git a/testcases/kernel/power_management/runpwtests.sh b/testcases/kernel/power_management/runpwtests.sh
index 00c8126..e1a25ce 100755
--- a/testcases/kernel/power_management/runpwtests.sh
+++ b/testcases/kernel/power_management/runpwtests.sh
@@ -77,7 +77,7 @@ else
fi
# Test sched_smt_power_savings interface on HT machines
-((TST_COUNT= $TST_COUNT + 1))
+: $(( TST_COUNT += 1 ))
if [ -f /sys/devices/system/cpu/sched_smt_power_savings ] ; then
if test_sched_smt.sh; then
tst_resm TPASS "SCHED_SMT sysfs test"
@@ -96,7 +96,7 @@ fi
# Checking cpufreq sysfs interface files
#check_config.sh config_cpu_freq || RC=$?
-((TST_COUNT= $TST_COUNT + 1))
+: $(( TST_COUNT += 1 ))
if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then
if check_cpufreq_sysfs_files.sh; then
tst_resm TPASS "CPUFREQ sysfs tests"
@@ -106,7 +106,7 @@ if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then
fi
# Changing governors
- ((TST_COUNT= $TST_COUNT + 1))
+ : $(( TST_COUNT += 1 ))
if change_govr.sh; then
tst_resm TPASS "Changing governors "
else
@@ -115,7 +115,7 @@ if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then
fi
# Changing frequencies
- ((TST_COUNT= $TST_COUNT + 1))
+ : $(( TST_COUNT += 1 ))
if change_freq.sh ; then
tst_resm TPASS "Changing frequncies "
else
@@ -124,7 +124,7 @@ if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then
fi
# Loading and Unloading governor related kernel modules
- ((TST_COUNT= $TST_COUNT + 1))
+ : $(( TST_COUNT += 1 ))
if pwkm_load_unload.sh ; then
tst_resm TPASS "Loading and Unloading of governor kernel \
modules"
@@ -138,7 +138,7 @@ else
fi
# Checking cpuidle sysfs interface files
-(( TST_COUNT= $TST_COUNT +1))
+: $(( TST_COUNT+=1))
if check_cpuidle_sysfs_files.sh ; then
tst_resm TPASS "CPUIDLE sysfs tests passed"
else
@@ -154,21 +154,21 @@ test cannot run"
else
get_max_sched_mc; max_sched_mc=$?
for sched_mc in `seq 0 $max_sched_mc`; do
- (( TST_COUNT= $TST_COUNT +1))
+ : $(( TST_COUNT+=1))
sched_domain.py -c $sched_mc; RC=$?
analyze_sched_domain_result $sched_mc $RC
if [ $hyper_threaded -eq $YES ]; then
get_max_sched_smt ; max_sched_smt=$?
for sched_smt in `seq 0 $max_sched_smt`; do
# Testcase to validate sched_domain tree
- (( TST_COUNT= $TST_COUNT +1))
+ : $(( TST_COUNT+=1))
sched_domain.py -c $sched_mc -t $sched_smt; RC=$?
analyze_sched_domain_result $sched_mc $RC $sched_smt ;
done
fi
done
fi
-if [ $# -gt 0 -a $1 == "-exclusive" ]; then
+if [ $# -gt 0 -a "$1" = "-exclusive" ]; then
# Test CPU consolidation
which python > /dev/null
if [ $? -ne 0 ] ; then
@@ -180,12 +180,12 @@ if [ $# -gt 0 -a $1 == "-exclusive" ]; then
for sched_mc in `seq 0 $max_sched_mc`; do
for work_load in ${work_loads_list}
do
- ((TST_COUNT= $TST_COUNT + 1))
+ : $(( TST_COUNT += 1 ))
sched_mc_pass_cnt=0
for repeat_test in `seq 1 10`; do
#Testcase to validate CPU consolidation for sched_mc
if cpu_consolidation.py -c $sched_mc -w $work_load ; then
- ((sched_mc_pass_cnt= $sched_mc_pass_cnt +1))
+ : $(( sched_mc_pass_cnt += 1 ))
fi
done
analyze_consolidation_result $sched_mc $work_load $sched_mc_pass_cnt
@@ -193,13 +193,13 @@ if [ $# -gt 0 -a $1 == "-exclusive" ]; then
if [ $hyper_threaded -eq $YES ]; then
for sched_smt in `seq 0 $max_sched_smt`; do
for work_load in ${work_loads_list}; do
- ((TST_COUNT= $TST_COUNT + 1))
+ : $(( TST_COUNT += 1 ))
sched_mc_smt_pass_cnt=0
for repeat_test in `seq 1 10`; do
# Testcase to validate CPU consolidation for
# for sched_mc & sched_smt with stress=50%
if cpu_consolidation.py -c $sched_mc -t $sched_smt -w $work_load; then
- ((sched_mc_smt_pass_cnt= $sched_mc_smt_pass_cnt +1))
+ : $(( sched_mc_smt_pass_cnt += 1 ))
fi
done
analyze_consolidation_result $sched_mc $work_load $sched_mc_smt_pass_cnt $sched_smt
@@ -207,10 +207,10 @@ if [ $# -gt 0 -a $1 == "-exclusive" ]; then
#Testcase to validate consolidation at core level
sched_mc_smt_pass_cnt=0
stress="thread"
- ((TST_COUNT= $TST_COUNT + 1))
+ : $(( TST_COUNT += 1 ))
for repeat_test in `seq 1 10`; do
if cpu_consolidation.py -c $sched_mc -t $sched_smt -w $work_load -s $stress; then
- ((sched_mc_smt_pass_cnt= $sched_mc_smt_pass_cnt +1))
+ : $(( sched_mc_smt_pass_cnt += 1 ))
fi
done
analyze_consolidation_result $sched_mc $work_load $sched_mc_smt_pass_cnt $sched_smt $stress
diff --git a/testcases/kernel/sched/hyperthreading/ht_enabled/smt_smp_enabled.sh b/testcases/kernel/sched/hyperthreading/ht_enabled/smt_smp_enabled.sh
index 85d42a3..8b8a909 100755
--- a/testcases/kernel/sched/hyperthreading/ht_enabled/smt_smp_enabled.sh
+++ b/testcases/kernel/sched/hyperthreading/ht_enabled/smt_smp_enabled.sh
@@ -64,7 +64,7 @@ else
cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | cut -f 2 -d ':'\
| sed 's/ //' | uniq`
- if [ $cpu_cores == 1 ];then
+ if [ $cpu_cores -eq 1 ];then
tst_resm TPASS "SMT is enable"
elif [ $cpu_cores -ge 2 ];then
tst_resm TPASS "SMP System"
diff --git a/testcases/kernel/syscalls/ioctl/test_ioctl b/testcases/kernel/syscalls/ioctl/test_ioctl
index 2ea3e39..7ae9e71 100755
--- a/testcases/kernel/syscalls/ioctl/test_ioctl
+++ b/testcases/kernel/syscalls/ioctl/test_ioctl
@@ -25,7 +25,7 @@ export TST_COUNT=0
for tttype in `ls /dev/tty*`
do
-device_no=${tttype:8}
+device_no=${tttype#/dev/tty}
case "$device_no" in
[0-9]|[0-9][0-9])
tst_resm TINFO "Testing ioctl01 with $tttype"
@@ -43,7 +43,7 @@ done
for tttype in `ls /dev/tty*`
do
-device_no=${tttype:8}
+device_no=${tttype#/dev/tty}
case "$device_no" in
[0-9]|[0-9][0-9])
tst_resm TINFO "Testing ioctl02 with $tttype"
diff --git a/testcases/misc/tcore_patch_test_suites/tcore.sh b/testcases/misc/tcore_patch_test_suites/tcore.sh
index f087fa7..4b032dc 100755
--- a/testcases/misc/tcore_patch_test_suites/tcore.sh
+++ b/testcases/misc/tcore_patch_test_suites/tcore.sh
@@ -107,13 +107,13 @@ Test_gen_core()
rm -f core.*
fi
pid=`$BIN_DIR/tcore |grep "consumer pid"|awk '{print $2}'|cut -d = -f 2`
- echo -e "Test whether we can generate the needed core file"
+ echo "Test whether we can generate the needed core file"
if [ -f core.* ];then
- echo -e "PASS"
+ echo "PASS"
pass=`expr $pass + 1`
return 0
else
- echo -e "FAIL"
+ echo "FAIL"
fail=`expr $fail + 1`
return 1
fi
@@ -124,14 +124,14 @@ Test_core_file()
cd $TEST_DIR
prepare_gdb
mv -f $TEST_DIR/core.* $TEST_DIR/corefile >/dev/null 2>&1
- echo -e "Test whether the core support bt,fpu and threads commands "
+ echo "Test whether the core support bt,fpu and threads commands "
expect $BIN_DIR/tcore.exp
return=$?
pass=`expr $pass + $return`
fail=`expr 3 - $return + $fail`
}
-echo -e "Test Tcore patch "
+echo "Test Tcore patch "
check_install
Test_gen_core
Test_core_file
diff --git a/testcases/network/iproute/ip_tests.sh b/testcases/network/iproute/ip_tests.sh
index c622700..59322b6 100755
--- a/testcases/network/iproute/ip_tests.sh
+++ b/testcases/network/iproute/ip_tests.sh
@@ -61,7 +61,7 @@ init()
trap "cleanup" 0
# create the tmp directory for this testcase.
- mkdir -p $LTPTMP/ &>/dev/null || RC=$?
+ mkdir -p $LTPTMP/ >/dev/null 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brkm TBROK "INIT: Unable to create temporary directory"
@@ -69,7 +69,7 @@ init()
fi
# Check to see if test harness functions are in the path.
- which tst_resm &>$LTPTMP/tst_ip.err || RC=$?
+ which tst_resm >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brkm TBROK NULL \
@@ -77,7 +77,7 @@ init()
return $RC
fi
- which awk &>$LTPTMP/tst_ip.err || RC=$?
+ which awk >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brkm TBROK NULL \
@@ -85,7 +85,7 @@ init()
return $RC
fi
- which ip &>$LTPTMP/tst_ip.err || RC=$?
+ which ip >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brkm TBROK NULL \
@@ -93,7 +93,7 @@ init()
return $RC
fi
- which ifconfig &>$LTPTMP/tst_ip.err || RC=$?
+ which ifconfig >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brkm TBROK NULL \
@@ -104,13 +104,13 @@ init()
tst_resm TINFO "INIT: Inititalizing tests."
# Aliasing eth0 to create private network.
- /sbin/ifconfig eth0:1 10.1.1.12 &>$LTPTMP/tst_ip.err || RC=$?
+ /sbin/ifconfig eth0:1 10.1.1.12 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brk TBROK "INIT: failed aliasing eth0:1 with IP 10.1.1.12"
return $RC
else
- /sbin/route add -host 10.1.1.12 dev eth0:1 &>$LTPTMP/tst_ip.err \
+ /sbin/route add -host 10.1.1.12 dev eth0:1 >$LTPTMP/tst_ip.err 2>&1 \
|| RC=$?
if [ $RC -ne 0 ]
then
@@ -153,10 +153,10 @@ cleanup()
TST_COUNT=0
RC=0
- /sbin/ifconfig eth0:1 &>$LTPTMP/tst_ip.err || RC=$?
+ /sbin/ifconfig eth0:1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -eq 0 ]
then
- /sbin/ifconfig eth0:1 down &>$LTPTMP/tst_ip.err
+ /sbin/ifconfig eth0:1 down >$LTPTMP/tst_ip.err 2>&1
fi
rm -fr $LTPTMP
@@ -187,7 +187,7 @@ test01()
tst_resm TINFO "Test #1: changing mtu size of eth0:1 device."
- ip link set eth0:1 mtu 300 &>$LTPTMP/tst_ip.err
+ ip link set eth0:1 mtu 300 >$LTPTMP/tst_ip.err 2>&1
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -232,7 +232,7 @@ test02()
tst_resm TINFO \
"Test #2: Installing dummy.o in kernel"
- modprobe dummy &>$LTPTMP/tst_ip.out || RC=$?
+ modprobe dummy >$LTPTMP/tst_ip.out 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brk TBROK $LTPTMP/tst_ip.out NULL \
@@ -240,7 +240,7 @@ test02()
return $RC
fi
- ip link show dummy0 | grep dummy0 &>$LTPTMP/tst_ip.err || RC=$?
+ ip link show dummy0 | grep dummy0 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err "Test #2: ip command failed. Reason:"
@@ -278,7 +278,7 @@ test03()
tst_resm TINFO \
"Test #3: ip addr add - adds a new protolcol address to the device"
- ip addr add 127.6.6.6 dev lo &>$LTPTMP/tst_ip.err || RC=$?
+ ip addr add 127.6.6.6 dev lo >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -287,7 +287,7 @@ test03()
else
tst_resm TINFO \
"Test #3: ip addr show dev <device> - shows protocol address."
- ip addr show dev lo | grep 127.6.6.6 &>$LTPTMP/tst_ip.err || RC=$?
+ ip addr show dev lo | grep 127.6.6.6 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -297,14 +297,14 @@ test03()
tst_resm TINFO \
"Test #3: ip addr del <ip> dev <device> - deletes protocol address."
- ip addr del 127.6.6.6 dev lo &>$LTPTMP/tst_ip.err || RC=$?
+ ip addr del 127.6.6.6 dev lo >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
"Test #3: ip addr del command failed. Reason: "
return $RC
else
- ip addr show dev lo | grep 127.6.6.6 &>$LTPTMP/tst_ip.err || RC=$?
+ ip addr show dev lo | grep 127.6.6.6 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -eq 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -343,7 +343,7 @@ test04()
tst_resm TINFO \
"Test #4: ip neigh add - adds a new neighbour to arp tables."
- ip neigh add 127.0.0.1 dev lo nud reachable &>$LTPTMP/tst_ip.err || RC=$?
+ ip neigh add 127.0.0.1 dev lo nud reachable >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -357,7 +357,7 @@ test04()
127.0.0.1 dev lo lladdr 00:00:00:00:00:00 nud reachable
EOF
- ip neigh show 127.0.0.1 | head -n1 &>$LTPTMP/tst_ip.out || RC=$?
+ ip neigh show 127.0.0.1 | head -n1 >$LTPTMP/tst_ip.out 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -365,7 +365,7 @@ test04()
return $RC
else
diff -iwB $LTPTMP/tst_ip.out $LTPTMP/tst_ip.exp \
- &>$LTPTMP/tst_ip.err || RC=$?
+ >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res FAIL $LTPTMP/tst_ip.err \
@@ -377,14 +377,14 @@ test04()
tst_resm TINFO \
"Test #4: ip neigh del - deletes neighbour from the arp table."
- ip neigh del 127.0.0.1 dev lo &>$LTPTMP/tst_ip.err || RC=$?
+ ip neigh del 127.0.0.1 dev lo >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
"Test #4: ip neigh del command failed return = $RC. Reason: "
return $RC
else
- ip neigh show | grep 127.0.0.1 grep -v "nud failed$" &>$LTPTMP/tst_ip.err || RC=$?
+ ip neigh show | grep 127.0.0.1 grep -v "nud failed$" >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -eq 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -426,7 +426,7 @@ test05()
tst_resm TINFO \
"Test #5: create an interface with inet 10.6.6.6 alias to eth0"
- ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 &>$LTPTMP/tst_ip.err || RC=$?
+ ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brk TBROK $LTPTMP/tst_ip.err NULL \
@@ -434,7 +434,7 @@ test05()
return $RC
fi
- ip route add 10.6.6.6 via 127.0.0.1 &>$LTPTMP/tst_ip.err || RC=$?
+ ip route add 10.6.6.6 via 127.0.0.1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -449,7 +449,7 @@ test05()
10.6.6.6 via 127.0.0.1 dev lo
EOF
- ip route show | head -n1 &>$LTPTMP/tst_ip.out || RC=$?
+ ip route show | head -n1 >$LTPTMP/tst_ip.out 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -457,7 +457,7 @@ test05()
return $RC
else
diff -iwB $LTPTMP/tst_ip.out $LTPTMP/tst_ip.exp \
- &>$LTPTMP/tst_ip.err || RC=$?
+ >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res FAIL $LTPTMP/tst_ip.err \
@@ -469,14 +469,14 @@ test05()
tst_resm TINFO \
"Test #5: ip route del - deletes route from the route table."
- ip route del 10.6.6.6 via 127.0.0.1 &>$LTPTMP/tst_ip.err || RC=$?
+ ip route del 10.6.6.6 via 127.0.0.1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
"Test #5: ip route del command failed return = $RC. Reason: "
return $RC
else
- ip route show | grep 127.0.0.1 &>$LTPTMP/tst_ip.err || RC=$?
+ ip route show | grep 127.0.0.1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -eq 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -514,7 +514,7 @@ test06()
tst_resm TINFO \
"Test #6: ip maddr add - adds a new multicast addr"
- ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 &>$LTPTMP/tst_ip.err || RC=$?
+ ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brk TBROK $LTPTMP/tst_ip.err NULL \
@@ -522,7 +522,7 @@ test06()
return $RC
fi
- ip maddr add 66:66:00:00:00:66 dev eth0:1 &>$LTPTMP/tst_ip.err || RC=$?
+ ip maddr add 66:66:00:00:00:66 dev eth0:1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -536,7 +536,7 @@ test06()
link 66:66:00:00:00:66 static
EOF
- ip maddr show | grep "66:66:00:00:00:66" &>$LTPTMP/tst_ip.out || RC=$?
+ ip maddr show | grep "66:66:00:00:00:66" >$LTPTMP/tst_ip.out 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -556,7 +556,7 @@ test06()
tst_resm TINFO \
"Test #6: ip maddr del - deletes multicast addr."
- ip maddr del 66:66:00:00:00:66 dev eth0:1 &>$LTPTMP/tst_ip.err || RC=$?
+ ip maddr del 66:66:00:00:00:66 dev eth0:1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
diff --git a/testcases/network/nfs/nfs03/nfs03 b/testcases/network/nfs/nfs03/nfs03
index 8cbd3a4..bbc79e9 100755
--- a/testcases/network/nfs/nfs03/nfs03
+++ b/testcases/network/nfs/nfs03/nfs03
@@ -91,10 +91,10 @@ fs_inod()
#
# RETURNS: None.
#=============================================================================
-function err_log
+err_log()
{
error "$1"
- let step_errors="$step_errors + 1"
+ : $(($step_errors+=1))
}
@@ -107,7 +107,7 @@ function err_log
#
# RETURNS: None.
#=============================================================================
-function make_subdirs
+make_subdirs()
{
i=0;
while [ "$i" -lt "$numsubdirs" ]; do
@@ -115,7 +115,7 @@ function make_subdirs
echo "$0: mkdir dir$i"
mkdir -p dir$i || echo "mkdir dir$i FAILED"
}
- let i="$i + 1"
+ : $(( i += 1 ))
done;
}
@@ -129,7 +129,7 @@ function make_subdirs
#
# RETURNS: None.
#=============================================================================
-function touch_files
+touch_files()
{
echo "$0: touch files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
j=0;
@@ -140,10 +140,10 @@ function touch_files
while [ "$k" -lt "$numfiles" ]; do
>file$j$k || err_log ">file$j$k FAILED"
- let k="$k + 1"
+ : $(( k += 1 ))
done
- let j="$j + 1"
+ : $(( j += 1 ))
cd ..
done
}
@@ -158,7 +158,7 @@ function touch_files
#
# RETURNS: None.
#=============================================================================
-function rm_files
+rm_files()
{
echo "$0: rm files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
j=0;
@@ -169,10 +169,10 @@ function rm_files
while [ "$k" -lt "$numfiles" ]; do
rm -f file$j$k || err_log "rm -f file$j$k FAILED"
- let k="$k + 1"
+ : $(( k += 1 ))
done
- let j="$j + 1"
+ : $(( j += 1 ))
cd ..
done
}
@@ -187,7 +187,7 @@ function rm_files
#
# RETURNS: None.
#=============================================================================
-function step1
+step1()
{
echo "=============================================="
echo "MULTIPLE PROCESSES CREATING AND DELETING FILES"
@@ -240,7 +240,7 @@ function step1
rm_files &
pid2=$!
- let i="$i + 1"
+ : $(( i += 1 ))
done
# wait for all background processes to complete execution
@@ -376,7 +376,7 @@ $trace_logic
echo "fs_inod starting on $TCtmp."
fs_inod $TCtmp $DIR_NUM $FILE_NUM 1
retval=$?
- echo $"fs_inod on $TCtmp finished."
+ echo "fs_inod on $TCtmp finished."
if [ "$retval" != 0 ]; then
end_testcase "Errors have resulted from this test: fs_inod returned $retval."
--
1.6.3.3
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 28+ messages in thread* Re: [LTP] [PATCH] Fix some bashisms
2009-07-07 8:35 [LTP] [PATCH] Fix some bashisms Jiri Palecek
@ 2009-07-07 15:32 ` Subrata Modak
2009-07-07 16:26 ` Garrett Cooper
2009-07-08 19:05 ` Mike Frysinger
2009-07-08 18:13 ` Subrata Modak
1 sibling, 2 replies; 28+ messages in thread
From: Subrata Modak @ 2009-07-07 15:32 UTC (permalink / raw)
To: Jiri Palecek; +Cc: ltp-list
I can find that they addressed all issues of Mike and Matt. However, i
would just wait for some more confirmation from them. Thanks.
Regards--
Subrata
On Tue, 2009-07-07 at 10:35 +0200, Jiri Palecek wrote:
> Hello,
>
> this patch reflects the comments by various people to the previous versions. It uses "+=1" instead of postincrement because of dash, ['s boolean expressions, printf for the formatting. I've left the unzip pushd/popd and the signal names issue completely.
>
> Regards
> Jiri Palecek
>
> ---
> runalltests.sh | 58 +++++++++---------
> testcases/commands/cron/cron02 | 4 +-
> testcases/commands/cron/cron03 | 2 +-
> testcases/commands/cron/cron_allow01 | 10 ++--
> testcases/commands/cron/cron_deny01 | 14 ++--
> testcases/commands/su/su01 | 18 +++---
> testcases/kernel/containers/netns/child.sh | 2 +-
> testcases/kernel/containers/netns/child_1.sh | 2 +-
> testcases/kernel/containers/netns/childipv6.sh | 4 +-
> testcases/kernel/containers/netns/childns.sh | 4 +-
> testcases/kernel/containers/netns/delchild.sh | 8 +-
> testcases/kernel/containers/netns/par_ftp.sh | 2 +-
> testcases/kernel/containers/netns/parent.sh | 2 +-
> testcases/kernel/containers/netns/parent_1.sh | 2 +-
> testcases/kernel/containers/netns/parent_2.sh | 2 +-
> testcases/kernel/containers/netns/parentns.sh | 4 +-
> testcases/kernel/containers/netns/paripv6.sh | 4 +-
> testcases/kernel/containers/netns/rename_net.sh | 6 +-
> testcases/kernel/power_management/runpwtests.sh | 32 +++++-----
> .../hyperthreading/ht_enabled/smt_smp_enabled.sh | 2 +-
> testcases/kernel/syscalls/ioctl/test_ioctl | 4 +-
> testcases/misc/tcore_patch_test_suites/tcore.sh | 11 ++--
> testcases/network/iproute/ip_tests.sh | 62 ++++++++++----------
> testcases/network/ipv6/perf_lan6/perf_lan6 | 4 +-
> testcases/network/ipv6/tcpdump6/tcpdump601 | 2 +-
> testcases/network/multicast/mc_commo/mc_commo | 4 +-
> testcases/network/multicast/mc_member/mc_member | 2 +-
> testcases/network/multicast/mc_opts/mc_opts | 2 +-
> testcases/network/nfs/nfs03/nfs03 | 26 ++++----
> .../network/rpc/basic_tests/rpcinfo/rpcinfo01 | 6 +-
> testcases/network/tcp_cmds/perf_lan/perf_lan | 4 +-
> testcases/network/tcp_cmds/tcpdump/tcpdump01 | 2 +-
> 32 files changed, 156 insertions(+), 155 deletions(-)
>
> diff --git a/runalltests.sh b/runalltests.sh
> index aa7a7d5..b710469 100755
> --- a/runalltests.sh
> +++ b/runalltests.sh
> @@ -29,17 +29,17 @@
> ## ##
> ################################################################################
>
> -echo -e "*******************************************************************"
> -echo -e "*******************************************************************"
> -echo -e "** **"
> -echo -e "** This script is being re-written to cover all aspects of **"
> -echo -e "** testing LTP, which includes running all those tests which **"
> -echo -e "** are not run by default with ./runltp script. Special setup **"
> -echo -e "** in system environment will be done to run all those tests **"
> -echo -e "** like the File System tests, SELinuxtest, etc **"
> -echo -e "** **"
> -echo -e "*******************************************************************"
> -echo -e "*******************************************************************"
> +echo "*******************************************************************"
> +echo "*******************************************************************"
> +echo "** **"
> +echo "** This script is being re-written to cover all aspects of **"
> +echo "** testing LTP, which includes running all those tests which **"
> +echo "** are not run by default with ./runltp script. Special setup **"
> +echo "** in system environment will be done to run all those tests **"
> +echo "** like the File System tests, SELinuxtest, etc **"
> +echo "** **"
> +echo "*******************************************************************"
> +echo "*******************************************************************"
>
> export LTPROOT=${PWD}
> export RUN_BALLISTA=0
> @@ -210,19 +210,19 @@ export HTML_OUTPUT_FILE_NAME=$LTP_VERSION_$HOSTNAME_$KERNEL_VERSION_$HARDWARE_TY
>
> ## The First one i plan to run is the default LTP run ##
> ## START => Test Series 1 ##
> -echo -e "Running Default LTP..."
> +echo "Running Default LTP..."
> ./runltp -g $HTML_OUTPUT_FILE_NAME
> -echo -e "Completed running Default LTP\n\n"
> +printf "Completed running Default LTP\n\n\n"
> ## END => Test Series 1 ##
>
> ## The next one i plan to run is ballista ##
> ## START => Test Series 2 ##
> if [ $RUN_BALLISTA -eq 1 ]
> then
> - echo -e "Running Ballista..."
> + echo "Running Ballista..."
> export TEST_START_TIME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`
> ./runltp -f ballista -o $LTP_VERSION-BALLISTA_RUN_ON-$HOSTNAME-$KERNEL_VERSION-$HARDWARE_TYPE-$TEST_START_TIME.out
> - echo -e "Completed running Ballista\n\n"
> + printf "Completed running Ballista\n\n\n"
> fi
> ## END => Test Series 2 ##
>
> @@ -230,9 +230,9 @@ fi
> ## START => Test Series 3 ##
> if [ $RUN_OPENPOSIX -eq 1 ]
> then
> - echo -e "Running Open Posix Tests..."
> + echo "Running Open Posix Tests..."
> (cd testcases/open_posix_testsuite; make)
> - echo -e "Completed running Open Posix Tests\n\n"
> + printf "Completed running Open Posix Tests\n\n\n"
> fi
> ## END => Test Series 3 ##
>
> @@ -242,9 +242,9 @@ fi
> ## START => Test Series 4 ##
> if [ $RUN_MM_CORE_APIS -eq 1 ]
> then
> - echo -e "Initializing ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
> + echo "Initializing ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
> # Check to see if User is Root
> - if [ $EUID -ne 0 ]
> + if [ $(id -u) -ne 0 ]
> then
> echo You need to be root to Install libmm and run mem/libmm/mm_core_apis
> echo Aborting ltp/testcases/kernel/mem/libmm/mm_core_apis
> @@ -262,13 +262,13 @@ then
> else
> echo libmm-1.4.2 already installed in your system
> fi
> - echo -e "Running ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
> + echo "Running ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
> (cd testcases/kernel/mem/libmm; \
> make; \
> make install; \
> $LTPROOT/testcases/bin/mm_core_apis; )
> fi
> - echo -e "Completed running ltp/testcases/kernel/mem/libmm/mm_core_apis...\n\n"
> + printf "Completed running ltp/testcases/kernel/mem/libmm/mm_core_apis...\n\n\n"
> fi
> ## END => Test Series 4 ##
>
> @@ -278,9 +278,9 @@ fi
> ## START => Test Series 5 ##
> if [ $RUN_AIOTESTS -eq 1 ]
> then
> - echo -e "Initializing ltp/testcases/kernel/io/aio ..."
> + echo "Initializing ltp/testcases/kernel/io/aio ..."
> # Check to see if User is Root
> - if [ $EUID -ne 0 ]
> + if [ $(id -u) -ne 0 ]
> then
> echo You need to be root to Install libaio-0.3.92 and run ltp/testcases/kernel/io/aio
> echo Aborting ltp/testcases/kernel/io/aio
> @@ -298,13 +298,13 @@ if [ $RUN_AIOTESTS -eq 1 ]
> else
> echo libaio-0.3.92 already installed in your system
> fi
> - echo -e "Building & Running ltp/testcases/kernel/io/aio..."
> + echo "Building & Running ltp/testcases/kernel/io/aio..."
> (cd testcases/kernel/io/aio; \
> make > /dev/null; \
> ./aio01/aio01; \
> ./aio02/runfstests.sh -a aio02/cases/aio_tio; \
> make clean 1>&2 > /dev/null )
> - echo -e "Completed running ltp/testcases/kernel/io/aio...\n\n"
> + printf "Completed running ltp/testcases/kernel/io/aio...\n\n\n"
> fi
> fi
> ## END => Test Series 5 ##
> @@ -316,9 +316,9 @@ fi
> ## START => Test Series 6 ##
> if [ $RUN_FILECAPS -eq 1 ]
> then
> - echo -e "Initializing ltp/testcases/kernel/security/filecaps ..."
> + echo "Initializing ltp/testcases/kernel/security/filecaps ..."
> # Check to see if User is Root
> - if [ $EUID -ne 0 ]
> + if [ $(id -u) -ne 0 ]
> then
> echo You need to be root to Install libcaps and run ltp/testcases/kernel/security/filecaps
> echo Aborting ltp/testcases/kernel/security/filecaps
> @@ -336,11 +336,11 @@ then
> else
> echo libcaps already installed in your system
> fi
> - echo -e "Building & Running ltp/testcases/kernel/security/filecaps"
> + echo "Building & Running ltp/testcases/kernel/security/filecaps"
> (cd ltp/testcases/kernel/security/filecaps; \
> make && make install > /dev/null; )
> ./runltp -f filecaps
> - echo -e "Completed running ltp/testcases/kernel/io/aio...\n\n"
> + printf "Completed running ltp/testcases/kernel/io/aio...\n\n\n"
> fi
> fi
> ## END => Test Series 6 ##
> diff --git a/testcases/commands/cron/cron02 b/testcases/commands/cron/cron02
> index c1dc245..6e4d8fe 100755
> --- a/testcases/commands/cron/cron02
> +++ b/testcases/commands/cron/cron02
> @@ -37,7 +37,7 @@ TEST_USER_HOMEDIR="/home/$TEST_USER"
>
> do_setup(){
> #erase any data from potential defunt cron test
> - rm -rf /tmp/crontest &> /dev/null
> + rm -rf /tmp/crontest > /dev/null 2>&1
>
> #erase user if he may exist , so we can have a clean env
> rm -rf /home/$TEST_USER
> @@ -56,7 +56,7 @@ do_setup(){
> # Red Hat uses crond, SuSE/Other uses cron. Check if this is Red Hat/SuSE/Other
> tvar=${MACHTYPE%-*}
> tvar=${tvar#*-}
> -echo "Distro type is: $tvar \n"
> +printf "Distro type is: $tvar\n\n"
>
> if [ $tvar != "redhat" -a $tvar != "redhat-linux" ]; then
>
> diff --git a/testcases/commands/cron/cron03 b/testcases/commands/cron/cron03
> index 58fbe1b..9448cc4 100755
> --- a/testcases/commands/cron/cron03
> +++ b/testcases/commands/cron/cron03
> @@ -59,7 +59,7 @@ do_setup(){
> # Red Hat uses crond, SuSE/Other uses cron. Check if this is Red Hat/SuSE/Other
> tvar=${MACHTYPE%-*}
> tvar=${tvar#*-}
> -echo "Distro type is: $tvar \n"
> +printf "Distro type is: $tvar\n\n"
>
> if [ $tvar != "redhat" -a $tvar != "redhat-linux" ]; then
>
> diff --git a/testcases/commands/cron/cron_allow01 b/testcases/commands/cron/cron_allow01
> index 839ad81..266700a 100755
> --- a/testcases/commands/cron/cron_allow01
> +++ b/testcases/commands/cron/cron_allow01
> @@ -47,9 +47,9 @@ TEST_USER2_HOME="/home/$TEST_USER2"
>
> do_setup() {
> #move any files that may get in the way
> - rm /tmp/cron_allow_test &> /dev/null
> - rm /tmp/cron_allow_test1 &> /dev/null
> - mv $CRON_ALLOW $CRON_ALLOW.old &> /dev/null
> + rm /tmp/cron_allow_test > /dev/null 2>&1
> + rm /tmp/cron_allow_test1 > /dev/null 2>&1
> + mv $CRON_ALLOW $CRON_ALLOW.old > /dev/null 2>&1
>
> #remove users for clean enviroment
> su $TEST_USER1 -c "crontab -r"
> @@ -90,8 +90,8 @@ do_cleanup(){
> userdel $TEST_USER1
> userdel $TEST_USER2
> rm $CRON_ALLOW
> - mv $CRON_ALLOW.old $CRON_ALLOW &> /dev/null
> - rm /tmp/cron_allow_test &>/dev/null
> + mv $CRON_ALLOW.old $CRON_ALLOW > /dev/null 2>&1
> + rm /tmp/cron_allow_test >/dev/null 2>&1
> }
>
> #-----------------------------------------------------------------------
> diff --git a/testcases/commands/cron/cron_deny01 b/testcases/commands/cron/cron_deny01
> index f7f8fd4..527d79c 100755
> --- a/testcases/commands/cron/cron_deny01
> +++ b/testcases/commands/cron/cron_deny01
> @@ -49,11 +49,11 @@ TEST_USER2_HOME="/home/$TEST_USER2"
>
> do_setup() {
> #move any files that may get in the way
> - rm /tmp/cron_deny_test &> /dev/null
> - rm /tmp/cron_deny_test1 &> /dev/null
> + rm /tmp/cron_deny_test > /dev/null 2>&1
> + rm /tmp/cron_deny_test1 > /dev/null 2>&1
>
> - mv $CRON_DENY $CRON_DENY.old &> /dev/null
> - mv $CRON_ALLOW $CRON_ALLOW.old &> /dev/null
> + mv $CRON_DENY $CRON_DENY.old > /dev/null 2>&1
> + mv $CRON_ALLOW $CRON_ALLOW.old > /dev/null 2>&1
>
> #remove users for clean enviroment
> su $TEST_USER1 -c "crontab -r"
> @@ -94,9 +94,9 @@ do_cleanup(){
> userdel $TEST_USER1
> userdel $TEST_USER2
> rm $CRON_DENY
> - mv $CRON_DENY.old $CRON_DENY &> /dev/null
> - mv $CRON_ALLOW.old $CRON_ALLOW &> /dev/null
> - rm /tmp/cron_allow_test &>/dev/null
> + mv $CRON_DENY.old $CRON_DENY > /dev/null 2>&1
> + mv $CRON_ALLOW.old $CRON_ALLOW > /dev/null 2>&1
> + rm /tmp/cron_allow_test >/dev/null 2>&1
> }
>
> #-----------------------------------------------------------------------
> diff --git a/testcases/commands/su/su01 b/testcases/commands/su/su01
> index e6b8a05..91548c7 100755
> --- a/testcases/commands/su/su01
> +++ b/testcases/commands/su/su01
> @@ -41,7 +41,7 @@ tvar=${tvar#*-}
>
> # need to export tvar for su01_s1
> export tvar
> -echo "Machine type is: $tvar \n"
> +printf "Machine type is: $tvar\n\n"
>
> if [ $tvar = "redhat" -o $tvar = "redhat-linux" ]
> # Need to also set group for TEST_USER2
> @@ -76,9 +76,9 @@ export TEST_ENV_FILE2="/tmp/TEST_ENV_FILE_ROOT2"
> do_setup(){
>
> #REMOVE ANY TEMPOARY FILES THAT MAY STILL BE AROUND
> -rm -f $TEST_ENV_FILE_USER &> /dev/null
> -rm -f $TEST_ENV_FILE2 &> /dev/null
> -rm -f $TEST_ENV_FILE &> /dev/null
> +rm -f $TEST_ENV_FILE_USER > /dev/null 2>&1
> +rm -f $TEST_ENV_FILE2 > /dev/null 2>&1
> +rm -f $TEST_ENV_FILE > /dev/null 2>&1
>
>
> #Create 1st test user
> @@ -108,7 +108,7 @@ rm -f $TEST_ENV_FILE &> /dev/null
> }
> fi
>
> - usermod -p $TEST_USER1_ENCRYPTED_PASSWD $TEST_USER1 &> /dev/null
> + usermod -p $TEST_USER1_ENCRYPTED_PASSWD $TEST_USER1 > /dev/null 2>&1
> if [ $? != 0 ]
> then {
> echo "Could not set password for test user $TEST_USER1"
> @@ -144,7 +144,7 @@ rm -f $TEST_ENV_FILE &> /dev/null
> }
> fi
>
> - usermod -p $TEST_USER2_ENCRYPTED_PASSWD $TEST_USER2 &> /dev/null
> + usermod -p $TEST_USER2_ENCRYPTED_PASSWD $TEST_USER2 > /dev/null 2>&1
> if [ $? != 0 ]
> then {
> echo "Could not set password for test user $TEST_USER2"
> @@ -164,9 +164,9 @@ do_cleanup() {
> userdel $TEST_USER1
> userdel $TEST_USER2
> #REMOVE ANY TEMPOARY FILES THAT MAY STILL BE AROUND
> - rm -f $TEST_ENV_FILE_USER &> /dev/null
> - rm -f $TEST_ENV_FILE2 &> /dev/null
> - rm -f $TEST_ENV_FILE &> /dev/null
> + rm -f $TEST_ENV_FILE_USER > /dev/null 2>&1
> + rm -f $TEST_ENV_FILE2 > /dev/null 2>&1
> + rm -f $TEST_ENV_FILE > /dev/null 2>&1
> }
>
> #-----------------------------------------------------------------------
> diff --git a/testcases/kernel/containers/netns/child.sh b/testcases/kernel/containers/netns/child.sh
> index a7fbc4b..6e8ed62 100755
> --- a/testcases/kernel/containers/netns/child.sh
> +++ b/testcases/kernel/containers/netns/child.sh
> @@ -34,7 +34,7 @@ export TST_TOTAL
>
> ping -qc 2 $IP1 > /dev/null
>
> - if [ $? == 0 ] ; then
> + if [ $? = 0 ] ; then
> tst_resm TINFO "PASS: Pinging ParentNS from ChildNS"
> status=0
> else
> diff --git a/testcases/kernel/containers/netns/child_1.sh b/testcases/kernel/containers/netns/child_1.sh
> index d44eebd..1fa71a7 100755
> --- a/testcases/kernel/containers/netns/child_1.sh
> +++ b/testcases/kernel/containers/netns/child_1.sh
> @@ -65,7 +65,7 @@ export TST_TOTAL
> # Pinging CHILD2 from CHILD1
> debug "INFO: Trying for pinging CHILD2..."
> ping -qc 2 $IP4 > /dev/null
> - if [ $? == 0 ];
> + if [ $? = 0 ];
> then
> tst_resm TINFO "PASS: Child2 is pinging from CHILD1 !"
> else
> diff --git a/testcases/kernel/containers/netns/childipv6.sh b/testcases/kernel/containers/netns/childipv6.sh
> index 4e904be..54bd6e6 100755
> --- a/testcases/kernel/containers/netns/childipv6.sh
> +++ b/testcases/kernel/containers/netns/childipv6.sh
> @@ -52,7 +52,7 @@ status=0
>
> #starting the sshd inside the child NS
> /usr/sbin/sshd -p $PORT
> - if [ $? == 0 ]; then
> + if [ $? = 0 ]; then
> debug "INFO: started the sshd @ port no $PORT"
> sshpid=`ps -ef | grep "sshd -p $PORT" | awk '{ print $2 ; exit 0} ' `
> else
> @@ -68,7 +68,7 @@ status=0
>
> # checking if parent ns responding
> ping6 -I $vnet1 -qc 2 $parIPv6 >/dev/null 2>&1
> - if [ $? == 0 ] ; then
> + if [ $? = 0 ] ; then
> tst_resm TINFO "IPv6: Pinging Parent from Child: PASS"
> else
> tst_resm TFAIL "IPv6: Pinging Parent from Child: FAIL"
> diff --git a/testcases/kernel/containers/netns/childns.sh b/testcases/kernel/containers/netns/childns.sh
> index 6fe47ab..5a831ba 100755
> --- a/testcases/kernel/containers/netns/childns.sh
> +++ b/testcases/kernel/containers/netns/childns.sh
> @@ -41,7 +41,7 @@ export TST_TOTAL
> . initialize.sh
> status=0
>
> - if [ $# == 1 ] ; then
> + if [ $# = 1 ] ; then
> childscrpt=$1
> debug "INFO: The script to be executed in child NS is $childscrpt"
> fi
> @@ -63,7 +63,7 @@ status=0
>
> #starting the sshd inside the child NS
> /usr/sbin/sshd -p $PORT
> - if [ $? == 0 ]; then
> + if [ $? = 0 ]; then
> debug "INFO: started the sshd @ port no $PORT"
> sshpid=`ps -ef | grep "sshd -p $PORT" | awk '{ print $2 ; exit 0} ' `
> else
> diff --git a/testcases/kernel/containers/netns/delchild.sh b/testcases/kernel/containers/netns/delchild.sh
> index 88822f2..d294e26 100755
> --- a/testcases/kernel/containers/netns/delchild.sh
> +++ b/testcases/kernel/containers/netns/delchild.sh
> @@ -41,7 +41,7 @@ export TST_TOTAL
> newnet=`cat /tmp/FIFO4`
> debug "INFO: new dev is $newnet"
>
> - if [ $newnet == -1 ] ; then
> + if [ $newnet = -1 ] ; then
> status=-1
> fi
>
> @@ -50,17 +50,17 @@ export TST_TOTAL
>
> debug "INFO: Deleting the child NS created.. "
> debug "INFO: Killing processes $sshpid $pid"
> kill -9 $sshpid $pid > /dev/null 2>&1
> sleep 1
>
> ls /sys/class/net > /tmp/sys_aftr_child_killed
> diff -q /tmp/sys_b4_child_killed /tmp/sys_aftr_child_killed
>
> - if [ $? == 0 ] ; then
> + if [ $? = 0 ] ; then
> debug "INFO: No difference in the contents of sysfs after deleting the child"
> else
> grep -qw $newnet /tmp/sys_aftr_child_killed
> - if [ $? == 0 ]; then
> + if [ $? = 0 ]; then
> debug "INFO: Device $newnet is moved to ParentNS"
> else
> debug "INFO: Device $newnet is moved under diff name in ParentNS"
> diff --git a/testcases/kernel/containers/netns/par_ftp.sh b/testcases/kernel/containers/netns/par_ftp.sh
> index fa672a4..3bfb47b 100755
> --- a/testcases/kernel/containers/netns/par_ftp.sh
> +++ b/testcases/kernel/containers/netns/par_ftp.sh
> @@ -35,7 +35,7 @@ export TST_TOTAL
>
> ping -q -c 2 $IP2 > /dev/null
>
> - if [ $? == 0 ] ; then
> + if [ $? = 0 ] ; then
> tst_resm TINFO "Pinging ChildNS from ParentNS"
> else
> tst_resm TFAIL "Error: Unable to ping ChildNS from ParentNS"
> diff --git a/testcases/kernel/containers/netns/parent.sh b/testcases/kernel/containers/netns/parent.sh
> index a12f284..61bb500 100755
> --- a/testcases/kernel/containers/netns/parent.sh
> +++ b/testcases/kernel/containers/netns/parent.sh
> @@ -33,7 +33,7 @@ export TST_COUNT
> export TST_TOTAL
>
> ping -q -c 2 $IP2 > /dev/null
> - if [ $? == 0 ] ; then
> + if [ $? = 0 ] ; then
> tst_resm TINFO "PASS: Pinging ChildNS from ParentNS"
> status=0
> else
> diff --git a/testcases/kernel/containers/netns/parent_1.sh b/testcases/kernel/containers/netns/parent_1.sh
> index b42436e..1b91a58 100755
> --- a/testcases/kernel/containers/netns/parent_1.sh
> +++ b/testcases/kernel/containers/netns/parent_1.sh
> @@ -38,7 +38,7 @@ export TST_TOTAL
> create_veth
> vnet0=$dev0
> vnet1=$dev1
> - if [[ -z $vnet0 || -z $vnet1 ]] ; then
> + if [ -z "$vnet0" -o -z "$vnet1" ] ; then
> tst_resm TFAIL "Error: unable to create veth pair in $0"
> exit -1
> else
> diff --git a/testcases/kernel/containers/netns/parent_2.sh b/testcases/kernel/containers/netns/parent_2.sh
> index 86eb172..c39bc7c 100755
> --- a/testcases/kernel/containers/netns/parent_2.sh
> +++ b/testcases/kernel/containers/netns/parent_2.sh
> @@ -35,7 +35,7 @@ export TST_TOTAL
> vnet2=$dev0
> vnet3=$dev1
>
> - if [[ -z $vnet2 || -z $vnet3 ]] ; then
> + if [ -z "$vnet2" -o -z "$vnet3" ] ; then
> tst_resm TFAIL "Error: unable to create veth pair in $0"
> exit -1
> else
> diff --git a/testcases/kernel/containers/netns/parentns.sh b/testcases/kernel/containers/netns/parentns.sh
> index 43cdcdb..b6488a4 100755
> --- a/testcases/kernel/containers/netns/parentns.sh
> +++ b/testcases/kernel/containers/netns/parentns.sh
> @@ -43,7 +43,7 @@ export TST_TOTAL
> status=0
>
> # Checks if any script is passed as argument.
> - if [ $# == 2 ]; then
> + if [ $# = 2 ]; then
> scrpt=$1
> debug "INFO: Script to be executed in parent NS is $scrpt"
> fi
> @@ -56,7 +56,7 @@ status=0
> create_veth
> vnet0=$dev0
> vnet1=$dev1
> - if [[ -z $vnet0 || -z $vnet1 ]] ; then
> + if [ -z "$vnet0" -o -z "$vnet1" ] ; then
> tst_resm TFAIL "Error: unable to create veth pair"
> exit -1
> else
> diff --git a/testcases/kernel/containers/netns/paripv6.sh b/testcases/kernel/containers/netns/paripv6.sh
> index 568c86f..67c8636 100755
> --- a/testcases/kernel/containers/netns/paripv6.sh
> +++ b/testcases/kernel/containers/netns/paripv6.sh
> @@ -49,7 +49,7 @@ status=0
> create_veth
> vnet0=$dev0
> vnet1=$dev1
> - if [[ -z $vnet0 || -z $vnet1 ]] ; then
> + if [ -z "$vnet0" -o -z "$vnet1" ] ; then
> tst_resm TFAIL "Error: unable to create veth pair"
> exit -1
> else
> @@ -76,7 +76,7 @@ status=0
> echo $parIPv6 > /tmp/FIFO4
> ping6 -I $vnet0 -qc 2 $childIPv6 >/dev/null 2>&1
>
> - if [ $? == 0 ] ; then
> + if [ $? = 0 ] ; then
> tst_resm TINFO "IPv6: Pinging child from parent: PASS"
> status=0
> else
> diff --git a/testcases/kernel/containers/netns/rename_net.sh b/testcases/kernel/containers/netns/rename_net.sh
> index cadf7e2..ffbe07f 100755
> --- a/testcases/kernel/containers/netns/rename_net.sh
> +++ b/testcases/kernel/containers/netns/rename_net.sh
> @@ -46,9 +46,9 @@ export TST_TOTAL
> ip link set $vnet1 name $newdev
> ifconfig $newdev $IP2/24 up > /dev/null 2>&1
>
> - if [ $? == 0 ] ; then
> + if [ $? = 0 ] ; then
> tst_resm TINFO "Successfully Renamed device to $newdev"
> - if [ DEBUG == 1 ]; then
> + if [ "$DEBUG" = 1 ]; then
> ifconfig
> fi
> else
> @@ -56,7 +56,7 @@ export TST_TOTAL
> status=-1
> fi
>
> - if [ $status == 0 ] ; then
> + if [ $status = 0 ] ; then
> echo $sshpid > /tmp/FIFO3
> echo $newdev > /tmp/FIFO4
> else
> diff --git a/testcases/kernel/power_management/runpwtests.sh b/testcases/kernel/power_management/runpwtests.sh
> index 00c8126..e1a25ce 100755
> --- a/testcases/kernel/power_management/runpwtests.sh
> +++ b/testcases/kernel/power_management/runpwtests.sh
> @@ -77,7 +77,7 @@ else
> fi
>
> # Test sched_smt_power_savings interface on HT machines
> -((TST_COUNT= $TST_COUNT + 1))
> +: $(( TST_COUNT += 1 ))
> if [ -f /sys/devices/system/cpu/sched_smt_power_savings ] ; then
> if test_sched_smt.sh; then
> tst_resm TPASS "SCHED_SMT sysfs test"
> @@ -96,7 +96,7 @@ fi
>
> # Checking cpufreq sysfs interface files
> #check_config.sh config_cpu_freq || RC=$?
> -((TST_COUNT= $TST_COUNT + 1))
> +: $(( TST_COUNT += 1 ))
> if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then
> if check_cpufreq_sysfs_files.sh; then
> tst_resm TPASS "CPUFREQ sysfs tests"
> @@ -106,7 +106,7 @@ if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then
> fi
>
> # Changing governors
> - ((TST_COUNT= $TST_COUNT + 1))
> + : $(( TST_COUNT += 1 ))
> if change_govr.sh; then
> tst_resm TPASS "Changing governors "
> else
> @@ -115,7 +115,7 @@ if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then
> fi
>
> # Changing frequencies
> - ((TST_COUNT= $TST_COUNT + 1))
> + : $(( TST_COUNT += 1 ))
> if change_freq.sh ; then
> tst_resm TPASS "Changing frequncies "
> else
> @@ -124,7 +124,7 @@ if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then
> fi
>
> # Loading and Unloading governor related kernel modules
> - ((TST_COUNT= $TST_COUNT + 1))
> + : $(( TST_COUNT += 1 ))
> if pwkm_load_unload.sh ; then
> tst_resm TPASS "Loading and Unloading of governor kernel \
> modules"
> @@ -138,7 +138,7 @@ else
> fi
>
> # Checking cpuidle sysfs interface files
> -(( TST_COUNT= $TST_COUNT +1))
> +: $(( TST_COUNT+=1))
> if check_cpuidle_sysfs_files.sh ; then
> tst_resm TPASS "CPUIDLE sysfs tests passed"
> else
> @@ -154,21 +154,21 @@ test cannot run"
> else
> get_max_sched_mc; max_sched_mc=$?
> for sched_mc in `seq 0 $max_sched_mc`; do
> - (( TST_COUNT= $TST_COUNT +1))
> + : $(( TST_COUNT+=1))
> sched_domain.py -c $sched_mc; RC=$?
> analyze_sched_domain_result $sched_mc $RC
> if [ $hyper_threaded -eq $YES ]; then
> get_max_sched_smt ; max_sched_smt=$?
> for sched_smt in `seq 0 $max_sched_smt`; do
> # Testcase to validate sched_domain tree
> - (( TST_COUNT= $TST_COUNT +1))
> + : $(( TST_COUNT+=1))
> sched_domain.py -c $sched_mc -t $sched_smt; RC=$?
> analyze_sched_domain_result $sched_mc $RC $sched_smt ;
> done
> fi
> done
> fi
> -if [ $# -gt 0 -a $1 == "-exclusive" ]; then
> +if [ $# -gt 0 -a "$1" = "-exclusive" ]; then
> # Test CPU consolidation
> which python > /dev/null
> if [ $? -ne 0 ] ; then
> @@ -180,12 +180,12 @@ if [ $# -gt 0 -a $1 == "-exclusive" ]; then
> for sched_mc in `seq 0 $max_sched_mc`; do
> for work_load in ${work_loads_list}
> do
> - ((TST_COUNT= $TST_COUNT + 1))
> + : $(( TST_COUNT += 1 ))
> sched_mc_pass_cnt=0
> for repeat_test in `seq 1 10`; do
> #Testcase to validate CPU consolidation for sched_mc
> if cpu_consolidation.py -c $sched_mc -w $work_load ; then
> - ((sched_mc_pass_cnt= $sched_mc_pass_cnt +1))
> + : $(( sched_mc_pass_cnt += 1 ))
> fi
> done
> analyze_consolidation_result $sched_mc $work_load $sched_mc_pass_cnt
> @@ -193,13 +193,13 @@ if [ $# -gt 0 -a $1 == "-exclusive" ]; then
> if [ $hyper_threaded -eq $YES ]; then
> for sched_smt in `seq 0 $max_sched_smt`; do
> for work_load in ${work_loads_list}; do
> - ((TST_COUNT= $TST_COUNT + 1))
> + : $(( TST_COUNT += 1 ))
> sched_mc_smt_pass_cnt=0
> for repeat_test in `seq 1 10`; do
> # Testcase to validate CPU consolidation for
> # for sched_mc & sched_smt with stress=50%
> if cpu_consolidation.py -c $sched_mc -t $sched_smt -w $work_load; then
> - ((sched_mc_smt_pass_cnt= $sched_mc_smt_pass_cnt +1))
> + : $(( sched_mc_smt_pass_cnt += 1 ))
> fi
> done
> analyze_consolidation_result $sched_mc $work_load $sched_mc_smt_pass_cnt $sched_smt
> @@ -207,10 +207,10 @@ if [ $# -gt 0 -a $1 == "-exclusive" ]; then
> #Testcase to validate consolidation at core level
> sched_mc_smt_pass_cnt=0
> stress="thread"
> - ((TST_COUNT= $TST_COUNT + 1))
> + : $(( TST_COUNT += 1 ))
> for repeat_test in `seq 1 10`; do
> if cpu_consolidation.py -c $sched_mc -t $sched_smt -w $work_load -s $stress; then
> - ((sched_mc_smt_pass_cnt= $sched_mc_smt_pass_cnt +1))
> + : $(( sched_mc_smt_pass_cnt += 1 ))
> fi
> done
> analyze_consolidation_result $sched_mc $work_load $sched_mc_smt_pass_cnt $sched_smt $stress
> diff --git a/testcases/kernel/sched/hyperthreading/ht_enabled/smt_smp_enabled.sh b/testcases/kernel/sched/hyperthreading/ht_enabled/smt_smp_enabled.sh
> index 85d42a3..8b8a909 100755
> --- a/testcases/kernel/sched/hyperthreading/ht_enabled/smt_smp_enabled.sh
> +++ b/testcases/kernel/sched/hyperthreading/ht_enabled/smt_smp_enabled.sh
> @@ -64,7 +64,7 @@ else
> cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | cut -f 2 -d ':'\
> | sed 's/ //' | uniq`
>
> - if [ $cpu_cores == 1 ];then
> + if [ $cpu_cores -eq 1 ];then
> tst_resm TPASS "SMT is enable"
> elif [ $cpu_cores -ge 2 ];then
> tst_resm TPASS "SMP System"
> diff --git a/testcases/kernel/syscalls/ioctl/test_ioctl b/testcases/kernel/syscalls/ioctl/test_ioctl
> index 2ea3e39..7ae9e71 100755
> --- a/testcases/kernel/syscalls/ioctl/test_ioctl
> +++ b/testcases/kernel/syscalls/ioctl/test_ioctl
> @@ -25,7 +25,7 @@ export TST_COUNT=0
>
> for tttype in `ls /dev/tty*`
> do
> -device_no=${tttype:8}
> +device_no=${tttype#/dev/tty}
> case "$device_no" in
> [0-9]|[0-9][0-9])
> tst_resm TINFO "Testing ioctl01 with $tttype"
> @@ -43,7 +43,7 @@ done
>
> for tttype in `ls /dev/tty*`
> do
> -device_no=${tttype:8}
> +device_no=${tttype#/dev/tty}
> case "$device_no" in
> [0-9]|[0-9][0-9])
> tst_resm TINFO "Testing ioctl02 with $tttype"
> diff --git a/testcases/misc/tcore_patch_test_suites/tcore.sh b/testcases/misc/tcore_patch_test_suites/tcore.sh
> index f087fa7..4b032dc 100755
> --- a/testcases/misc/tcore_patch_test_suites/tcore.sh
> +++ b/testcases/misc/tcore_patch_test_suites/tcore.sh
> @@ -107,13 +107,13 @@ Test_gen_core()
> rm -f core.*
> fi
> pid=`$BIN_DIR/tcore |grep "consumer pid"|awk '{print $2}'|cut -d = -f 2`
> - echo -e "Test whether we can generate the needed core file"
> + echo "Test whether we can generate the needed core file"
> if [ -f core.* ];then
> - echo -e "PASS"
> + echo "PASS"
> pass=`expr $pass + 1`
> return 0
> else
> - echo -e "FAIL"
> + echo "FAIL"
> fail=`expr $fail + 1`
> return 1
> fi
> @@ -124,14 +124,14 @@ Test_core_file()
> cd $TEST_DIR
> prepare_gdb
> mv -f $TEST_DIR/core.* $TEST_DIR/corefile >/dev/null 2>&1
> - echo -e "Test whether the core support bt,fpu and threads commands "
> + echo "Test whether the core support bt,fpu and threads commands "
> expect $BIN_DIR/tcore.exp
> return=$?
> pass=`expr $pass + $return`
> fail=`expr 3 - $return + $fail`
> }
>
> -echo -e "Test Tcore patch "
> +echo "Test Tcore patch "
> check_install
> Test_gen_core
> Test_core_file
> diff --git a/testcases/network/iproute/ip_tests.sh b/testcases/network/iproute/ip_tests.sh
> index c622700..59322b6 100755
> --- a/testcases/network/iproute/ip_tests.sh
> +++ b/testcases/network/iproute/ip_tests.sh
> @@ -61,7 +61,7 @@ init()
> trap "cleanup" 0
>
> # create the tmp directory for this testcase.
> - mkdir -p $LTPTMP/ &>/dev/null || RC=$?
> + mkdir -p $LTPTMP/ >/dev/null 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brkm TBROK "INIT: Unable to create temporary directory"
> @@ -69,7 +69,7 @@ init()
> fi
>
> # Check to see if test harness functions are in the path.
> - which tst_resm &>$LTPTMP/tst_ip.err || RC=$?
> + which tst_resm >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brkm TBROK NULL \
> @@ -77,7 +77,7 @@ init()
> return $RC
> fi
>
> - which awk &>$LTPTMP/tst_ip.err || RC=$?
> + which awk >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brkm TBROK NULL \
> @@ -85,7 +85,7 @@ init()
> return $RC
> fi
>
> - which ip &>$LTPTMP/tst_ip.err || RC=$?
> + which ip >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brkm TBROK NULL \
> @@ -93,7 +93,7 @@ init()
> return $RC
> fi
>
> - which ifconfig &>$LTPTMP/tst_ip.err || RC=$?
> + which ifconfig >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brkm TBROK NULL \
> @@ -104,13 +104,13 @@ init()
> tst_resm TINFO "INIT: Inititalizing tests."
>
> # Aliasing eth0 to create private network.
> - /sbin/ifconfig eth0:1 10.1.1.12 &>$LTPTMP/tst_ip.err || RC=$?
> + /sbin/ifconfig eth0:1 10.1.1.12 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brk TBROK "INIT: failed aliasing eth0:1 with IP 10.1.1.12"
> return $RC
> else
> - /sbin/route add -host 10.1.1.12 dev eth0:1 &>$LTPTMP/tst_ip.err \
> + /sbin/route add -host 10.1.1.12 dev eth0:1 >$LTPTMP/tst_ip.err 2>&1 \
> || RC=$?
> if [ $RC -ne 0 ]
> then
> @@ -153,10 +153,10 @@ cleanup()
> TST_COUNT=0
> RC=0
>
> - /sbin/ifconfig eth0:1 &>$LTPTMP/tst_ip.err || RC=$?
> + /sbin/ifconfig eth0:1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -eq 0 ]
> then
> - /sbin/ifconfig eth0:1 down &>$LTPTMP/tst_ip.err
> + /sbin/ifconfig eth0:1 down >$LTPTMP/tst_ip.err 2>&1
> fi
>
> rm -fr $LTPTMP
> @@ -187,7 +187,7 @@ test01()
>
> tst_resm TINFO "Test #1: changing mtu size of eth0:1 device."
>
> - ip link set eth0:1 mtu 300 &>$LTPTMP/tst_ip.err
> + ip link set eth0:1 mtu 300 >$LTPTMP/tst_ip.err 2>&1
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -232,7 +232,7 @@ test02()
> tst_resm TINFO \
> "Test #2: Installing dummy.o in kernel"
>
> - modprobe dummy &>$LTPTMP/tst_ip.out || RC=$?
> + modprobe dummy >$LTPTMP/tst_ip.out 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brk TBROK $LTPTMP/tst_ip.out NULL \
> @@ -240,7 +240,7 @@ test02()
> return $RC
> fi
>
> - ip link show dummy0 | grep dummy0 &>$LTPTMP/tst_ip.err || RC=$?
> + ip link show dummy0 | grep dummy0 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err "Test #2: ip command failed. Reason:"
> @@ -278,7 +278,7 @@ test03()
> tst_resm TINFO \
> "Test #3: ip addr add - adds a new protolcol address to the device"
>
> - ip addr add 127.6.6.6 dev lo &>$LTPTMP/tst_ip.err || RC=$?
> + ip addr add 127.6.6.6 dev lo >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -287,7 +287,7 @@ test03()
> else
> tst_resm TINFO \
> "Test #3: ip addr show dev <device> - shows protocol address."
> - ip addr show dev lo | grep 127.6.6.6 &>$LTPTMP/tst_ip.err || RC=$?
> + ip addr show dev lo | grep 127.6.6.6 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -297,14 +297,14 @@ test03()
>
> tst_resm TINFO \
> "Test #3: ip addr del <ip> dev <device> - deletes protocol address."
> - ip addr del 127.6.6.6 dev lo &>$LTPTMP/tst_ip.err || RC=$?
> + ip addr del 127.6.6.6 dev lo >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> "Test #3: ip addr del command failed. Reason: "
> return $RC
> else
> - ip addr show dev lo | grep 127.6.6.6 &>$LTPTMP/tst_ip.err || RC=$?
> + ip addr show dev lo | grep 127.6.6.6 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -eq 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -343,7 +343,7 @@ test04()
> tst_resm TINFO \
> "Test #4: ip neigh add - adds a new neighbour to arp tables."
>
> - ip neigh add 127.0.0.1 dev lo nud reachable &>$LTPTMP/tst_ip.err || RC=$?
> + ip neigh add 127.0.0.1 dev lo nud reachable >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -357,7 +357,7 @@ test04()
> 127.0.0.1 dev lo lladdr 00:00:00:00:00:00 nud reachable
> EOF
>
> - ip neigh show 127.0.0.1 | head -n1 &>$LTPTMP/tst_ip.out || RC=$?
> + ip neigh show 127.0.0.1 | head -n1 >$LTPTMP/tst_ip.out 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -365,7 +365,7 @@ test04()
> return $RC
> else
> diff -iwB $LTPTMP/tst_ip.out $LTPTMP/tst_ip.exp \
> - &>$LTPTMP/tst_ip.err || RC=$?
> + >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res FAIL $LTPTMP/tst_ip.err \
> @@ -377,14 +377,14 @@ test04()
> tst_resm TINFO \
> "Test #4: ip neigh del - deletes neighbour from the arp table."
>
> - ip neigh del 127.0.0.1 dev lo &>$LTPTMP/tst_ip.err || RC=$?
> + ip neigh del 127.0.0.1 dev lo >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> "Test #4: ip neigh del command failed return = $RC. Reason: "
> return $RC
> else
> - ip neigh show | grep 127.0.0.1 grep -v "nud failed$" &>$LTPTMP/tst_ip.err || RC=$?
> + ip neigh show | grep 127.0.0.1 grep -v "nud failed$" >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -eq 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -426,7 +426,7 @@ test05()
> tst_resm TINFO \
> "Test #5: create an interface with inet 10.6.6.6 alias to eth0"
>
> - ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 &>$LTPTMP/tst_ip.err || RC=$?
> + ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brk TBROK $LTPTMP/tst_ip.err NULL \
> @@ -434,7 +434,7 @@ test05()
> return $RC
> fi
>
> - ip route add 10.6.6.6 via 127.0.0.1 &>$LTPTMP/tst_ip.err || RC=$?
> + ip route add 10.6.6.6 via 127.0.0.1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -449,7 +449,7 @@ test05()
> 10.6.6.6 via 127.0.0.1 dev lo
> EOF
>
> - ip route show | head -n1 &>$LTPTMP/tst_ip.out || RC=$?
> + ip route show | head -n1 >$LTPTMP/tst_ip.out 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -457,7 +457,7 @@ test05()
> return $RC
> else
> diff -iwB $LTPTMP/tst_ip.out $LTPTMP/tst_ip.exp \
> - &>$LTPTMP/tst_ip.err || RC=$?
> + >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res FAIL $LTPTMP/tst_ip.err \
> @@ -469,14 +469,14 @@ test05()
> tst_resm TINFO \
> "Test #5: ip route del - deletes route from the route table."
>
> - ip route del 10.6.6.6 via 127.0.0.1 &>$LTPTMP/tst_ip.err || RC=$?
> + ip route del 10.6.6.6 via 127.0.0.1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> "Test #5: ip route del command failed return = $RC. Reason: "
> return $RC
> else
> - ip route show | grep 127.0.0.1 &>$LTPTMP/tst_ip.err || RC=$?
> + ip route show | grep 127.0.0.1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -eq 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -514,7 +514,7 @@ test06()
> tst_resm TINFO \
> "Test #6: ip maddr add - adds a new multicast addr"
>
> - ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 &>$LTPTMP/tst_ip.err || RC=$?
> + ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brk TBROK $LTPTMP/tst_ip.err NULL \
> @@ -522,7 +522,7 @@ test06()
> return $RC
> fi
>
> - ip maddr add 66:66:00:00:00:66 dev eth0:1 &>$LTPTMP/tst_ip.err || RC=$?
> + ip maddr add 66:66:00:00:00:66 dev eth0:1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -536,7 +536,7 @@ test06()
> link 66:66:00:00:00:66 static
> EOF
>
> - ip maddr show | grep "66:66:00:00:00:66" &>$LTPTMP/tst_ip.out || RC=$?
> + ip maddr show | grep "66:66:00:00:00:66" >$LTPTMP/tst_ip.out 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -556,7 +556,7 @@ test06()
> tst_resm TINFO \
> "Test #6: ip maddr del - deletes multicast addr."
>
> - ip maddr del 66:66:00:00:00:66 dev eth0:1 &>$LTPTMP/tst_ip.err || RC=$?
> + ip maddr del 66:66:00:00:00:66 dev eth0:1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> diff --git a/testcases/network/nfs/nfs03/nfs03 b/testcases/network/nfs/nfs03/nfs03
> index 8cbd3a4..bbc79e9 100755
> --- a/testcases/network/nfs/nfs03/nfs03
> +++ b/testcases/network/nfs/nfs03/nfs03
> @@ -91,10 +91,10 @@ fs_inod()
> #
> # RETURNS: None.
> #=============================================================================
> -function err_log
> +err_log()
> {
> error "$1"
> - let step_errors="$step_errors + 1"
> + : $(($step_errors+=1))
> }
>
>
> @@ -107,7 +107,7 @@ function err_log
> #
> # RETURNS: None.
> #=============================================================================
> -function make_subdirs
> +make_subdirs()
> {
> i=0;
> while [ "$i" -lt "$numsubdirs" ]; do
> @@ -115,7 +115,7 @@ function make_subdirs
> echo "$0: mkdir dir$i"
> mkdir -p dir$i || echo "mkdir dir$i FAILED"
> }
> - let i="$i + 1"
> + : $(( i += 1 ))
> done;
> }
>
> @@ -129,7 +129,7 @@ function make_subdirs
> #
> # RETURNS: None.
> #=============================================================================
> -function touch_files
> +touch_files()
> {
> echo "$0: touch files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
> j=0;
> @@ -140,10 +140,10 @@ function touch_files
>
> while [ "$k" -lt "$numfiles" ]; do
> >file$j$k || err_log ">file$j$k FAILED"
> - let k="$k + 1"
> + : $(( k += 1 ))
> done
>
> - let j="$j + 1"
> + : $(( j += 1 ))
> cd ..
> done
> }
> @@ -158,7 +158,7 @@ function touch_files
> #
> # RETURNS: None.
> #=============================================================================
> -function rm_files
> +rm_files()
> {
> echo "$0: rm files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
> j=0;
> @@ -169,10 +169,10 @@ function rm_files
>
> while [ "$k" -lt "$numfiles" ]; do
> rm -f file$j$k || err_log "rm -f file$j$k FAILED"
> - let k="$k + 1"
> + : $(( k += 1 ))
> done
>
> - let j="$j + 1"
> + : $(( j += 1 ))
> cd ..
> done
> }
> @@ -187,7 +187,7 @@ function rm_files
> #
> # RETURNS: None.
> #=============================================================================
> -function step1
> +step1()
> {
> echo "=============================================="
> echo "MULTIPLE PROCESSES CREATING AND DELETING FILES"
> @@ -240,7 +240,7 @@ function step1
> rm_files &
> pid2=$!
>
> - let i="$i + 1"
> + : $(( i += 1 ))
> done
>
> # wait for all background processes to complete execution
> @@ -376,7 +376,7 @@ $trace_logic
> echo "fs_inod starting on $TCtmp."
> fs_inod $TCtmp $DIR_NUM $FILE_NUM 1
> retval=$?
> - echo $"fs_inod on $TCtmp finished."
> + echo "fs_inod on $TCtmp finished."
>
> if [ "$retval" != 0 ]; then
> end_testcase "Errors have resulted from this test: fs_inod returned $retval."
>
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [LTP] [PATCH] Fix some bashisms
2009-07-07 15:32 ` Subrata Modak
@ 2009-07-07 16:26 ` Garrett Cooper
2009-07-08 19:05 ` Mike Frysinger
1 sibling, 0 replies; 28+ messages in thread
From: Garrett Cooper @ 2009-07-07 16:26 UTC (permalink / raw)
To: subrata; +Cc: Jiri Palecek, ltp-list
On Tue, Jul 7, 2009 at 8:32 AM, Subrata Modak<subrata@linux.vnet.ibm.com> wrote:
> I can find that they addressed all issues of Mike and Matt. However, i
> would just wait for some more confirmation from them. Thanks.
>
> Regards--
> Subrata
Hi Jiri!
Your patch looks better than before, but like you mentioned in
your last reply, the:
command || RC=$?
if [ $RC -ne 0 ]; then
stuff is a bit inconsistent, and like you originally suggested it
should probably be more like:
command
if [ $? -ne 0 ]; then
It looks like it was inconsistent before anyhow to be honest, so
it shouldn't be a big problem, but if we can fix it, we probably
should. That's the only outstanding concern from my end.
Thanks!
-Garrett
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [LTP] [PATCH] Fix some bashisms
2009-07-07 15:32 ` Subrata Modak
2009-07-07 16:26 ` Garrett Cooper
@ 2009-07-08 19:05 ` Mike Frysinger
1 sibling, 0 replies; 28+ messages in thread
From: Mike Frysinger @ 2009-07-08 19:05 UTC (permalink / raw)
To: ltp-list, subrata; +Cc: Jiri Palecek, ltp-list
[-- Attachment #1.1: Type: text/plain, Size: 245 bytes --]
On Tuesday 07 July 2009 11:32:35 Subrata Modak wrote:
> I can find that they addressed all issues of Mike and Matt. However, i
> would just wait for some more confirmation from them. Thanks.
didnt notice any problems in a quick look over
-mike
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 389 bytes --]
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
[-- Attachment #3: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [LTP] [PATCH] Fix some bashisms
2009-07-07 8:35 [LTP] [PATCH] Fix some bashisms Jiri Palecek
2009-07-07 15:32 ` Subrata Modak
@ 2009-07-08 18:13 ` Subrata Modak
1 sibling, 0 replies; 28+ messages in thread
From: Subrata Modak @ 2009-07-08 18:13 UTC (permalink / raw)
To: Jiri Palecek; +Cc: ltp-list
On Tue, 2009-07-07 at 10:35 +0200, Jiri Palecek wrote:
> Hello,
>
> this patch reflects the comments by various people to the previous versions. It uses "+=1" instead of postincrement because of dash, ['s boolean expressions, printf for the formatting. I've left the unzip pushd/popd and the signal names issue completely.
>
> Regards
> Jiri Palecek
Did you accidentally miss out the Signed-off-by: Jiri Palecek
<jpalecek@web.de> ?
Regards--
Subrata
>
> ---
> runalltests.sh | 58 +++++++++---------
> testcases/commands/cron/cron02 | 4 +-
> testcases/commands/cron/cron03 | 2 +-
> testcases/commands/cron/cron_allow01 | 10 ++--
> testcases/commands/cron/cron_deny01 | 14 ++--
> testcases/commands/su/su01 | 18 +++---
> testcases/kernel/containers/netns/child.sh | 2 +-
> testcases/kernel/containers/netns/child_1.sh | 2 +-
> testcases/kernel/containers/netns/childipv6.sh | 4 +-
> testcases/kernel/containers/netns/childns.sh | 4 +-
> testcases/kernel/containers/netns/delchild.sh | 8 +-
> testcases/kernel/containers/netns/par_ftp.sh | 2 +-
> testcases/kernel/containers/netns/parent.sh | 2 +-
> testcases/kernel/containers/netns/parent_1.sh | 2 +-
> testcases/kernel/containers/netns/parent_2.sh | 2 +-
> testcases/kernel/containers/netns/parentns.sh | 4 +-
> testcases/kernel/containers/netns/paripv6.sh | 4 +-
> testcases/kernel/containers/netns/rename_net.sh | 6 +-
> testcases/kernel/power_management/runpwtests.sh | 32 +++++-----
> .../hyperthreading/ht_enabled/smt_smp_enabled.sh | 2 +-
> testcases/kernel/syscalls/ioctl/test_ioctl | 4 +-
> testcases/misc/tcore_patch_test_suites/tcore.sh | 11 ++--
> testcases/network/iproute/ip_tests.sh | 62 ++++++++++----------
> testcases/network/ipv6/perf_lan6/perf_lan6 | 4 +-
> testcases/network/ipv6/tcpdump6/tcpdump601 | 2 +-
> testcases/network/multicast/mc_commo/mc_commo | 4 +-
> testcases/network/multicast/mc_member/mc_member | 2 +-
> testcases/network/multicast/mc_opts/mc_opts | 2 +-
> testcases/network/nfs/nfs03/nfs03 | 26 ++++----
> .../network/rpc/basic_tests/rpcinfo/rpcinfo01 | 6 +-
> testcases/network/tcp_cmds/perf_lan/perf_lan | 4 +-
> testcases/network/tcp_cmds/tcpdump/tcpdump01 | 2 +-
> 32 files changed, 156 insertions(+), 155 deletions(-)
>
> diff --git a/runalltests.sh b/runalltests.sh
> index aa7a7d5..b710469 100755
> --- a/runalltests.sh
> +++ b/runalltests.sh
> @@ -29,17 +29,17 @@
> ## ##
> ################################################################################
>
> -echo -e "*******************************************************************"
> -echo -e "*******************************************************************"
> -echo -e "** **"
> -echo -e "** This script is being re-written to cover all aspects of **"
> -echo -e "** testing LTP, which includes running all those tests which **"
> -echo -e "** are not run by default with ./runltp script. Special setup **"
> -echo -e "** in system environment will be done to run all those tests **"
> -echo -e "** like the File System tests, SELinuxtest, etc **"
> -echo -e "** **"
> -echo -e "*******************************************************************"
> -echo -e "*******************************************************************"
> +echo "*******************************************************************"
> +echo "*******************************************************************"
> +echo "** **"
> +echo "** This script is being re-written to cover all aspects of **"
> +echo "** testing LTP, which includes running all those tests which **"
> +echo "** are not run by default with ./runltp script. Special setup **"
> +echo "** in system environment will be done to run all those tests **"
> +echo "** like the File System tests, SELinuxtest, etc **"
> +echo "** **"
> +echo "*******************************************************************"
> +echo "*******************************************************************"
>
> export LTPROOT=${PWD}
> export RUN_BALLISTA=0
> @@ -210,19 +210,19 @@ export HTML_OUTPUT_FILE_NAME=$LTP_VERSION_$HOSTNAME_$KERNEL_VERSION_$HARDWARE_TY
>
> ## The First one i plan to run is the default LTP run ##
> ## START => Test Series 1 ##
> -echo -e "Running Default LTP..."
> +echo "Running Default LTP..."
> ./runltp -g $HTML_OUTPUT_FILE_NAME
> -echo -e "Completed running Default LTP\n\n"
> +printf "Completed running Default LTP\n\n\n"
> ## END => Test Series 1 ##
>
> ## The next one i plan to run is ballista ##
> ## START => Test Series 2 ##
> if [ $RUN_BALLISTA -eq 1 ]
> then
> - echo -e "Running Ballista..."
> + echo "Running Ballista..."
> export TEST_START_TIME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`
> ./runltp -f ballista -o $LTP_VERSION-BALLISTA_RUN_ON-$HOSTNAME-$KERNEL_VERSION-$HARDWARE_TYPE-$TEST_START_TIME.out
> - echo -e "Completed running Ballista\n\n"
> + printf "Completed running Ballista\n\n\n"
> fi
> ## END => Test Series 2 ##
>
> @@ -230,9 +230,9 @@ fi
> ## START => Test Series 3 ##
> if [ $RUN_OPENPOSIX -eq 1 ]
> then
> - echo -e "Running Open Posix Tests..."
> + echo "Running Open Posix Tests..."
> (cd testcases/open_posix_testsuite; make)
> - echo -e "Completed running Open Posix Tests\n\n"
> + printf "Completed running Open Posix Tests\n\n\n"
> fi
> ## END => Test Series 3 ##
>
> @@ -242,9 +242,9 @@ fi
> ## START => Test Series 4 ##
> if [ $RUN_MM_CORE_APIS -eq 1 ]
> then
> - echo -e "Initializing ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
> + echo "Initializing ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
> # Check to see if User is Root
> - if [ $EUID -ne 0 ]
> + if [ $(id -u) -ne 0 ]
> then
> echo You need to be root to Install libmm and run mem/libmm/mm_core_apis
> echo Aborting ltp/testcases/kernel/mem/libmm/mm_core_apis
> @@ -262,13 +262,13 @@ then
> else
> echo libmm-1.4.2 already installed in your system
> fi
> - echo -e "Running ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
> + echo "Running ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
> (cd testcases/kernel/mem/libmm; \
> make; \
> make install; \
> $LTPROOT/testcases/bin/mm_core_apis; )
> fi
> - echo -e "Completed running ltp/testcases/kernel/mem/libmm/mm_core_apis...\n\n"
> + printf "Completed running ltp/testcases/kernel/mem/libmm/mm_core_apis...\n\n\n"
> fi
> ## END => Test Series 4 ##
>
> @@ -278,9 +278,9 @@ fi
> ## START => Test Series 5 ##
> if [ $RUN_AIOTESTS -eq 1 ]
> then
> - echo -e "Initializing ltp/testcases/kernel/io/aio ..."
> + echo "Initializing ltp/testcases/kernel/io/aio ..."
> # Check to see if User is Root
> - if [ $EUID -ne 0 ]
> + if [ $(id -u) -ne 0 ]
> then
> echo You need to be root to Install libaio-0.3.92 and run ltp/testcases/kernel/io/aio
> echo Aborting ltp/testcases/kernel/io/aio
> @@ -298,13 +298,13 @@ if [ $RUN_AIOTESTS -eq 1 ]
> else
> echo libaio-0.3.92 already installed in your system
> fi
> - echo -e "Building & Running ltp/testcases/kernel/io/aio..."
> + echo "Building & Running ltp/testcases/kernel/io/aio..."
> (cd testcases/kernel/io/aio; \
> make > /dev/null; \
> ./aio01/aio01; \
> ./aio02/runfstests.sh -a aio02/cases/aio_tio; \
> make clean 1>&2 > /dev/null )
> - echo -e "Completed running ltp/testcases/kernel/io/aio...\n\n"
> + printf "Completed running ltp/testcases/kernel/io/aio...\n\n\n"
> fi
> fi
> ## END => Test Series 5 ##
> @@ -316,9 +316,9 @@ fi
> ## START => Test Series 6 ##
> if [ $RUN_FILECAPS -eq 1 ]
> then
> - echo -e "Initializing ltp/testcases/kernel/security/filecaps ..."
> + echo "Initializing ltp/testcases/kernel/security/filecaps ..."
> # Check to see if User is Root
> - if [ $EUID -ne 0 ]
> + if [ $(id -u) -ne 0 ]
> then
> echo You need to be root to Install libcaps and run ltp/testcases/kernel/security/filecaps
> echo Aborting ltp/testcases/kernel/security/filecaps
> @@ -336,11 +336,11 @@ then
> else
> echo libcaps already installed in your system
> fi
> - echo -e "Building & Running ltp/testcases/kernel/security/filecaps"
> + echo "Building & Running ltp/testcases/kernel/security/filecaps"
> (cd ltp/testcases/kernel/security/filecaps; \
> make && make install > /dev/null; )
> ./runltp -f filecaps
> - echo -e "Completed running ltp/testcases/kernel/io/aio...\n\n"
> + printf "Completed running ltp/testcases/kernel/io/aio...\n\n\n"
> fi
> fi
> ## END => Test Series 6 ##
> diff --git a/testcases/commands/cron/cron02 b/testcases/commands/cron/cron02
> index c1dc245..6e4d8fe 100755
> --- a/testcases/commands/cron/cron02
> +++ b/testcases/commands/cron/cron02
> @@ -37,7 +37,7 @@ TEST_USER_HOMEDIR="/home/$TEST_USER"
>
> do_setup(){
> #erase any data from potential defunt cron test
> - rm -rf /tmp/crontest &> /dev/null
> + rm -rf /tmp/crontest > /dev/null 2>&1
>
> #erase user if he may exist , so we can have a clean env
> rm -rf /home/$TEST_USER
> @@ -56,7 +56,7 @@ do_setup(){
> # Red Hat uses crond, SuSE/Other uses cron. Check if this is Red Hat/SuSE/Other
> tvar=${MACHTYPE%-*}
> tvar=${tvar#*-}
> -echo "Distro type is: $tvar \n"
> +printf "Distro type is: $tvar\n\n"
>
> if [ $tvar != "redhat" -a $tvar != "redhat-linux" ]; then
>
> diff --git a/testcases/commands/cron/cron03 b/testcases/commands/cron/cron03
> index 58fbe1b..9448cc4 100755
> --- a/testcases/commands/cron/cron03
> +++ b/testcases/commands/cron/cron03
> @@ -59,7 +59,7 @@ do_setup(){
> # Red Hat uses crond, SuSE/Other uses cron. Check if this is Red Hat/SuSE/Other
> tvar=${MACHTYPE%-*}
> tvar=${tvar#*-}
> -echo "Distro type is: $tvar \n"
> +printf "Distro type is: $tvar\n\n"
>
> if [ $tvar != "redhat" -a $tvar != "redhat-linux" ]; then
>
> diff --git a/testcases/commands/cron/cron_allow01 b/testcases/commands/cron/cron_allow01
> index 839ad81..266700a 100755
> --- a/testcases/commands/cron/cron_allow01
> +++ b/testcases/commands/cron/cron_allow01
> @@ -47,9 +47,9 @@ TEST_USER2_HOME="/home/$TEST_USER2"
>
> do_setup() {
> #move any files that may get in the way
> - rm /tmp/cron_allow_test &> /dev/null
> - rm /tmp/cron_allow_test1 &> /dev/null
> - mv $CRON_ALLOW $CRON_ALLOW.old &> /dev/null
> + rm /tmp/cron_allow_test > /dev/null 2>&1
> + rm /tmp/cron_allow_test1 > /dev/null 2>&1
> + mv $CRON_ALLOW $CRON_ALLOW.old > /dev/null 2>&1
>
> #remove users for clean enviroment
> su $TEST_USER1 -c "crontab -r"
> @@ -90,8 +90,8 @@ do_cleanup(){
> userdel $TEST_USER1
> userdel $TEST_USER2
> rm $CRON_ALLOW
> - mv $CRON_ALLOW.old $CRON_ALLOW &> /dev/null
> - rm /tmp/cron_allow_test &>/dev/null
> + mv $CRON_ALLOW.old $CRON_ALLOW > /dev/null 2>&1
> + rm /tmp/cron_allow_test >/dev/null 2>&1
> }
>
> #-----------------------------------------------------------------------
> diff --git a/testcases/commands/cron/cron_deny01 b/testcases/commands/cron/cron_deny01
> index f7f8fd4..527d79c 100755
> --- a/testcases/commands/cron/cron_deny01
> +++ b/testcases/commands/cron/cron_deny01
> @@ -49,11 +49,11 @@ TEST_USER2_HOME="/home/$TEST_USER2"
>
> do_setup() {
> #move any files that may get in the way
> - rm /tmp/cron_deny_test &> /dev/null
> - rm /tmp/cron_deny_test1 &> /dev/null
> + rm /tmp/cron_deny_test > /dev/null 2>&1
> + rm /tmp/cron_deny_test1 > /dev/null 2>&1
>
> - mv $CRON_DENY $CRON_DENY.old &> /dev/null
> - mv $CRON_ALLOW $CRON_ALLOW.old &> /dev/null
> + mv $CRON_DENY $CRON_DENY.old > /dev/null 2>&1
> + mv $CRON_ALLOW $CRON_ALLOW.old > /dev/null 2>&1
>
> #remove users for clean enviroment
> su $TEST_USER1 -c "crontab -r"
> @@ -94,9 +94,9 @@ do_cleanup(){
> userdel $TEST_USER1
> userdel $TEST_USER2
> rm $CRON_DENY
> - mv $CRON_DENY.old $CRON_DENY &> /dev/null
> - mv $CRON_ALLOW.old $CRON_ALLOW &> /dev/null
> - rm /tmp/cron_allow_test &>/dev/null
> + mv $CRON_DENY.old $CRON_DENY > /dev/null 2>&1
> + mv $CRON_ALLOW.old $CRON_ALLOW > /dev/null 2>&1
> + rm /tmp/cron_allow_test >/dev/null 2>&1
> }
>
> #-----------------------------------------------------------------------
> diff --git a/testcases/commands/su/su01 b/testcases/commands/su/su01
> index e6b8a05..91548c7 100755
> --- a/testcases/commands/su/su01
> +++ b/testcases/commands/su/su01
> @@ -41,7 +41,7 @@ tvar=${tvar#*-}
>
> # need to export tvar for su01_s1
> export tvar
> -echo "Machine type is: $tvar \n"
> +printf "Machine type is: $tvar\n\n"
>
> if [ $tvar = "redhat" -o $tvar = "redhat-linux" ]
> # Need to also set group for TEST_USER2
> @@ -76,9 +76,9 @@ export TEST_ENV_FILE2="/tmp/TEST_ENV_FILE_ROOT2"
> do_setup(){
>
> #REMOVE ANY TEMPOARY FILES THAT MAY STILL BE AROUND
> -rm -f $TEST_ENV_FILE_USER &> /dev/null
> -rm -f $TEST_ENV_FILE2 &> /dev/null
> -rm -f $TEST_ENV_FILE &> /dev/null
> +rm -f $TEST_ENV_FILE_USER > /dev/null 2>&1
> +rm -f $TEST_ENV_FILE2 > /dev/null 2>&1
> +rm -f $TEST_ENV_FILE > /dev/null 2>&1
>
>
> #Create 1st test user
> @@ -108,7 +108,7 @@ rm -f $TEST_ENV_FILE &> /dev/null
> }
> fi
>
> - usermod -p $TEST_USER1_ENCRYPTED_PASSWD $TEST_USER1 &> /dev/null
> + usermod -p $TEST_USER1_ENCRYPTED_PASSWD $TEST_USER1 > /dev/null 2>&1
> if [ $? != 0 ]
> then {
> echo "Could not set password for test user $TEST_USER1"
> @@ -144,7 +144,7 @@ rm -f $TEST_ENV_FILE &> /dev/null
> }
> fi
>
> - usermod -p $TEST_USER2_ENCRYPTED_PASSWD $TEST_USER2 &> /dev/null
> + usermod -p $TEST_USER2_ENCRYPTED_PASSWD $TEST_USER2 > /dev/null 2>&1
> if [ $? != 0 ]
> then {
> echo "Could not set password for test user $TEST_USER2"
> @@ -164,9 +164,9 @@ do_cleanup() {
> userdel $TEST_USER1
> userdel $TEST_USER2
> #REMOVE ANY TEMPOARY FILES THAT MAY STILL BE AROUND
> - rm -f $TEST_ENV_FILE_USER &> /dev/null
> - rm -f $TEST_ENV_FILE2 &> /dev/null
> - rm -f $TEST_ENV_FILE &> /dev/null
> + rm -f $TEST_ENV_FILE_USER > /dev/null 2>&1
> + rm -f $TEST_ENV_FILE2 > /dev/null 2>&1
> + rm -f $TEST_ENV_FILE > /dev/null 2>&1
> }
>
> #-----------------------------------------------------------------------
> diff --git a/testcases/kernel/containers/netns/child.sh b/testcases/kernel/containers/netns/child.sh
> index a7fbc4b..6e8ed62 100755
> --- a/testcases/kernel/containers/netns/child.sh
> +++ b/testcases/kernel/containers/netns/child.sh
> @@ -34,7 +34,7 @@ export TST_TOTAL
>
> ping -qc 2 $IP1 > /dev/null
>
> - if [ $? == 0 ] ; then
> + if [ $? = 0 ] ; then
> tst_resm TINFO "PASS: Pinging ParentNS from ChildNS"
> status=0
> else
> diff --git a/testcases/kernel/containers/netns/child_1.sh b/testcases/kernel/containers/netns/child_1.sh
> index d44eebd..1fa71a7 100755
> --- a/testcases/kernel/containers/netns/child_1.sh
> +++ b/testcases/kernel/containers/netns/child_1.sh
> @@ -65,7 +65,7 @@ export TST_TOTAL
> # Pinging CHILD2 from CHILD1
> debug "INFO: Trying for pinging CHILD2..."
> ping -qc 2 $IP4 > /dev/null
> - if [ $? == 0 ];
> + if [ $? = 0 ];
> then
> tst_resm TINFO "PASS: Child2 is pinging from CHILD1 !"
> else
> diff --git a/testcases/kernel/containers/netns/childipv6.sh b/testcases/kernel/containers/netns/childipv6.sh
> index 4e904be..54bd6e6 100755
> --- a/testcases/kernel/containers/netns/childipv6.sh
> +++ b/testcases/kernel/containers/netns/childipv6.sh
> @@ -52,7 +52,7 @@ status=0
>
> #starting the sshd inside the child NS
> /usr/sbin/sshd -p $PORT
> - if [ $? == 0 ]; then
> + if [ $? = 0 ]; then
> debug "INFO: started the sshd @ port no $PORT"
> sshpid=`ps -ef | grep "sshd -p $PORT" | awk '{ print $2 ; exit 0} ' `
> else
> @@ -68,7 +68,7 @@ status=0
>
> # checking if parent ns responding
> ping6 -I $vnet1 -qc 2 $parIPv6 >/dev/null 2>&1
> - if [ $? == 0 ] ; then
> + if [ $? = 0 ] ; then
> tst_resm TINFO "IPv6: Pinging Parent from Child: PASS"
> else
> tst_resm TFAIL "IPv6: Pinging Parent from Child: FAIL"
> diff --git a/testcases/kernel/containers/netns/childns.sh b/testcases/kernel/containers/netns/childns.sh
> index 6fe47ab..5a831ba 100755
> --- a/testcases/kernel/containers/netns/childns.sh
> +++ b/testcases/kernel/containers/netns/childns.sh
> @@ -41,7 +41,7 @@ export TST_TOTAL
> . initialize.sh
> status=0
>
> - if [ $# == 1 ] ; then
> + if [ $# = 1 ] ; then
> childscrpt=$1
> debug "INFO: The script to be executed in child NS is $childscrpt"
> fi
> @@ -63,7 +63,7 @@ status=0
>
> #starting the sshd inside the child NS
> /usr/sbin/sshd -p $PORT
> - if [ $? == 0 ]; then
> + if [ $? = 0 ]; then
> debug "INFO: started the sshd @ port no $PORT"
> sshpid=`ps -ef | grep "sshd -p $PORT" | awk '{ print $2 ; exit 0} ' `
> else
> diff --git a/testcases/kernel/containers/netns/delchild.sh b/testcases/kernel/containers/netns/delchild.sh
> index 88822f2..d294e26 100755
> --- a/testcases/kernel/containers/netns/delchild.sh
> +++ b/testcases/kernel/containers/netns/delchild.sh
> @@ -41,7 +41,7 @@ export TST_TOTAL
> newnet=`cat /tmp/FIFO4`
> debug "INFO: new dev is $newnet"
>
> - if [ $newnet == -1 ] ; then
> + if [ $newnet = -1 ] ; then
> status=-1
> fi
>
> @@ -50,17 +50,17 @@ export TST_TOTAL
>
> debug "INFO: Deleting the child NS created.. "
> debug "INFO: Killing processes $sshpid $pid"
> kill -9 $sshpid $pid > /dev/null 2>&1
> sleep 1
>
> ls /sys/class/net > /tmp/sys_aftr_child_killed
> diff -q /tmp/sys_b4_child_killed /tmp/sys_aftr_child_killed
>
> - if [ $? == 0 ] ; then
> + if [ $? = 0 ] ; then
> debug "INFO: No difference in the contents of sysfs after deleting the child"
> else
> grep -qw $newnet /tmp/sys_aftr_child_killed
> - if [ $? == 0 ]; then
> + if [ $? = 0 ]; then
> debug "INFO: Device $newnet is moved to ParentNS"
> else
> debug "INFO: Device $newnet is moved under diff name in ParentNS"
> diff --git a/testcases/kernel/containers/netns/par_ftp.sh b/testcases/kernel/containers/netns/par_ftp.sh
> index fa672a4..3bfb47b 100755
> --- a/testcases/kernel/containers/netns/par_ftp.sh
> +++ b/testcases/kernel/containers/netns/par_ftp.sh
> @@ -35,7 +35,7 @@ export TST_TOTAL
>
> ping -q -c 2 $IP2 > /dev/null
>
> - if [ $? == 0 ] ; then
> + if [ $? = 0 ] ; then
> tst_resm TINFO "Pinging ChildNS from ParentNS"
> else
> tst_resm TFAIL "Error: Unable to ping ChildNS from ParentNS"
> diff --git a/testcases/kernel/containers/netns/parent.sh b/testcases/kernel/containers/netns/parent.sh
> index a12f284..61bb500 100755
> --- a/testcases/kernel/containers/netns/parent.sh
> +++ b/testcases/kernel/containers/netns/parent.sh
> @@ -33,7 +33,7 @@ export TST_COUNT
> export TST_TOTAL
>
> ping -q -c 2 $IP2 > /dev/null
> - if [ $? == 0 ] ; then
> + if [ $? = 0 ] ; then
> tst_resm TINFO "PASS: Pinging ChildNS from ParentNS"
> status=0
> else
> diff --git a/testcases/kernel/containers/netns/parent_1.sh b/testcases/kernel/containers/netns/parent_1.sh
> index b42436e..1b91a58 100755
> --- a/testcases/kernel/containers/netns/parent_1.sh
> +++ b/testcases/kernel/containers/netns/parent_1.sh
> @@ -38,7 +38,7 @@ export TST_TOTAL
> create_veth
> vnet0=$dev0
> vnet1=$dev1
> - if [[ -z $vnet0 || -z $vnet1 ]] ; then
> + if [ -z "$vnet0" -o -z "$vnet1" ] ; then
> tst_resm TFAIL "Error: unable to create veth pair in $0"
> exit -1
> else
> diff --git a/testcases/kernel/containers/netns/parent_2.sh b/testcases/kernel/containers/netns/parent_2.sh
> index 86eb172..c39bc7c 100755
> --- a/testcases/kernel/containers/netns/parent_2.sh
> +++ b/testcases/kernel/containers/netns/parent_2.sh
> @@ -35,7 +35,7 @@ export TST_TOTAL
> vnet2=$dev0
> vnet3=$dev1
>
> - if [[ -z $vnet2 || -z $vnet3 ]] ; then
> + if [ -z "$vnet2" -o -z "$vnet3" ] ; then
> tst_resm TFAIL "Error: unable to create veth pair in $0"
> exit -1
> else
> diff --git a/testcases/kernel/containers/netns/parentns.sh b/testcases/kernel/containers/netns/parentns.sh
> index 43cdcdb..b6488a4 100755
> --- a/testcases/kernel/containers/netns/parentns.sh
> +++ b/testcases/kernel/containers/netns/parentns.sh
> @@ -43,7 +43,7 @@ export TST_TOTAL
> status=0
>
> # Checks if any script is passed as argument.
> - if [ $# == 2 ]; then
> + if [ $# = 2 ]; then
> scrpt=$1
> debug "INFO: Script to be executed in parent NS is $scrpt"
> fi
> @@ -56,7 +56,7 @@ status=0
> create_veth
> vnet0=$dev0
> vnet1=$dev1
> - if [[ -z $vnet0 || -z $vnet1 ]] ; then
> + if [ -z "$vnet0" -o -z "$vnet1" ] ; then
> tst_resm TFAIL "Error: unable to create veth pair"
> exit -1
> else
> diff --git a/testcases/kernel/containers/netns/paripv6.sh b/testcases/kernel/containers/netns/paripv6.sh
> index 568c86f..67c8636 100755
> --- a/testcases/kernel/containers/netns/paripv6.sh
> +++ b/testcases/kernel/containers/netns/paripv6.sh
> @@ -49,7 +49,7 @@ status=0
> create_veth
> vnet0=$dev0
> vnet1=$dev1
> - if [[ -z $vnet0 || -z $vnet1 ]] ; then
> + if [ -z "$vnet0" -o -z "$vnet1" ] ; then
> tst_resm TFAIL "Error: unable to create veth pair"
> exit -1
> else
> @@ -76,7 +76,7 @@ status=0
> echo $parIPv6 > /tmp/FIFO4
> ping6 -I $vnet0 -qc 2 $childIPv6 >/dev/null 2>&1
>
> - if [ $? == 0 ] ; then
> + if [ $? = 0 ] ; then
> tst_resm TINFO "IPv6: Pinging child from parent: PASS"
> status=0
> else
> diff --git a/testcases/kernel/containers/netns/rename_net.sh b/testcases/kernel/containers/netns/rename_net.sh
> index cadf7e2..ffbe07f 100755
> --- a/testcases/kernel/containers/netns/rename_net.sh
> +++ b/testcases/kernel/containers/netns/rename_net.sh
> @@ -46,9 +46,9 @@ export TST_TOTAL
> ip link set $vnet1 name $newdev
> ifconfig $newdev $IP2/24 up > /dev/null 2>&1
>
> - if [ $? == 0 ] ; then
> + if [ $? = 0 ] ; then
> tst_resm TINFO "Successfully Renamed device to $newdev"
> - if [ DEBUG == 1 ]; then
> + if [ "$DEBUG" = 1 ]; then
> ifconfig
> fi
> else
> @@ -56,7 +56,7 @@ export TST_TOTAL
> status=-1
> fi
>
> - if [ $status == 0 ] ; then
> + if [ $status = 0 ] ; then
> echo $sshpid > /tmp/FIFO3
> echo $newdev > /tmp/FIFO4
> else
> diff --git a/testcases/kernel/power_management/runpwtests.sh b/testcases/kernel/power_management/runpwtests.sh
> index 00c8126..e1a25ce 100755
> --- a/testcases/kernel/power_management/runpwtests.sh
> +++ b/testcases/kernel/power_management/runpwtests.sh
> @@ -77,7 +77,7 @@ else
> fi
>
> # Test sched_smt_power_savings interface on HT machines
> -((TST_COUNT= $TST_COUNT + 1))
> +: $(( TST_COUNT += 1 ))
> if [ -f /sys/devices/system/cpu/sched_smt_power_savings ] ; then
> if test_sched_smt.sh; then
> tst_resm TPASS "SCHED_SMT sysfs test"
> @@ -96,7 +96,7 @@ fi
>
> # Checking cpufreq sysfs interface files
> #check_config.sh config_cpu_freq || RC=$?
> -((TST_COUNT= $TST_COUNT + 1))
> +: $(( TST_COUNT += 1 ))
> if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then
> if check_cpufreq_sysfs_files.sh; then
> tst_resm TPASS "CPUFREQ sysfs tests"
> @@ -106,7 +106,7 @@ if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then
> fi
>
> # Changing governors
> - ((TST_COUNT= $TST_COUNT + 1))
> + : $(( TST_COUNT += 1 ))
> if change_govr.sh; then
> tst_resm TPASS "Changing governors "
> else
> @@ -115,7 +115,7 @@ if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then
> fi
>
> # Changing frequencies
> - ((TST_COUNT= $TST_COUNT + 1))
> + : $(( TST_COUNT += 1 ))
> if change_freq.sh ; then
> tst_resm TPASS "Changing frequncies "
> else
> @@ -124,7 +124,7 @@ if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then
> fi
>
> # Loading and Unloading governor related kernel modules
> - ((TST_COUNT= $TST_COUNT + 1))
> + : $(( TST_COUNT += 1 ))
> if pwkm_load_unload.sh ; then
> tst_resm TPASS "Loading and Unloading of governor kernel \
> modules"
> @@ -138,7 +138,7 @@ else
> fi
>
> # Checking cpuidle sysfs interface files
> -(( TST_COUNT= $TST_COUNT +1))
> +: $(( TST_COUNT+=1))
> if check_cpuidle_sysfs_files.sh ; then
> tst_resm TPASS "CPUIDLE sysfs tests passed"
> else
> @@ -154,21 +154,21 @@ test cannot run"
> else
> get_max_sched_mc; max_sched_mc=$?
> for sched_mc in `seq 0 $max_sched_mc`; do
> - (( TST_COUNT= $TST_COUNT +1))
> + : $(( TST_COUNT+=1))
> sched_domain.py -c $sched_mc; RC=$?
> analyze_sched_domain_result $sched_mc $RC
> if [ $hyper_threaded -eq $YES ]; then
> get_max_sched_smt ; max_sched_smt=$?
> for sched_smt in `seq 0 $max_sched_smt`; do
> # Testcase to validate sched_domain tree
> - (( TST_COUNT= $TST_COUNT +1))
> + : $(( TST_COUNT+=1))
> sched_domain.py -c $sched_mc -t $sched_smt; RC=$?
> analyze_sched_domain_result $sched_mc $RC $sched_smt ;
> done
> fi
> done
> fi
> -if [ $# -gt 0 -a $1 == "-exclusive" ]; then
> +if [ $# -gt 0 -a "$1" = "-exclusive" ]; then
> # Test CPU consolidation
> which python > /dev/null
> if [ $? -ne 0 ] ; then
> @@ -180,12 +180,12 @@ if [ $# -gt 0 -a $1 == "-exclusive" ]; then
> for sched_mc in `seq 0 $max_sched_mc`; do
> for work_load in ${work_loads_list}
> do
> - ((TST_COUNT= $TST_COUNT + 1))
> + : $(( TST_COUNT += 1 ))
> sched_mc_pass_cnt=0
> for repeat_test in `seq 1 10`; do
> #Testcase to validate CPU consolidation for sched_mc
> if cpu_consolidation.py -c $sched_mc -w $work_load ; then
> - ((sched_mc_pass_cnt= $sched_mc_pass_cnt +1))
> + : $(( sched_mc_pass_cnt += 1 ))
> fi
> done
> analyze_consolidation_result $sched_mc $work_load $sched_mc_pass_cnt
> @@ -193,13 +193,13 @@ if [ $# -gt 0 -a $1 == "-exclusive" ]; then
> if [ $hyper_threaded -eq $YES ]; then
> for sched_smt in `seq 0 $max_sched_smt`; do
> for work_load in ${work_loads_list}; do
> - ((TST_COUNT= $TST_COUNT + 1))
> + : $(( TST_COUNT += 1 ))
> sched_mc_smt_pass_cnt=0
> for repeat_test in `seq 1 10`; do
> # Testcase to validate CPU consolidation for
> # for sched_mc & sched_smt with stress=50%
> if cpu_consolidation.py -c $sched_mc -t $sched_smt -w $work_load; then
> - ((sched_mc_smt_pass_cnt= $sched_mc_smt_pass_cnt +1))
> + : $(( sched_mc_smt_pass_cnt += 1 ))
> fi
> done
> analyze_consolidation_result $sched_mc $work_load $sched_mc_smt_pass_cnt $sched_smt
> @@ -207,10 +207,10 @@ if [ $# -gt 0 -a $1 == "-exclusive" ]; then
> #Testcase to validate consolidation at core level
> sched_mc_smt_pass_cnt=0
> stress="thread"
> - ((TST_COUNT= $TST_COUNT + 1))
> + : $(( TST_COUNT += 1 ))
> for repeat_test in `seq 1 10`; do
> if cpu_consolidation.py -c $sched_mc -t $sched_smt -w $work_load -s $stress; then
> - ((sched_mc_smt_pass_cnt= $sched_mc_smt_pass_cnt +1))
> + : $(( sched_mc_smt_pass_cnt += 1 ))
> fi
> done
> analyze_consolidation_result $sched_mc $work_load $sched_mc_smt_pass_cnt $sched_smt $stress
> diff --git a/testcases/kernel/sched/hyperthreading/ht_enabled/smt_smp_enabled.sh b/testcases/kernel/sched/hyperthreading/ht_enabled/smt_smp_enabled.sh
> index 85d42a3..8b8a909 100755
> --- a/testcases/kernel/sched/hyperthreading/ht_enabled/smt_smp_enabled.sh
> +++ b/testcases/kernel/sched/hyperthreading/ht_enabled/smt_smp_enabled.sh
> @@ -64,7 +64,7 @@ else
> cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | cut -f 2 -d ':'\
> | sed 's/ //' | uniq`
>
> - if [ $cpu_cores == 1 ];then
> + if [ $cpu_cores -eq 1 ];then
> tst_resm TPASS "SMT is enable"
> elif [ $cpu_cores -ge 2 ];then
> tst_resm TPASS "SMP System"
> diff --git a/testcases/kernel/syscalls/ioctl/test_ioctl b/testcases/kernel/syscalls/ioctl/test_ioctl
> index 2ea3e39..7ae9e71 100755
> --- a/testcases/kernel/syscalls/ioctl/test_ioctl
> +++ b/testcases/kernel/syscalls/ioctl/test_ioctl
> @@ -25,7 +25,7 @@ export TST_COUNT=0
>
> for tttype in `ls /dev/tty*`
> do
> -device_no=${tttype:8}
> +device_no=${tttype#/dev/tty}
> case "$device_no" in
> [0-9]|[0-9][0-9])
> tst_resm TINFO "Testing ioctl01 with $tttype"
> @@ -43,7 +43,7 @@ done
>
> for tttype in `ls /dev/tty*`
> do
> -device_no=${tttype:8}
> +device_no=${tttype#/dev/tty}
> case "$device_no" in
> [0-9]|[0-9][0-9])
> tst_resm TINFO "Testing ioctl02 with $tttype"
> diff --git a/testcases/misc/tcore_patch_test_suites/tcore.sh b/testcases/misc/tcore_patch_test_suites/tcore.sh
> index f087fa7..4b032dc 100755
> --- a/testcases/misc/tcore_patch_test_suites/tcore.sh
> +++ b/testcases/misc/tcore_patch_test_suites/tcore.sh
> @@ -107,13 +107,13 @@ Test_gen_core()
> rm -f core.*
> fi
> pid=`$BIN_DIR/tcore |grep "consumer pid"|awk '{print $2}'|cut -d = -f 2`
> - echo -e "Test whether we can generate the needed core file"
> + echo "Test whether we can generate the needed core file"
> if [ -f core.* ];then
> - echo -e "PASS"
> + echo "PASS"
> pass=`expr $pass + 1`
> return 0
> else
> - echo -e "FAIL"
> + echo "FAIL"
> fail=`expr $fail + 1`
> return 1
> fi
> @@ -124,14 +124,14 @@ Test_core_file()
> cd $TEST_DIR
> prepare_gdb
> mv -f $TEST_DIR/core.* $TEST_DIR/corefile >/dev/null 2>&1
> - echo -e "Test whether the core support bt,fpu and threads commands "
> + echo "Test whether the core support bt,fpu and threads commands "
> expect $BIN_DIR/tcore.exp
> return=$?
> pass=`expr $pass + $return`
> fail=`expr 3 - $return + $fail`
> }
>
> -echo -e "Test Tcore patch "
> +echo "Test Tcore patch "
> check_install
> Test_gen_core
> Test_core_file
> diff --git a/testcases/network/iproute/ip_tests.sh b/testcases/network/iproute/ip_tests.sh
> index c622700..59322b6 100755
> --- a/testcases/network/iproute/ip_tests.sh
> +++ b/testcases/network/iproute/ip_tests.sh
> @@ -61,7 +61,7 @@ init()
> trap "cleanup" 0
>
> # create the tmp directory for this testcase.
> - mkdir -p $LTPTMP/ &>/dev/null || RC=$?
> + mkdir -p $LTPTMP/ >/dev/null 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brkm TBROK "INIT: Unable to create temporary directory"
> @@ -69,7 +69,7 @@ init()
> fi
>
> # Check to see if test harness functions are in the path.
> - which tst_resm &>$LTPTMP/tst_ip.err || RC=$?
> + which tst_resm >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brkm TBROK NULL \
> @@ -77,7 +77,7 @@ init()
> return $RC
> fi
>
> - which awk &>$LTPTMP/tst_ip.err || RC=$?
> + which awk >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brkm TBROK NULL \
> @@ -85,7 +85,7 @@ init()
> return $RC
> fi
>
> - which ip &>$LTPTMP/tst_ip.err || RC=$?
> + which ip >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brkm TBROK NULL \
> @@ -93,7 +93,7 @@ init()
> return $RC
> fi
>
> - which ifconfig &>$LTPTMP/tst_ip.err || RC=$?
> + which ifconfig >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brkm TBROK NULL \
> @@ -104,13 +104,13 @@ init()
> tst_resm TINFO "INIT: Inititalizing tests."
>
> # Aliasing eth0 to create private network.
> - /sbin/ifconfig eth0:1 10.1.1.12 &>$LTPTMP/tst_ip.err || RC=$?
> + /sbin/ifconfig eth0:1 10.1.1.12 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brk TBROK "INIT: failed aliasing eth0:1 with IP 10.1.1.12"
> return $RC
> else
> - /sbin/route add -host 10.1.1.12 dev eth0:1 &>$LTPTMP/tst_ip.err \
> + /sbin/route add -host 10.1.1.12 dev eth0:1 >$LTPTMP/tst_ip.err 2>&1 \
> || RC=$?
> if [ $RC -ne 0 ]
> then
> @@ -153,10 +153,10 @@ cleanup()
> TST_COUNT=0
> RC=0
>
> - /sbin/ifconfig eth0:1 &>$LTPTMP/tst_ip.err || RC=$?
> + /sbin/ifconfig eth0:1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -eq 0 ]
> then
> - /sbin/ifconfig eth0:1 down &>$LTPTMP/tst_ip.err
> + /sbin/ifconfig eth0:1 down >$LTPTMP/tst_ip.err 2>&1
> fi
>
> rm -fr $LTPTMP
> @@ -187,7 +187,7 @@ test01()
>
> tst_resm TINFO "Test #1: changing mtu size of eth0:1 device."
>
> - ip link set eth0:1 mtu 300 &>$LTPTMP/tst_ip.err
> + ip link set eth0:1 mtu 300 >$LTPTMP/tst_ip.err 2>&1
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -232,7 +232,7 @@ test02()
> tst_resm TINFO \
> "Test #2: Installing dummy.o in kernel"
>
> - modprobe dummy &>$LTPTMP/tst_ip.out || RC=$?
> + modprobe dummy >$LTPTMP/tst_ip.out 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brk TBROK $LTPTMP/tst_ip.out NULL \
> @@ -240,7 +240,7 @@ test02()
> return $RC
> fi
>
> - ip link show dummy0 | grep dummy0 &>$LTPTMP/tst_ip.err || RC=$?
> + ip link show dummy0 | grep dummy0 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err "Test #2: ip command failed. Reason:"
> @@ -278,7 +278,7 @@ test03()
> tst_resm TINFO \
> "Test #3: ip addr add - adds a new protolcol address to the device"
>
> - ip addr add 127.6.6.6 dev lo &>$LTPTMP/tst_ip.err || RC=$?
> + ip addr add 127.6.6.6 dev lo >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -287,7 +287,7 @@ test03()
> else
> tst_resm TINFO \
> "Test #3: ip addr show dev <device> - shows protocol address."
> - ip addr show dev lo | grep 127.6.6.6 &>$LTPTMP/tst_ip.err || RC=$?
> + ip addr show dev lo | grep 127.6.6.6 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -297,14 +297,14 @@ test03()
>
> tst_resm TINFO \
> "Test #3: ip addr del <ip> dev <device> - deletes protocol address."
> - ip addr del 127.6.6.6 dev lo &>$LTPTMP/tst_ip.err || RC=$?
> + ip addr del 127.6.6.6 dev lo >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> "Test #3: ip addr del command failed. Reason: "
> return $RC
> else
> - ip addr show dev lo | grep 127.6.6.6 &>$LTPTMP/tst_ip.err || RC=$?
> + ip addr show dev lo | grep 127.6.6.6 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -eq 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -343,7 +343,7 @@ test04()
> tst_resm TINFO \
> "Test #4: ip neigh add - adds a new neighbour to arp tables."
>
> - ip neigh add 127.0.0.1 dev lo nud reachable &>$LTPTMP/tst_ip.err || RC=$?
> + ip neigh add 127.0.0.1 dev lo nud reachable >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -357,7 +357,7 @@ test04()
> 127.0.0.1 dev lo lladdr 00:00:00:00:00:00 nud reachable
> EOF
>
> - ip neigh show 127.0.0.1 | head -n1 &>$LTPTMP/tst_ip.out || RC=$?
> + ip neigh show 127.0.0.1 | head -n1 >$LTPTMP/tst_ip.out 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -365,7 +365,7 @@ test04()
> return $RC
> else
> diff -iwB $LTPTMP/tst_ip.out $LTPTMP/tst_ip.exp \
> - &>$LTPTMP/tst_ip.err || RC=$?
> + >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res FAIL $LTPTMP/tst_ip.err \
> @@ -377,14 +377,14 @@ test04()
> tst_resm TINFO \
> "Test #4: ip neigh del - deletes neighbour from the arp table."
>
> - ip neigh del 127.0.0.1 dev lo &>$LTPTMP/tst_ip.err || RC=$?
> + ip neigh del 127.0.0.1 dev lo >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> "Test #4: ip neigh del command failed return = $RC. Reason: "
> return $RC
> else
> - ip neigh show | grep 127.0.0.1 grep -v "nud failed$" &>$LTPTMP/tst_ip.err || RC=$?
> + ip neigh show | grep 127.0.0.1 grep -v "nud failed$" >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -eq 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -426,7 +426,7 @@ test05()
> tst_resm TINFO \
> "Test #5: create an interface with inet 10.6.6.6 alias to eth0"
>
> - ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 &>$LTPTMP/tst_ip.err || RC=$?
> + ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brk TBROK $LTPTMP/tst_ip.err NULL \
> @@ -434,7 +434,7 @@ test05()
> return $RC
> fi
>
> - ip route add 10.6.6.6 via 127.0.0.1 &>$LTPTMP/tst_ip.err || RC=$?
> + ip route add 10.6.6.6 via 127.0.0.1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -449,7 +449,7 @@ test05()
> 10.6.6.6 via 127.0.0.1 dev lo
> EOF
>
> - ip route show | head -n1 &>$LTPTMP/tst_ip.out || RC=$?
> + ip route show | head -n1 >$LTPTMP/tst_ip.out 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -457,7 +457,7 @@ test05()
> return $RC
> else
> diff -iwB $LTPTMP/tst_ip.out $LTPTMP/tst_ip.exp \
> - &>$LTPTMP/tst_ip.err || RC=$?
> + >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res FAIL $LTPTMP/tst_ip.err \
> @@ -469,14 +469,14 @@ test05()
> tst_resm TINFO \
> "Test #5: ip route del - deletes route from the route table."
>
> - ip route del 10.6.6.6 via 127.0.0.1 &>$LTPTMP/tst_ip.err || RC=$?
> + ip route del 10.6.6.6 via 127.0.0.1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> "Test #5: ip route del command failed return = $RC. Reason: "
> return $RC
> else
> - ip route show | grep 127.0.0.1 &>$LTPTMP/tst_ip.err || RC=$?
> + ip route show | grep 127.0.0.1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -eq 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -514,7 +514,7 @@ test06()
> tst_resm TINFO \
> "Test #6: ip maddr add - adds a new multicast addr"
>
> - ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 &>$LTPTMP/tst_ip.err || RC=$?
> + ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_brk TBROK $LTPTMP/tst_ip.err NULL \
> @@ -522,7 +522,7 @@ test06()
> return $RC
> fi
>
> - ip maddr add 66:66:00:00:00:66 dev eth0:1 &>$LTPTMP/tst_ip.err || RC=$?
> + ip maddr add 66:66:00:00:00:66 dev eth0:1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -536,7 +536,7 @@ test06()
> link 66:66:00:00:00:66 static
> EOF
>
> - ip maddr show | grep "66:66:00:00:00:66" &>$LTPTMP/tst_ip.out || RC=$?
> + ip maddr show | grep "66:66:00:00:00:66" >$LTPTMP/tst_ip.out 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> @@ -556,7 +556,7 @@ test06()
> tst_resm TINFO \
> "Test #6: ip maddr del - deletes multicast addr."
>
> - ip maddr del 66:66:00:00:00:66 dev eth0:1 &>$LTPTMP/tst_ip.err || RC=$?
> + ip maddr del 66:66:00:00:00:66 dev eth0:1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
> diff --git a/testcases/network/nfs/nfs03/nfs03 b/testcases/network/nfs/nfs03/nfs03
> index 8cbd3a4..bbc79e9 100755
> --- a/testcases/network/nfs/nfs03/nfs03
> +++ b/testcases/network/nfs/nfs03/nfs03
> @@ -91,10 +91,10 @@ fs_inod()
> #
> # RETURNS: None.
> #=============================================================================
> -function err_log
> +err_log()
> {
> error "$1"
> - let step_errors="$step_errors + 1"
> + : $(($step_errors+=1))
> }
>
>
> @@ -107,7 +107,7 @@ function err_log
> #
> # RETURNS: None.
> #=============================================================================
> -function make_subdirs
> +make_subdirs()
> {
> i=0;
> while [ "$i" -lt "$numsubdirs" ]; do
> @@ -115,7 +115,7 @@ function make_subdirs
> echo "$0: mkdir dir$i"
> mkdir -p dir$i || echo "mkdir dir$i FAILED"
> }
> - let i="$i + 1"
> + : $(( i += 1 ))
> done;
> }
>
> @@ -129,7 +129,7 @@ function make_subdirs
> #
> # RETURNS: None.
> #=============================================================================
> -function touch_files
> +touch_files()
> {
> echo "$0: touch files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
> j=0;
> @@ -140,10 +140,10 @@ function touch_files
>
> while [ "$k" -lt "$numfiles" ]; do
> >file$j$k || err_log ">file$j$k FAILED"
> - let k="$k + 1"
> + : $(( k += 1 ))
> done
>
> - let j="$j + 1"
> + : $(( j += 1 ))
> cd ..
> done
> }
> @@ -158,7 +158,7 @@ function touch_files
> #
> # RETURNS: None.
> #=============================================================================
> -function rm_files
> +rm_files()
> {
> echo "$0: rm files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
> j=0;
> @@ -169,10 +169,10 @@ function rm_files
>
> while [ "$k" -lt "$numfiles" ]; do
> rm -f file$j$k || err_log "rm -f file$j$k FAILED"
> - let k="$k + 1"
> + : $(( k += 1 ))
> done
>
> - let j="$j + 1"
> + : $(( j += 1 ))
> cd ..
> done
> }
> @@ -187,7 +187,7 @@ function rm_files
> #
> # RETURNS: None.
> #=============================================================================
> -function step1
> +step1()
> {
> echo "=============================================="
> echo "MULTIPLE PROCESSES CREATING AND DELETING FILES"
> @@ -240,7 +240,7 @@ function step1
> rm_files &
> pid2=$!
>
> - let i="$i + 1"
> + : $(( i += 1 ))
> done
>
> # wait for all background processes to complete execution
> @@ -376,7 +376,7 @@ $trace_logic
> echo "fs_inod starting on $TCtmp."
> fs_inod $TCtmp $DIR_NUM $FILE_NUM 1
> retval=$?
> - echo $"fs_inod on $TCtmp finished."
> + echo "fs_inod on $TCtmp finished."
>
> if [ "$retval" != 0 ]; then
> end_testcase "Errors have resulted from this test: fs_inod returned $retval."
>
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread
[parent not found: <200910211528.n9LFST8q028289@e35.co.us.ibm.com>]
* Re: [LTP] [PATCH] Fix some bashisms
[not found] <200910211528.n9LFST8q028289@e35.co.us.ibm.com>
@ 2009-10-26 17:02 ` Subrata Modak
2009-10-26 19:37 ` Garrett Cooper
2009-10-29 18:12 ` JiříPaleček
0 siblings, 2 replies; 28+ messages in thread
From: Subrata Modak @ 2009-10-26 17:02 UTC (permalink / raw)
To: Jiri Palecek; +Cc: ltp-list
On Wed, 2009-10-21 at 02:19 +0200, Jiri Palecek wrote:
> Hello,
>
> this is another patch fixing bashisms in LTP tests (the fixes are more or less the same as in the previous patches, except for a few exceptions). Note that the patch is not complete, in the sense that there may remain further bashisms in the source even after applying the patch (like use of arrays, which is visible even from this patch).
>
> Regards
> Jiri Palecek
>
> Signed-off-by: Jiri Palecek <jpalecek@web.de>
Hmm,. Some of them failed to apply. Can you please resend only the error
part(s):
patching file testcases/kernel/fs/fs-bench/modaltr.sh
Hunk #1 FAILED at 43.
1 out of 1 hunk FAILED -- saving rejects to file
testcases/kernel/fs/fs-bench/modaltr.sh.rej
patching file testcases/kernel/fs/fs_di/fs_di
patching file testcases/kernel/fs/mongo/test.sh
Hunk #1 FAILED at 26.
Hunk #2 FAILED at 52.
Hunk #3 FAILED at 70.
3 out of 3 hunks FAILED -- saving rejects to file
testcases/kernel/fs/mongo/test.sh.rej
patching file testcases/network/tcp_cmds/netstat/netstat01
Hunk #1 FAILED at 77.
1 out of 1 hunk FAILED -- saving rejects to file
testcases/network/tcp_cmds/netstat/netstat01.rej
Regards--
Subrata
> ---
> .../controllers/cgroup_fj/cgroup_fj_utility.sh | 2 +-
> .../controllers/cgroup_fj/run_cgroup_test_fj.sh | 8 ++--
> .../controllers/cpuctl_fj/run_cpuctl_test_fj.sh | 51 ++++++++++----------
> .../memcg/functional/memcg_function_test.sh | 6 +-
> .../controllers/memcg/stress/memcg_stress_test.sh | 18 ++++----
> testcases/kernel/fs/acls/acl_test01 | 12 ++--
> testcases/kernel/fs/fs-bench/modaltr.sh | 2 +-
> testcases/kernel/fs/fs_di/fs_di | 4 +-
> testcases/kernel/fs/mongo/test.sh | 8 +--
> .../hotplug/cpu_hotplug/functional/hotplug02.sh | 6 +-
> .../hotplug/cpu_hotplug/functional/hotplug03.sh | 16 +++---
> .../hotplug/cpu_hotplug/functional/hotplug04.sh | 10 ++--
> .../cpu_hotplug/functional/hotplug06.sar.sh | 6 +-
> .../cpu_hotplug/functional/hotplug06.top.sh | 6 +-
> .../hotplug/cpu_hotplug/functional/hotplug07.sh | 6 +-
> .../network/can/filter-tests/run_ltp-can_tests.sh | 2 +-
> testcases/network/tcp_cmds/netstat/netstat01 | 2 +-
> 17 files changed, 82 insertions(+), 83 deletions(-)
>
> diff --git a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_utility.sh b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_utility.sh
> index 4ba15d6..ed161fa 100755
> --- a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_utility.sh
> +++ b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_utility.sh
> @@ -547,7 +547,7 @@ reclaim_foundling()
> if [ -e /proc/$cur_pid/ ];then
> echo "ERROR: pid $cur_pid reclaimed"
> do_echo 0 1 "$cur_pid" "/dev/cgroup/tasks"
> - let "foundlings = $foundlings + 1"
> + : $((foundlings += 1))
> fi
> done
>
> diff --git a/testcases/kernel/controllers/cgroup_fj/run_cgroup_test_fj.sh b/testcases/kernel/controllers/cgroup_fj/run_cgroup_test_fj.sh
> index 70e4078..eb2d1db 100755
> --- a/testcases/kernel/controllers/cgroup_fj/run_cgroup_test_fj.sh
> +++ b/testcases/kernel/controllers/cgroup_fj/run_cgroup_test_fj.sh
> @@ -33,7 +33,7 @@ export TMPFILE=$TESTROOT/tmp_tasks
> export CASENO1=0
> export CASENO2=0
>
> -if [ "$UID" -ne 0 ]; then
> +if [ "$(id -ru)" -ne 0 ]; then
> echo "***error***:you must use root to test"
> exit -1
> fi
> @@ -107,17 +107,17 @@ do
> if [ $? -ne 0 ]; then
> case $CASETYPE in
> "function" )
> - let "CASENO1 = $CASENO1 + 1"
> + : $(( CASENO1 += 1 ))
> export CASENO1=$CASENO1
> $TESTROOT/cgroup_fj_function.sh $CASECMD
> ;;
> "function2" )
> - let "CASENO1 = $CASENO1 + 1"
> + : $(( CASENO1 += 1 ))
> export CASENO1=$CASENO1
> $TESTROOT/cgroup_fj_function2.sh $CASECMD
> ;;
> "stress" )
> - let "CASENO2 = $CASENO2 + 1"
> + : $(( CASENO2 += 1 ))
> export CASENO2=$CASENO2
> $TESTROOT/cgroup_fj_stress.sh $CASECMD
> ;;
> diff --git a/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh b/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh
> index 6ab0f65..f02f59a 100755
> --- a/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh
> +++ b/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh
> @@ -58,8 +58,8 @@ setup()
> # Write the cleanup function
> cleanup()
> {
> - mount | grep "$CPUCTL" &> /dev/null || {
> - rm -rf "$CPUCTL" &> /dev/null
> + mount | grep "$CPUCTL" > /dev/null 2>&1 || {
> + rm -rf "$CPUCTL" > /dev/null 2>&1
> return 0
> }
>
> @@ -73,22 +73,19 @@ cleanup()
> done
>
> umount $CPUCTL || return 1
> - rmdir $CPUCTL &> /dev/null
> + rmdir $CPUCTL > /dev/null 2>&1
> }
>
> creat_process()
> {
> cat /dev/zero > /dev/null 2>/dev/null &
> - taskset -p 1 $! &>/dev/null
> + taskset -p 1 $! >/dev/null 2>&1
> echo $!
> }
>
> get_cpu_usage()
> {
> - top=($(top -b -n 1 -p $1 | tail -2 | head -1))
> - top=${top[8]}
> - top=`echo $top | awk -F "." '{print $1}'`
> - echo "$top"
> + top -b -n 1 -p $1 | tail -2 | head -1 | awk 'print $9' | awk -F "." '{print $1}'
> }
>
> kill_all_pid()
> @@ -424,7 +421,7 @@ case12 ()
> wait $pid
> }
>
> -max_shares=$((2**18))
> +max_shares=$((1 << 18))
>
> # echo MAX_SHARES into shares
> case13 ()
> @@ -589,7 +586,7 @@ case19()
> echo "pid $pid cpu_usage $cpu_usage"
>
> kill -9 $pid $pid_other
> - expr 96 \< "$cpu_usage" \& "$cpu_usage" \< 103 &> /dev/null || return 1
> + expr 96 \< "$cpu_usage" \& "$cpu_usage" \< 103 > /dev/null 2>&1 || return 1
> return 0
> }
>
> @@ -605,7 +602,7 @@ case20()
> echo "pid $pid cpu_usage $cpu_usage"
>
> kill -9 $pid $pid_other
> - expr 96 \< "$cpu_usage" \& "$cpu_usage" \< 103 &> /dev/null || return 1
> + expr 96 \< "$cpu_usage" \& "$cpu_usage" \< 103 > /dev/null 2>&1 || return 1
> return 0
> }
>
> @@ -615,7 +612,7 @@ case21()
> pid=$(creat_process)
> echo $pid > "$CPUCTL/1/tasks"
>
> - while ((1))
> + while true
> do
> creat_process > "$CPUCTL/1/2/tasks"
> sleep 1
> @@ -625,18 +622,20 @@ case21()
> sleep 10
> ret=0
>
> - for ((top_times=0; top_times<10 && ret==0; top_times++))
> + top_times=0
> + while [ "$top_times" -lt 10 -a "$ret" = 0 ]
> do
> cpu_usage=$(get_cpu_usage $pid)
> echo "pid $pid cpu_usage $cpu_usage"
> - expr 44 \< "$cpu_usage" \& "$cpu_usage" \< 56 &> /dev/null
> + expr 44 \< "$cpu_usage" \& "$cpu_usage" \< 56 > /dev/null 2>&1
> ret=$?
> + : $(( top_times+=1 ))
> done
>
> - kill -9 $pid $loop_pid &> /dev/null
> - wait $pid $loop_pid &>/dev/null
> + kill -9 $pid $loop_pid > /dev/null 2>&1
> + wait $pid $loop_pid >/dev/null 2>&1
> sleep 2
> - kill_all_pid < "$CPUCTL/1/2/tasks" &>/dev/null
> + kill_all_pid < "$CPUCTL/1/2/tasks" >/dev/null 2>&1
> sleep 2
> return $ret
> }
> @@ -645,7 +644,7 @@ case22()
> {
> mkdir "$CPUCTL/1" "$CPUCTL/1/2"
> pid=$(creat_process)
> - while ((1))
> + while true
> do
> echo $pid > "$CPUCTL/1/tasks"
> echo $pid > "$CPUCTL/1/2/tasks"
> @@ -656,26 +655,28 @@ case22()
> sleep 10
> ret=0
>
> - for ((top_times=0; top_times<10 && ret==0; top_times++))
> + top_times=0
> + while [ "$top_times" -lt 10 -a "$ret" = 0 ]
> do
> cpu_usage=$(get_cpu_usage $pid)
> echo "pid $pid cpu_usage $cpu_usage"
> - expr 94 \< "$cpu_usage" \& "$cpu_usage" \< 106 &> /dev/null
> + expr 94 \< "$cpu_usage" \& "$cpu_usage" \< 106 > /dev/null 2>&1
> ret=$?
> + : $(( top_times+=1 ))
> done
>
> - kill -9 $pid $loop_pid &> /dev/null
> - wait $pid $loop_pid &>/dev/null
> + kill -s KILL $pid $loop_pid > /dev/null 2>&1
> + wait $pid $loop_pid >/dev/null 2>&1
> return $ret
> }
>
> -rm -rf "$CPUCTL_TMP" &>/dev/null || exit 1
> +rm -rf "$CPUCTL_TMP" >/dev/null 2>&1 || exit 1
> mkdir -p "$CPUCTL_TMP" || exit 1
>
> # test
> do_test ()
> {
> - for (( i=1; i<=$TST_TOTAL; i++ ))
> + for i in $(seq 1 $TST_TOTAL)
> do
> setup || {
> tst_resm TFAIL "case$i FAIL"
> @@ -698,5 +699,5 @@ do_test ()
>
> do_test
>
> -rm -rf "$CPUCTL_TMP" &>/dev/null
> +rm -rf "$CPUCTL_TMP" >/dev/null 2>&1
>
> diff --git a/testcases/kernel/controllers/memcg/functional/memcg_function_test.sh b/testcases/kernel/controllers/memcg/functional/memcg_function_test.sh
> index 0f11835..003af1c 100755
> --- a/testcases/kernel/controllers/memcg/functional/memcg_function_test.sh
> +++ b/testcases/kernel/controllers/memcg/functional/memcg_function_test.sh
> @@ -536,8 +536,8 @@ do_mount()
> }
>
> # Run all the test cases
> -for ((i = 1; i <= $TST_TOTAL; i++))
> -{
> +for i in $(seq 1 $TST_TOTAL)
> +do
> export TST_COUNT=$(( $TST_COUNT + 1 ))
> cur_id=$i
>
> @@ -556,7 +556,7 @@ for ((i = 1; i <= $TST_TOTAL; i++))
> rmdir /dev/memcg/$i
>
> cleanup;
> -}
> +done
>
> echo $shmmax > /proc/sys/kernel/shmmax
>
> diff --git a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
> index 86b8cb9..6c9cd75 100755
> --- a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
> +++ b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
> @@ -66,29 +66,29 @@ run_stress()
> {
> do_mount;
>
> - for ((i = 0; i < $1; i++))
> - {
> + for i in $(seq 0 $(($1-1)))
> + do
> mkdir /dev/memcg/$i 2> /dev/null
> ./memcg_process_stress $2 $3 &
> pid[$i]=$!
>
> echo ${pid[$i]} > /dev/memcg/$i/tasks
> - }
> + done
>
> - for ((i = 0; i < $1; i++))
> - {
> + for i in $(seq 0 $(($1-1)))
> + do
> /bin/kill -s SIGUSR1 ${pid[$i]} 2> /dev/null
> - }
> + done
>
> sleep $4
>
> - for ((i = 0; i < $1; i++))
> - {
> + for i in $(seq 0 $(($1-1)))
> + do
> /bin/kill -s SIGINT ${pid[$i]} 2> /dev/null
> wait ${pid[$i]}
>
> rmdir /dev/memcg/$i 2> /dev/null
> - }
> + done
>
> cleanup;
> }
> diff --git a/testcases/kernel/fs/acls/acl_test01 b/testcases/kernel/fs/acls/acl_test01
> index c892b0e..20cd1ac 100755
> --- a/testcases/kernel/fs/acls/acl_test01
> +++ b/testcases/kernel/fs/acls/acl_test01
> @@ -51,7 +51,7 @@ if [ "z$iam" = "z$TEST_USER1" ]
> then
> echo ""
> else
> -if [ $UID != 0 ]
> +if [ $(id -ru) != 0 ]
> then
> echo "FAILED: Must have root access to execute this script"
> exit 1
> @@ -76,7 +76,7 @@ if [ $? != 0 ]
> then
> echo ""
> echo "FAILED: [ losetup ] Must have loop device support by kernel"
> - echo -e "\t to execute this script"
> + printf "\t to execute this script\n"
> exit 1
> fi
>
> @@ -90,8 +90,8 @@ then
> then
> echo ""
> echo "FAILED: [ mount ] Make sure that ACL (Access Control List)"
> - echo -e "\t and Extended Attribute are built into the kernel"
> - echo -e "\t Can not mount ext3 file system with acl and user_xattr options"
> + printf "\t and Extended Attribute are built into the kernel\n"
> + printf "\t Can not mount ext3 file system with acl and user_xattr options\n"
> exit 1
> fi
> else
> @@ -102,8 +102,8 @@ else
> then
> echo ""
> echo "FAILED: [ mount ] Make sure that ACL (Access Control List)"
> - echo -e "\t and Extended Attribute are built into the kernel"
> - echo -e "\t Can not mount ext2 file system with acl and user_xattr options"
> + printf "\t and Extended Attribute are built into the kernel\n"
> + printf "\t Can not mount ext2 file system with acl and user_xattr options\n"
> exit 1
> fi
> fi
> diff --git a/testcases/kernel/fs/fs-bench/modaltr.sh b/testcases/kernel/fs/fs-bench/modaltr.sh
> index 85d2c30..36e6f0c 100755
> --- a/testcases/kernel/fs/fs-bench/modaltr.sh
> +++ b/testcases/kernel/fs/fs-bench/modaltr.sh
> @@ -43,7 +43,7 @@ LOG_DIR1=/tmp/log1
> HOME_DIR=/home
> BLOCK_DIR=/dev/mtdblock
> export PATH=$PATH:/sbin
> - if [ $UID -ne 0 ];
> + if [ $(id -ru) -ne 0 ];
> then
> echo "must be root to run this"
> exit
> diff --git a/testcases/kernel/fs/fs_di/fs_di b/testcases/kernel/fs/fs_di/fs_di
> index 54dd8b4..c6447ef 100755
> --- a/testcases/kernel/fs/fs_di/fs_di
> +++ b/testcases/kernel/fs/fs_di/fs_di
> @@ -201,10 +201,10 @@ $trace_logic
> end_testcase "Could not create testfile of size ${SIZE}Mb"
> fi
> RANDOM_DEPTH=$RANDOM
> - let "RANDOM_DEPTH %= 500"
> + : $(( RANDOM_DEPTH %= 500 ))
>
> RANDOM_LENGTH=$RANDOM
> - let "RANDOM_LENGTH %= 500"
> + : $(( RANDOM_LENGTH %= 500 ))
> RANDOM_LENGTH=$(( $RANDOM_LENGTH / 10 ))
>
> NameCount=0
> diff --git a/testcases/kernel/fs/mongo/test.sh b/testcases/kernel/fs/mongo/test.sh
> index fe75664..eccb079 100755
> --- a/testcases/kernel/fs/mongo/test.sh
> +++ b/testcases/kernel/fs/mongo/test.sh
> @@ -26,7 +26,7 @@ TEST_DIR=testdir
>
>
> #should be root to execute this script .
> - if [ $UID -ne 0 ]; then
> + if [ $(id -ru) -ne 0 ]; then
> echo "This script must be run as root"
> exit
> fi
> @@ -52,8 +52,7 @@ modprobe loop
> fi
>
> #run the mongo test on reiserfs file system type
> -function reiserfs
> -
> +reiserfs()
> {
> cat > fs.sh <<EOF
> echo "performing mongo on reiserfs"
> @@ -71,8 +70,7 @@ EOF
>
>
> #To run on jfs file system type
> -function JFS
> -
> +JFS()
> {
> cat >> fs.sh <<EOF
> echo "performing mongo on jfs file system"
> diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug02.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug02.sh
> index 08e9301..7f1c5b1 100755
> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug02.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug02.sh
> @@ -15,8 +15,8 @@ fi
>
> # Includes:
> LHCS_PATH=${LHCS_PATH:-".."}
> -source $LHCS_PATH/include/testsuite.fns
> -source $LHCS_PATH/include/hotplug.fns
> +. $LHCS_PATH/include/testsuite.fns
> +. $LHCS_PATH/include/hotplug.fns
>
> echo "Name: $CASE"
> echo "Date: `date`"
> @@ -73,7 +73,7 @@ until [ $loop = 0 ]; do
>
> # Turn the CPU back online just to see what happens.
> online_cpu ${CPU_TO_TEST}
> - let "loop = loop - 1"
> + : $(( loop -= 1 ))
> done
>
> sleep 2
> diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug03.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug03.sh
> index c550890..97d5205 100755
> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug03.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug03.sh
> @@ -15,8 +15,8 @@ fi
>
> # Includes:
> LHCS_PATH=${LHCS_PATH:-".."}
> -source $LHCS_PATH/include/testsuite.fns
> -source $LHCS_PATH/include/hotplug.fns
> +. $LHCS_PATH/include/testsuite.fns
> +. $LHCS_PATH/include/hotplug.fns
>
> echo "Name: $CASE"
> echo "Date: `date`"
> @@ -48,7 +48,7 @@ do_clean()
> # Turn off the CPUs that were off before the test start
> until [ $cpu = 0 ];do
> offline_cpu ${on[${cpu}]}
> - let "cpu = cpu - 1"
> + : $(( cpu -= 1 ))
> done
> }
>
> @@ -60,10 +60,10 @@ until [ $loop = 0 ]; do
> for i in $( get_all_cpus ); do
> online_cpu $1
> if [ $? = 0 ]; then
> - let "cpu = cpu + 1"
> + : $(( cpu += 1 ))
> on[${cpu}]=$i
> fi
> - let "number_of_cpus = number_of_cpus + 1"
> + : $(( number_of_cpus += 1 ))
> done
>
> offline_cpu ${CPU_TO_TEST}
> @@ -76,11 +76,11 @@ until [ $loop = 0 ]; do
> # CPUs we have. This is to help ensure we've got enough processes
> # that at least one will migrate to the new CPU. Store the PIDs
> # so we can kill them later.
> - let "number_of_cpus = number_of_cpus * 2"
> + : $(( number_of_cpus *= 2 ))
> until [ $number_of_cpus = 0 ]; do
> $LHCS_PATH/tools/do_spin_loop > /dev/null 2>&1 &
> echo $! >> /var/run/hotplug4_$$.pid
> - let "number_of_cpus = number_of_cpus - 1"
> + : $(( number_of_cpus -= 1 ))
> done
>
> ps aux | head -n 1
> @@ -111,7 +111,7 @@ until [ $loop = 0 ]; do
>
> do_clean
>
> - let "loop = loop -1"
> + : $(( loop -=1 ))
> done
>
> exit_clean
> diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug04.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug04.sh
> index b147286..00a634b 100755
> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug04.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug04.sh
> @@ -9,8 +9,8 @@ loop=${HOTPLUG04_LOOPS:-1}
>
> # Includes:
> LHCS_PATH=${LHCS_PATH:-".."}
> -source $LHCS_PATH/include/testsuite.fns
> -source $LHCS_PATH/include/hotplug.fns
> +. $LHCS_PATH/include/testsuite.fns
> +. $LHCS_PATH/include/hotplug.fns
>
> echo "Name: $CASE"
> echo "Date: `date`"
> @@ -26,7 +26,7 @@ until [ $loop = 0 ]; do
> online_cpu $i
> RC=$?
> if [ $RC != 0 ]; then
> - let "cpu = cpu + 1"
> + : $(( cpu += 1 ))
> on[${cpu}]=$i
> echo "${on[${cpu}]}"
> fi
> @@ -51,7 +51,7 @@ until [ $loop = 0 ]; do
> # Online the ones that were on initially
> until [ $cpu = 0 ]; do
> online_cpu ${on[${cpu}]}
> - let "cpu = cpu - 1"
> + : $(( cpu -= 1 ))
> done
>
> # Return CPU 0 to its initial state
> @@ -61,7 +61,7 @@ until [ $loop = 0 ]; do
> offline_cpu 0
> fi
>
> - let "loop = loop -1"
> + : $(( loop -=1 ))
> done
>
> exit_clean
> \ No newline at end of file
> diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug06.sar.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug06.sar.sh
> index d6f4601..aba658a 100755
> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug06.sar.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug06.sar.sh
> @@ -15,8 +15,8 @@ fi
>
> # Includes:
> LHCS_PATH=${LHCS_PATH:-".."}
> -source $LHCS_PATH/include/testsuite.fns
> -source $LHCS_PATH/include/hotplug.fns
> +. $LHCS_PATH/include/testsuite.fns
> +. $LHCS_PATH/include/hotplug.fns
>
> echo "Name: $CASE"
> echo "Date: `date`"
> @@ -81,7 +81,7 @@ until [ $loop = 0 ]; do
>
> # Check that SAR registered the change in CPU online/offline states
> NEW_NUMBER_CPU_OFF=`cat /tmp/log_$$ | grep ${time} | grep -i nan | wc -l`
> - let "NUMBER_CPU_OFF = NUMBER_CPU_OFF - 1"
> + : $(( NUMBER_CPU_OFF -= 1 ))
> if [ $NUMBER_CPU_OFF = $NEW_NUMBER_CPU_OFF ]; then
> echo "$CASE PASS: CPU was found after turned on."
> else
> diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug06.top.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug06.top.sh
> index a9bf17e..f9efe2a 100755
> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug06.top.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug06.top.sh
> @@ -15,8 +15,8 @@ fi
>
> # Includes:
> LHCS_PATH=${LHCS_PATH:-".."}
> -source $LHCS_PATH/include/testsuite.fns
> -source $LHCS_PATH/include/hotplug.fns
> +. $LHCS_PATH/include/testsuite.fns
> +. $LHCS_PATH/include/hotplug.fns
>
> echo "Name: $CASE"
> echo "Date: `date`"
> @@ -76,7 +76,7 @@ until [ $loop = 0 ]; do
> exit_clean -1
> fi
>
> - let "loop = loop - 1"
> + : $(( loop -= 1 ))
>
> done
>
> diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug07.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug07.sh
> index d57c561..8f5ca44 100755
> --- a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug07.sh
> +++ b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug07.sh
> @@ -11,8 +11,8 @@ loop_one=${HOTPLUG07_LOOPS:-1}
>
> # Includes:
> LHCS_PATH=${LHCS_PATH:-".."}
> -source $LHCS_PATH/include/testsuite.fns
> -source $LHCS_PATH/include/hotplug.fns
> +. $LHCS_PATH/include/testsuite.fns
> +. $LHCS_PATH/include/hotplug.fns
>
> echo "Name: HotPlug Test - Test Case 7"
> echo "Date: `date`"
> @@ -89,7 +89,7 @@ do
> RC=$?
> echo "Onlining cpu${CPU_TO_TEST}: Return Code = ${RC}"
>
> - let "loop_one = loop_one - 1"
> + : $(( loop_one -= 1 ))
>
> done
>
> diff --git a/testcases/network/can/filter-tests/run_ltp-can_tests.sh b/testcases/network/can/filter-tests/run_ltp-can_tests.sh
> index aefcbe1..6d7aafc 100644
> --- a/testcases/network/can/filter-tests/run_ltp-can_tests.sh
> +++ b/testcases/network/can/filter-tests/run_ltp-can_tests.sh
> @@ -19,7 +19,7 @@
> ## ##
> ################################################################################
>
> -if [ $UID -ne 0 ]; then
> +if [ $(id -ru) -ne 0 ]; then
> echo You need to be root to execute these tests
> exit 1
> fi
> diff --git a/testcases/network/tcp_cmds/netstat/netstat01 b/testcases/network/tcp_cmds/netstat/netstat01
> index 1cf0d9d..f0b2462 100755
> --- a/testcases/network/tcp_cmds/netstat/netstat01
> +++ b/testcases/network/tcp_cmds/netstat/netstat01
> @@ -77,7 +77,7 @@ do_test() {
> do
> for COMMAND in "netstat -s" "netstat -rn" "netstat -i" "netstat -gn" "netstat -apn"
> do
> - $COMMAND 2>&1 1>/dev/null
> + $COMMAND 1>/dev/null 2>&1
> [ $? -eq 0 ] || end_testcase "$COMMAND failed"
> done
>
------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [LTP] [PATCH] Fix some bashisms
2009-10-26 17:02 ` Subrata Modak
@ 2009-10-26 19:37 ` Garrett Cooper
2009-10-29 18:12 ` JiříPaleček
1 sibling, 0 replies; 28+ messages in thread
From: Garrett Cooper @ 2009-10-26 19:37 UTC (permalink / raw)
To: subrata; +Cc: Jiri Palecek, ltp-list
On Mon, Oct 26, 2009 at 10:02 AM, Subrata Modak
<subrata@linux.vnet.ibm.com> wrote:
> On Wed, 2009-10-21 at 02:19 +0200, Jiri Palecek wrote:
>> Hello,
>>
>> this is another patch fixing bashisms in LTP tests (the fixes are more or less the same as in the previous patches, except for a few exceptions). Note that the patch is not complete, in the sense that there may remain further bashisms in the source even after applying the patch (like use of arrays, which is visible even from this patch).
>>
>> Regards
>> Jiri Palecek
>>
>> Signed-off-by: Jiri Palecek <jpalecek@web.de>
>
> Hmm,. Some of them failed to apply. Can you please resend only the error
> part(s):
Sorry for not catching this sooner. netstat01 (and a lot of other
items under tcp_cmds) were rewritten to 1) remove bashisms, 2) make
the testing procedures more uniform, and 3) (the most important)
remove duplicate code in ipv6 and tcp_cmds.
Thanks,
-Garrett
------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [LTP] [PATCH] Fix some bashisms
2009-10-26 17:02 ` Subrata Modak
2009-10-26 19:37 ` Garrett Cooper
@ 2009-10-29 18:12 ` JiříPaleček
2009-10-30 11:37 ` Subrata Modak
1 sibling, 1 reply; 28+ messages in thread
From: JiříPaleček @ 2009-10-29 18:12 UTC (permalink / raw)
To: ltp-list
Hello,
Subrata Modak <subrata@...> writes:
>
> On Wed, 2009-10-21 at 02:19 +0200, Jiri Palecek wrote:
> > Hello,
> >
> > this is another patch fixing bashisms in LTP tests (the fixes are more or
less the same as in the previous
> patches, except for a few exceptions). Note that the patch is not complete,
in the sense that there may
> remain further bashisms in the source even after applying the patch (like use
of arrays, which is visible
> even from this patch).
> >
> > Regards
> > Jiri Palecek
> >
> > Signed-off-by: Jiri Palecek <jpalecek@...>
>
> Hmm,. Some of them failed to apply. Can you please resend only the error
> part(s):
>
according to my git repository. these are the missing parts:
Signed-off-by: Jiri Palecek <jpalecek@web.de>
---
testcases/kernel/fs/fs-bench/modaltr.sh | 2 +-
testcases/kernel/fs/mongo/test.sh | 8 +++-----
testcases/network/tcp_cmds/netstat/netstat01 | 2 +-
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/testcases/kernel/fs/fs-bench/modaltr.sh b/testcases/kernel/fs/fs-
bench/modaltr.sh
index 85d2c30..36e6f0c 100755
--- a/testcases/kernel/fs/fs-bench/modaltr.sh
+++ b/testcases/kernel/fs/fs-bench/modaltr.sh
@@ -43,7 +43,7 @@ LOG_DIR1=/tmp/log1
HOME_DIR=/home
BLOCK_DIR=/dev/mtdblock
export PATH=$PATH:/sbin
- if [ $UID -ne 0 ];
+ if [ $(id -ru) -ne 0 ];
then
echo "must be root to run this"
exit
diff --git a/testcases/kernel/fs/mongo/test.sh b/testcases/kernel/fs/mongo/
test.sh
index fe75664..eccb079 100755
--- a/testcases/kernel/fs/mongo/test.sh
+++ b/testcases/kernel/fs/mongo/test.sh
@@ -26,7 +26,7 @@ TEST_DIR=testdir
#should be root to execute this script .
- if [ $UID -ne 0 ]; then
+ if [ $(id -ru) -ne 0 ]; then
echo "This script must be run as root"
exit
fi
@@ -52,8 +52,7 @@ modprobe loop
fi
#run the mongo test on reiserfs file system type
-function reiserfs
-
+reiserfs()
{
cat > fs.sh <<EOF
echo "performing mongo on reiserfs"
@@ -71,8 +70,7 @@ EOF
#To run on jfs file system type
-function JFS
-
+JFS()
{
cat >> fs.sh <<EOF
echo "performing mongo on jfs file system"
diff --git a/testcases/network/tcp_cmds/netstat/netstat01 b/testcases/network/
tcp_cmds/netstat/netstat01
index 6a197de..365c142 100755
--- a/testcases/network/tcp_cmds/netstat/netstat01
+++ b/testcases/network/tcp_cmds/netstat/netstat01
@@ -58,7 +58,7 @@ do_test() {
while [ $TST_COUNT -le $NUMLOOPS ]; do
for flag in "-s" "-rn" "-i" "-gn" "-apn"; do
- if ! netstat $flag 2>&1 1>/dev/null; then
+ if ! netstat $flag 1>/dev/null 2>&1; then
end_testcase "$COMMAND failed"
fi
done
--
1.6.4.3
------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 28+ messages in thread* Re: [LTP] [PATCH] Fix some bashisms
2009-10-29 18:12 ` JiříPaleček
@ 2009-10-30 11:37 ` Subrata Modak
2009-10-30 12:53 ` Jiří Paleček
0 siblings, 1 reply; 28+ messages in thread
From: Subrata Modak @ 2009-10-30 11:37 UTC (permalink / raw)
To: JiříPaleček; +Cc: ltp-list
On Thu, 2009-10-29 at 18:12 +0000, JiříPaleček wrote:
> Hello,
>
> Subrata Modak <subrata@...> writes:
>
> >
> > On Wed, 2009-10-21 at 02:19 +0200, Jiri Palecek wrote:
> > > Hello,
> > >
> > > this is another patch fixing bashisms in LTP tests (the fixes are more or
> less the same as in the previous
> > patches, except for a few exceptions). Note that the patch is not complete,
> in the sense that there may
> > remain further bashisms in the source even after applying the patch (like use
> of arrays, which is visible
> > even from this patch).
> > >
> > > Regards
> > > Jiri Palecek
> > >
> > > Signed-off-by: Jiri Palecek <jpalecek@...>
> >
> > Hmm,. Some of them failed to apply. Can you please resend only the error
> > part(s):
> >
>
> according to my git repository. these are the missing parts:
>
> Signed-off-by: Jiri Palecek <jpalecek@web.de>
Then something wrong with my CVS:
patching file testcases/kernel/fs/fs-bench/modaltr.sh
Hunk #1 FAILED at 43.
1 out of 1 hunk FAILED -- saving rejects to file
testcases/kernel/fs/fs-bench/modaltr.sh.rej
patching file testcases/kernel/fs/mongo/test.sh
Hunk #1 FAILED at 26.
Hunk #2 FAILED at 52.
Hunk #3 FAILED at 70.
3 out of 3 hunks FAILED -- saving rejects to file
testcases/kernel/fs/mongo/test.sh.rej
patching file testcases/network/tcp_cmds/netstat/netstat01
Can you please verify ?
Regards--
Subrata
> ---
> testcases/kernel/fs/fs-bench/modaltr.sh | 2 +-
> testcases/kernel/fs/mongo/test.sh | 8 +++-----
> testcases/network/tcp_cmds/netstat/netstat01 | 2 +-
> 3 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/testcases/kernel/fs/fs-bench/modaltr.sh b/testcases/kernel/fs/fs-
> bench/modaltr.sh
> index 85d2c30..36e6f0c 100755
> --- a/testcases/kernel/fs/fs-bench/modaltr.sh
> +++ b/testcases/kernel/fs/fs-bench/modaltr.sh
> @@ -43,7 +43,7 @@ LOG_DIR1=/tmp/log1
> HOME_DIR=/home
> BLOCK_DIR=/dev/mtdblock
> export PATH=$PATH:/sbin
> - if [ $UID -ne 0 ];
> + if [ $(id -ru) -ne 0 ];
> then
> echo "must be root to run this"
> exit
> diff --git a/testcases/kernel/fs/mongo/test.sh b/testcases/kernel/fs/mongo/
> test.sh
> index fe75664..eccb079 100755
> --- a/testcases/kernel/fs/mongo/test.sh
> +++ b/testcases/kernel/fs/mongo/test.sh
> @@ -26,7 +26,7 @@ TEST_DIR=testdir
>
>
> #should be root to execute this script .
> - if [ $UID -ne 0 ]; then
> + if [ $(id -ru) -ne 0 ]; then
> echo "This script must be run as root"
> exit
> fi
> @@ -52,8 +52,7 @@ modprobe loop
> fi
>
> #run the mongo test on reiserfs file system type
> -function reiserfs
> -
> +reiserfs()
> {
> cat > fs.sh <<EOF
> echo "performing mongo on reiserfs"
> @@ -71,8 +70,7 @@ EOF
>
>
> #To run on jfs file system type
> -function JFS
> -
> +JFS()
> {
> cat >> fs.sh <<EOF
> echo "performing mongo on jfs file system"
> diff --git a/testcases/network/tcp_cmds/netstat/netstat01 b/testcases/network/
> tcp_cmds/netstat/netstat01
> index 6a197de..365c142 100755
> --- a/testcases/network/tcp_cmds/netstat/netstat01
> +++ b/testcases/network/tcp_cmds/netstat/netstat01
> @@ -58,7 +58,7 @@ do_test() {
> while [ $TST_COUNT -le $NUMLOOPS ]; do
>
> for flag in "-s" "-rn" "-i" "-gn" "-apn"; do
> - if ! netstat $flag 2>&1 1>/dev/null; then
> + if ! netstat $flag 1>/dev/null 2>&1; then
> end_testcase "$COMMAND failed"
> fi
> done
------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [LTP] [PATCH] Fix some bashisms
2009-10-30 11:37 ` Subrata Modak
@ 2009-10-30 12:53 ` Jiří Paleček
2009-10-30 12:19 ` Subrata Modak
0 siblings, 1 reply; 28+ messages in thread
From: Jiří Paleček @ 2009-10-30 12:53 UTC (permalink / raw)
To: subrata; +Cc: ltp-list@lists.sourceforge.net
[-- Attachment #1: Type: text/plain, Size: 4041 bytes --]
On Fri, 30 Oct 2009 12:37:48 +0100, Subrata Modak
<subrata@linux.vnet.ibm.com> wrote:
> On Thu, 2009-10-29 at 18:12 +0000, JiříPaleček wrote:
>> Hello,
>>
>> Subrata Modak <subrata@...> writes:
>>
>> >
>> > On Wed, 2009-10-21 at 02:19 +0200, Jiri Palecek wrote:
>> > > Hello,
>> > >
>> > > this is another patch fixing bashisms in LTP tests (the fixes are
>> more or
>> less the same as in the previous
>> > patches, except for a few exceptions). Note that the patch is not
>> complete,
>> in the sense that there may
>> > remain further bashisms in the source even after applying the patch
>> (like use
>> of arrays, which is visible
>> > even from this patch).
>> > >
>> > > Regards
>> > > Jiri Palecek
>> > >
>> > > Signed-off-by: Jiri Palecek <jpalecek@...>
>> >
>> > Hmm,. Some of them failed to apply. Can you please resend only the
>> error
>> > part(s):
>> >
>>
>> according to my git repository. these are the missing parts:
>>
>> Signed-off-by: Jiri Palecek <jpalecek@web.de>
>
> Then something wrong with my CVS:
>
> patching file testcases/kernel/fs/fs-bench/modaltr.sh
> Hunk #1 FAILED at 43.
> 1 out of 1 hunk FAILED -- saving rejects to file
> testcases/kernel/fs/fs-bench/modaltr.sh.rej
> patching file testcases/kernel/fs/mongo/test.sh
> Hunk #1 FAILED at 26.
> Hunk #2 FAILED at 52.
> Hunk #3 FAILED at 70.
> 3 out of 3 hunks FAILED -- saving rejects to file
> testcases/kernel/fs/mongo/test.sh.rej
> patching file testcases/network/tcp_cmds/netstat/netstat01
>
> Can you please verify ?
It works for me in CVS, so I guess it was just a linewrap, whitespace or
something issue. See attachment for the original (uncrippled) patch.
Regards
Jiri Palecek
>> ---
>> testcases/kernel/fs/fs-bench/modaltr.sh | 2 +-
>> testcases/kernel/fs/mongo/test.sh | 8 +++-----
>> testcases/network/tcp_cmds/netstat/netstat01 | 2 +-
>> 3 files changed, 5 insertions(+), 7 deletions(-)
>>
>> diff --git a/testcases/kernel/fs/fs-bench/modaltr.sh
>> b/testcases/kernel/fs/fs-
>> bench/modaltr.sh
>> index 85d2c30..36e6f0c 100755
>> --- a/testcases/kernel/fs/fs-bench/modaltr.sh
>> +++ b/testcases/kernel/fs/fs-bench/modaltr.sh
>> @@ -43,7 +43,7 @@ LOG_DIR1=/tmp/log1
>> HOME_DIR=/home
>> BLOCK_DIR=/dev/mtdblock
>> export PATH=$PATH:/sbin
>> - if [ $UID -ne 0 ];
>> + if [ $(id -ru) -ne 0 ];
>> then
>> echo "must be root to run this"
>> exit
>> diff --git a/testcases/kernel/fs/mongo/test.sh
>> b/testcases/kernel/fs/mongo/
>> test.sh
>> index fe75664..eccb079 100755
>> --- a/testcases/kernel/fs/mongo/test.sh
>> +++ b/testcases/kernel/fs/mongo/test.sh
>> @@ -26,7 +26,7 @@ TEST_DIR=testdir
>>
>>
>> #should be root to execute this script .
>> - if [ $UID -ne 0 ]; then
>> + if [ $(id -ru) -ne 0 ]; then
>> echo "This script must be run as root"
>> exit
>> fi
>> @@ -52,8 +52,7 @@ modprobe loop
>> fi
>>
>> #run the mongo test on reiserfs file system type
>> -function reiserfs
>> -
>> +reiserfs()
>> {
>> cat > fs.sh <<EOF
>> echo "performing mongo on reiserfs"
>> @@ -71,8 +70,7 @@ EOF
>>
>>
>> #To run on jfs file system type
>> -function JFS
>> -
>> +JFS()
>> {
>> cat >> fs.sh <<EOF
>> echo "performing mongo on jfs file system"
>> diff --git a/testcases/network/tcp_cmds/netstat/netstat01
>> b/testcases/network/
>> tcp_cmds/netstat/netstat01
>> index 6a197de..365c142 100755
>> --- a/testcases/network/tcp_cmds/netstat/netstat01
>> +++ b/testcases/network/tcp_cmds/netstat/netstat01
>> @@ -58,7 +58,7 @@ do_test() {
>> while [ $TST_COUNT -le $NUMLOOPS ]; do
>>
>> for flag in "-s" "-rn" "-i" "-gn" "-apn"; do
>> - if ! netstat $flag 2>&1 1>/dev/null; then
>> + if ! netstat $flag 1>/dev/null 2>&1; then
>> end_testcase "$COMMAND failed"
>> fi
>> done
>
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
[-- Attachment #2: 0001-Fix-some-bashisms.patch --]
[-- Type: application/octet-stream, Size: 2157 bytes --]
From 8ba003dbc80f0280f1d68bf512329ddbe1a07dd0 Mon Sep 17 00:00:00 2001
From: Jiri Palecek <jpalecek@web.de>
Date: Wed, 21 Oct 2009 02:19:58 +0200
Subject: [PATCH] Fix some bashisms
---
testcases/kernel/fs/fs-bench/modaltr.sh | 2 +-
testcases/kernel/fs/mongo/test.sh | 8 +++-----
testcases/network/tcp_cmds/netstat/netstat01 | 2 +-
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/testcases/kernel/fs/fs-bench/modaltr.sh b/testcases/kernel/fs/fs-bench/modaltr.sh
index 85d2c30..36e6f0c 100755
--- a/testcases/kernel/fs/fs-bench/modaltr.sh
+++ b/testcases/kernel/fs/fs-bench/modaltr.sh
@@ -43,7 +43,7 @@ LOG_DIR1=/tmp/log1
HOME_DIR=/home
BLOCK_DIR=/dev/mtdblock
export PATH=$PATH:/sbin
- if [ $UID -ne 0 ];
+ if [ $(id -ru) -ne 0 ];
then
echo "must be root to run this"
exit
diff --git a/testcases/kernel/fs/mongo/test.sh b/testcases/kernel/fs/mongo/test.sh
index fe75664..eccb079 100755
--- a/testcases/kernel/fs/mongo/test.sh
+++ b/testcases/kernel/fs/mongo/test.sh
@@ -26,7 +26,7 @@ TEST_DIR=testdir
#should be root to execute this script .
- if [ $UID -ne 0 ]; then
+ if [ $(id -ru) -ne 0 ]; then
echo "This script must be run as root"
exit
fi
@@ -52,8 +52,7 @@ modprobe loop
fi
#run the mongo test on reiserfs file system type
-function reiserfs
-
+reiserfs()
{
cat > fs.sh <<EOF
echo "performing mongo on reiserfs"
@@ -71,8 +70,7 @@ EOF
#To run on jfs file system type
-function JFS
-
+JFS()
{
cat >> fs.sh <<EOF
echo "performing mongo on jfs file system"
diff --git a/testcases/network/tcp_cmds/netstat/netstat01 b/testcases/network/tcp_cmds/netstat/netstat01
index 6a197de..365c142 100755
--- a/testcases/network/tcp_cmds/netstat/netstat01
+++ b/testcases/network/tcp_cmds/netstat/netstat01
@@ -58,7 +58,7 @@ do_test() {
while [ $TST_COUNT -le $NUMLOOPS ]; do
for flag in "-s" "-rn" "-i" "-gn" "-apn"; do
- if ! netstat $flag 2>&1 1>/dev/null; then
+ if ! netstat $flag 1>/dev/null 2>&1; then
end_testcase "$COMMAND failed"
fi
done
--
1.6.4.3
[-- Attachment #3: Type: text/plain, Size: 399 bytes --]
------------------------------------------------------------------------------
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
[-- Attachment #4: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 28+ messages in thread* Re: [LTP] [PATCH] Fix some bashisms
2009-10-30 12:53 ` Jiří Paleček
@ 2009-10-30 12:19 ` Subrata Modak
2009-10-31 6:39 ` Garrett Cooper
0 siblings, 1 reply; 28+ messages in thread
From: Subrata Modak @ 2009-10-30 12:19 UTC (permalink / raw)
To: Jiří Paleček; +Cc: ltp-list@lists.sourceforge.net
On Fri, 2009-10-30 at 13:53 +0100, Jiří Paleček wrote:
> On Fri, 30 Oct 2009 12:37:48 +0100, Subrata Modak
> <subrata@linux.vnet.ibm.com> wrote:
>
> > On Thu, 2009-10-29 at 18:12 +0000, JiříPaleček wrote:
> >> Hello,
> >>
> >> Subrata Modak <subrata@...> writes:
> >>
> >> >
> >> > On Wed, 2009-10-21 at 02:19 +0200, Jiri Palecek wrote:
> >> > > Hello,
> >> > >
> >> > > this is another patch fixing bashisms in LTP tests (the fixes are
> >> more or
> >> less the same as in the previous
> >> > patches, except for a few exceptions). Note that the patch is not
> >> complete,
> >> in the sense that there may
> >> > remain further bashisms in the source even after applying the patch
> >> (like use
> >> of arrays, which is visible
> >> > even from this patch).
> >> > >
> >> > > Regards
> >> > > Jiri Palecek
> >> > >
> >> > > Signed-off-by: Jiri Palecek <jpalecek@...>
> >> >
> >> > Hmm,. Some of them failed to apply. Can you please resend only the
> >> error
> >> > part(s):
> >> >
> >>
> >> according to my git repository. these are the missing parts:
> >>
> >> Signed-off-by: Jiri Palecek <jpalecek@web.de>
> >
> > Then something wrong with my CVS:
> >
> > patching file testcases/kernel/fs/fs-bench/modaltr.sh
> > Hunk #1 FAILED at 43.
> > 1 out of 1 hunk FAILED -- saving rejects to file
> > testcases/kernel/fs/fs-bench/modaltr.sh.rej
> > patching file testcases/kernel/fs/mongo/test.sh
> > Hunk #1 FAILED at 26.
> > Hunk #2 FAILED at 52.
> > Hunk #3 FAILED at 70.
> > 3 out of 3 hunks FAILED -- saving rejects to file
> > testcases/kernel/fs/mongo/test.sh.rej
> > patching file testcases/network/tcp_cmds/netstat/netstat01
> >
> > Can you please verify ?
>
> It works for me in CVS, so I guess it was just a linewrap, whitespace or
> something issue. See attachment for the original (uncrippled) patch.
Yes, it works fine now :-)
patching file testcases/kernel/fs/fs-bench/modaltr.sh
patching file testcases/kernel/fs/mongo/test.sh
patching file testcases/network/tcp_cmds/netstat/netstat01
Regards--
Subrata
>
> Regards
> Jiri Palecek
>
> >> ---
> >> testcases/kernel/fs/fs-bench/modaltr.sh | 2 +-
> >> testcases/kernel/fs/mongo/test.sh | 8 +++-----
> >> testcases/network/tcp_cmds/netstat/netstat01 | 2 +-
> >> 3 files changed, 5 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/testcases/kernel/fs/fs-bench/modaltr.sh
> >> b/testcases/kernel/fs/fs-
> >> bench/modaltr.sh
> >> index 85d2c30..36e6f0c 100755
> >> --- a/testcases/kernel/fs/fs-bench/modaltr.sh
> >> +++ b/testcases/kernel/fs/fs-bench/modaltr.sh
> >> @@ -43,7 +43,7 @@ LOG_DIR1=/tmp/log1
> >> HOME_DIR=/home
> >> BLOCK_DIR=/dev/mtdblock
> >> export PATH=$PATH:/sbin
> >> - if [ $UID -ne 0 ];
> >> + if [ $(id -ru) -ne 0 ];
> >> then
> >> echo "must be root to run this"
> >> exit
> >> diff --git a/testcases/kernel/fs/mongo/test.sh
> >> b/testcases/kernel/fs/mongo/
> >> test.sh
> >> index fe75664..eccb079 100755
> >> --- a/testcases/kernel/fs/mongo/test.sh
> >> +++ b/testcases/kernel/fs/mongo/test.sh
> >> @@ -26,7 +26,7 @@ TEST_DIR=testdir
> >>
> >>
> >> #should be root to execute this script .
> >> - if [ $UID -ne 0 ]; then
> >> + if [ $(id -ru) -ne 0 ]; then
> >> echo "This script must be run as root"
> >> exit
> >> fi
> >> @@ -52,8 +52,7 @@ modprobe loop
> >> fi
> >>
> >> #run the mongo test on reiserfs file system type
> >> -function reiserfs
> >> -
> >> +reiserfs()
> >> {
> >> cat > fs.sh <<EOF
> >> echo "performing mongo on reiserfs"
> >> @@ -71,8 +70,7 @@ EOF
> >>
> >>
> >> #To run on jfs file system type
> >> -function JFS
> >> -
> >> +JFS()
> >> {
> >> cat >> fs.sh <<EOF
> >> echo "performing mongo on jfs file system"
> >> diff --git a/testcases/network/tcp_cmds/netstat/netstat01
> >> b/testcases/network/
> >> tcp_cmds/netstat/netstat01
> >> index 6a197de..365c142 100755
> >> --- a/testcases/network/tcp_cmds/netstat/netstat01
> >> +++ b/testcases/network/tcp_cmds/netstat/netstat01
> >> @@ -58,7 +58,7 @@ do_test() {
> >> while [ $TST_COUNT -le $NUMLOOPS ]; do
> >>
> >> for flag in "-s" "-rn" "-i" "-gn" "-apn"; do
> >> - if ! netstat $flag 2>&1 1>/dev/null; then
> >> + if ! netstat $flag 1>/dev/null 2>&1; then
> >> end_testcase "$COMMAND failed"
> >> fi
> >> done
> >
>
>
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [LTP] [PATCH] Fix some bashisms
2009-10-30 12:19 ` Subrata Modak
@ 2009-10-31 6:39 ` Garrett Cooper
2009-10-31 11:42 ` Jiří Paleček
0 siblings, 1 reply; 28+ messages in thread
From: Garrett Cooper @ 2009-10-31 6:39 UTC (permalink / raw)
To: subrata; +Cc: Jiří Paleček, ltp-list@lists.sourceforge.net
On Fri, Oct 30, 2009 at 5:19 AM, Subrata Modak
<subrata@linux.vnet.ibm.com> wrote:
> On Fri, 2009-10-30 at 13:53 +0100, Jiří Paleček wrote:
>> On Fri, 30 Oct 2009 12:37:48 +0100, Subrata Modak
>> <subrata@linux.vnet.ibm.com> wrote:
>>
>> > On Thu, 2009-10-29 at 18:12 +0000, JiříPaleček wrote:
>> >> Hello,
>> >>
>> >> Subrata Modak <subrata@...> writes:
>> >>
>> >> >
>> >> > On Wed, 2009-10-21 at 02:19 +0200, Jiri Palecek wrote:
>> >> > > Hello,
>> >> > >
>> >> > > this is another patch fixing bashisms in LTP tests (the fixes are
>> >> more or
>> >> less the same as in the previous
>> >> > patches, except for a few exceptions). Note that the patch is not
>> >> complete,
>> >> in the sense that there may
>> >> > remain further bashisms in the source even after applying the patch
>> >> (like use
>> >> of arrays, which is visible
>> >> > even from this patch).
>> >> > >
>> >> > > Regards
>> >> > > Jiri Palecek
>> >> > >
>> >> > > Signed-off-by: Jiri Palecek <jpalecek@...>
>> >> >
>> >> > Hmm,. Some of them failed to apply. Can you please resend only the
>> >> error
>> >> > part(s):
>> >> >
>> >>
>> >> according to my git repository. these are the missing parts:
>> >>
>> >> Signed-off-by: Jiri Palecek <jpalecek@web.de>
>> >
>> > Then something wrong with my CVS:
>> >
>> > patching file testcases/kernel/fs/fs-bench/modaltr.sh
>> > Hunk #1 FAILED at 43.
>> > 1 out of 1 hunk FAILED -- saving rejects to file
>> > testcases/kernel/fs/fs-bench/modaltr.sh.rej
>> > patching file testcases/kernel/fs/mongo/test.sh
>> > Hunk #1 FAILED at 26.
>> > Hunk #2 FAILED at 52.
>> > Hunk #3 FAILED at 70.
>> > 3 out of 3 hunks FAILED -- saving rejects to file
>> > testcases/kernel/fs/mongo/test.sh.rej
>> > patching file testcases/network/tcp_cmds/netstat/netstat01
>> >
>> > Can you please verify ?
>>
>> It works for me in CVS, so I guess it was just a linewrap, whitespace or
>> something issue. See attachment for the original (uncrippled) patch.
>
> Yes, it works fine now :-)
> patching file testcases/kernel/fs/fs-bench/modaltr.sh
> patching file testcases/kernel/fs/mongo/test.sh
> patching file testcases/network/tcp_cmds/netstat/netstat01
Sorry for replying late again, but just for future reference, there's
a function called is_root in $(abs_top_srcdir)/testcases/lib/cmdlib.sh
[in the install tree -- it gets put in
$(abs_top_builddir)/testcases/bin] that can be leveraged s.t. you
don't have to do $(id -ru) -eq 0 everywhere. There are some other
handy constructs and functions too that can be used for expediting
setup, execution, and teardown. The only thing that might be a
detractor for some legacy scripts is that I explicitly did set -u to
avoid QA issues with unset variables, so all variables must be defined
before including the cmd library.
Using that script though would be helpful as it cuts down on a lot of
duplicate code and aims to be completely POSIX compliant. Some other
pluses:
1. incr_tst_count - increments $TST_COUNT appropriately.
2. TCID is automatically set if not already provided.
3. exists is a function which ensures that commands exist on a given
system before executing a test.
4. Common SHELL_DEBUG logic.
Just trying to make life a little easier for test writers and
maintainers if possible :]...
Cheers,
-Garrett
------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [LTP] [PATCH] Fix some bashisms
2009-10-31 6:39 ` Garrett Cooper
@ 2009-10-31 11:42 ` Jiří Paleček
2009-11-01 0:15 ` Garrett Cooper
0 siblings, 1 reply; 28+ messages in thread
From: Jiří Paleček @ 2009-10-31 11:42 UTC (permalink / raw)
To: Garrett Cooper, subrata; +Cc: ltp-list@lists.sourceforge.net
On Sat, 31 Oct 2009 07:39:54 +0100, Garrett Cooper <yanegomi@gmail.com>
wrote:
> On Fri, Oct 30, 2009 at 5:19 AM, Subrata Modak
> <subrata@linux.vnet.ibm.com> wrote:
>> On Fri, 2009-10-30 at 13:53 +0100, Jiří Paleček wrote:
>>> On Fri, 30 Oct 2009 12:37:48 +0100, Subrata Modak
>>> <subrata@linux.vnet.ibm.com> wrote:
>>>
>>> > On Thu, 2009-10-29 at 18:12 +0000, JiříPaleček wrote:
>>> >> Hello,
>>> >>
>>> >> Subrata Modak <subrata@...> writes:
>>> >>
>>> >> >
>>> >> > On Wed, 2009-10-21 at 02:19 +0200, Jiri Palecek wrote:
>>> >> > > Hello,
>>> >> > >
>>> >> > > this is another patch fixing bashisms in LTP tests (the fixes
>>> are
>>> >> more or
>>> >> less the same as in the previous
>>> >> > patches, except for a few exceptions). Note that the patch is not
>>> >> complete,
>>> >> in the sense that there may
>>> >> > remain further bashisms in the source even after applying the
>>> patch
>>> >> (like use
>>> >> of arrays, which is visible
>>> >> > even from this patch).
>>> >> > >
>>> >> > > Regards
>>> >> > > Jiri Palecek
>>> >> > >
>>> >> > > Signed-off-by: Jiri Palecek <jpalecek@...>
>>> >> >
>>> >> > Hmm,. Some of them failed to apply. Can you please resend only the
>>> >> error
>>> >> > part(s):
>>> >> >
>>> >>
>>> >> according to my git repository. these are the missing parts:
>>> >>
>>> >> Signed-off-by: Jiri Palecek <jpalecek@web.de>
>>> >
>>> > Then something wrong with my CVS:
>>> >
>>> > patching file testcases/kernel/fs/fs-bench/modaltr.sh
>>> > Hunk #1 FAILED at 43.
>>> > 1 out of 1 hunk FAILED -- saving rejects to file
>>> > testcases/kernel/fs/fs-bench/modaltr.sh.rej
>>> > patching file testcases/kernel/fs/mongo/test.sh
>>> > Hunk #1 FAILED at 26.
>>> > Hunk #2 FAILED at 52.
>>> > Hunk #3 FAILED at 70.
>>> > 3 out of 3 hunks FAILED -- saving rejects to file
>>> > testcases/kernel/fs/mongo/test.sh.rej
>>> > patching file testcases/network/tcp_cmds/netstat/netstat01
>>> >
>>> > Can you please verify ?
>>>
>>> It works for me in CVS, so I guess it was just a linewrap, whitespace
>>> or
>>> something issue. See attachment for the original (uncrippled) patch.
>>
>> Yes, it works fine now :-)
>> patching file testcases/kernel/fs/fs-bench/modaltr.sh
>> patching file testcases/kernel/fs/mongo/test.sh
>> patching file testcases/network/tcp_cmds/netstat/netstat01
>
> Sorry for replying late again, but just for future reference, there's
> a function called is_root in $(abs_top_srcdir)/testcases/lib/cmdlib.sh
> [in the install tree -- it gets put in
> $(abs_top_builddir)/testcases/bin] that can be leveraged s.t. you
> don't have to do $(id -ru) -eq 0 everywhere. There are some other
> handy constructs and functions too that can be used for expediting
> setup, execution, and teardown. The only thing that might be a
> detractor for some legacy scripts is that I explicitly did set -u to
> avoid QA issues with unset variables, so all variables must be defined
> before including the cmd library.
>
> Using that script though would be helpful as it cuts down on a lot of
> duplicate code and aims to be completely POSIX compliant. Some other
> pluses:
>
> 1. incr_tst_count - increments $TST_COUNT appropriately.
> 2. TCID is automatically set if not already provided.
> 3. exists is a function which ensures that commands exist on a given
> system before executing a test.
> 4. Common SHELL_DEBUG logic.
>
> Just trying to make life a little easier for test writers and
> maintainers if possible :]...
Thanks for noting it. I think, however, that it would be much morer
valuable to create exact duplicate of the C test API (or a subset of it)
for shell scripts, as this would permit to remove much of the hacky stuff
about maintaining TST_COUNT and return value from the shell scripts.
Looking at the file you mentioned, I have just a few remarks:
tst_cleanup()
{
# Disable the trap EXIT handler.
trap '' EXIT
# To ensure set -u passes...
TCtmp=${TCtmp:=}
Why? Shouldn't it catch invalid use (eg. without doing tst_setup first)?
# Nuke the testcase temporary directory if it exists.
[ -d "$TCtmp" ] && rm -rf "$TCtmp" (1)
}
tst_setup() {
TST_COUNT=1
TST_TOTAL=${TST_TOTAL:=1} (2)
export TCID TST_COUNT TST_TOTAL
for varname in TST_TOTAL; do
if eval "test -z \"\$${varname}\""; then
end_testcase "You must set ${varname} before calling setup()."
fi
done
What is the sense of doing "test -z "$TST_TOTAL"" in such an elaborate
way, especially when you reset TST_TOTAL in (2) so test -z $TST_TOTAL can
never be true here?
...
TCtmp=${TCtmp:=$TEMPDIR/$TC$$}
# User wants a temporary sandbox to play with.
if [ -n "$TCtmp" -a "$TCtmp" != "$TEMPDIR/$$" ] ; then
test -d "$TCtmp" || mkdir -p "$TCtmp"
What is so special about "$TEMPDIR/$$" that you refuse to create a
directory with this name, but still delete it in (1)?
...
}
incr_tst_count()
{
: $(( TST_COUNT + 1 ))
}
Was this really meant this way (ie. as a code with no effect), or should
it be "+="?
Regards
Jiri Palecek
------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [LTP] [PATCH] Fix some bashisms
2009-10-31 11:42 ` Jiří Paleček
@ 2009-11-01 0:15 ` Garrett Cooper
0 siblings, 0 replies; 28+ messages in thread
From: Garrett Cooper @ 2009-11-01 0:15 UTC (permalink / raw)
To: Jiří Paleček; +Cc: ltp-list@lists.sourceforge.net
Hi Jiri!
2009/10/31 Jiří Paleček <jpalecek@web.de>:
> On Sat, 31 Oct 2009 07:39:54 +0100, Garrett Cooper <yanegomi@gmail.com>
> wrote:
>
>> On Fri, Oct 30, 2009 at 5:19 AM, Subrata Modak
>> <subrata@linux.vnet.ibm.com> wrote:
>>>
>>> On Fri, 2009-10-30 at 13:53 +0100, Jiří Paleček wrote:
>>>>
>>>> On Fri, 30 Oct 2009 12:37:48 +0100, Subrata Modak
>>>> <subrata@linux.vnet.ibm.com> wrote:
>>>>
>>>> > On Thu, 2009-10-29 at 18:12 +0000, JiříPaleček wrote:
>>>> >> Hello,
>>>> >>
>>>> >> Subrata Modak <subrata@...> writes:
>>>> >>
>>>> >> >
>>>> >> > On Wed, 2009-10-21 at 02:19 +0200, Jiri Palecek wrote:
>>>> >> > > Hello,
>>>> >> > >
>>>> >> > > this is another patch fixing bashisms in LTP tests (the fixes are
>>>> >> more or
>>>> >> less the same as in the previous
>>>> >> > patches, except for a few exceptions). Note that the patch is not
>>>> >> complete,
>>>> >> in the sense that there may
>>>> >> > remain further bashisms in the source even after applying the patch
>>>> >> (like use
>>>> >> of arrays, which is visible
>>>> >> > even from this patch).
>>>> >> > >
>>>> >> > > Regards
>>>> >> > > Jiri Palecek
>>>> >> > >
>>>> >> > > Signed-off-by: Jiri Palecek <jpalecek@...>
>>>> >> >
>>>> >> > Hmm,. Some of them failed to apply. Can you please resend only the
>>>> >> error
>>>> >> > part(s):
>>>> >> >
>>>> >>
>>>> >> according to my git repository. these are the missing parts:
>>>> >>
>>>> >> Signed-off-by: Jiri Palecek <jpalecek@web.de>
>>>> >
>>>> > Then something wrong with my CVS:
>>>> >
>>>> > patching file testcases/kernel/fs/fs-bench/modaltr.sh
>>>> > Hunk #1 FAILED at 43.
>>>> > 1 out of 1 hunk FAILED -- saving rejects to file
>>>> > testcases/kernel/fs/fs-bench/modaltr.sh.rej
>>>> > patching file testcases/kernel/fs/mongo/test.sh
>>>> > Hunk #1 FAILED at 26.
>>>> > Hunk #2 FAILED at 52.
>>>> > Hunk #3 FAILED at 70.
>>>> > 3 out of 3 hunks FAILED -- saving rejects to file
>>>> > testcases/kernel/fs/mongo/test.sh.rej
>>>> > patching file testcases/network/tcp_cmds/netstat/netstat01
>>>> >
>>>> > Can you please verify ?
>>>>
>>>> It works for me in CVS, so I guess it was just a linewrap, whitespace or
>>>> something issue. See attachment for the original (uncrippled) patch.
>>>
>>> Yes, it works fine now :-)
>>> patching file testcases/kernel/fs/fs-bench/modaltr.sh
>>> patching file testcases/kernel/fs/mongo/test.sh
>>> patching file testcases/network/tcp_cmds/netstat/netstat01
>>
>> Sorry for replying late again, but just for future reference, there's
>> a function called is_root in $(abs_top_srcdir)/testcases/lib/cmdlib.sh
>> [in the install tree -- it gets put in
>> $(abs_top_builddir)/testcases/bin] that can be leveraged s.t. you
>> don't have to do $(id -ru) -eq 0 everywhere. There are some other
>> handy constructs and functions too that can be used for expediting
>> setup, execution, and teardown. The only thing that might be a
>> detractor for some legacy scripts is that I explicitly did set -u to
>> avoid QA issues with unset variables, so all variables must be defined
>> before including the cmd library.
>>
>> Using that script though would be helpful as it cuts down on a lot of
>> duplicate code and aims to be completely POSIX compliant. Some other
>> pluses:
>>
>> 1. incr_tst_count - increments $TST_COUNT appropriately.
>> 2. TCID is automatically set if not already provided.
>> 3. exists is a function which ensures that commands exist on a given
>> system before executing a test.
>> 4. Common SHELL_DEBUG logic.
>>
>> Just trying to make life a little easier for test writers and
>> maintainers if possible :]...
>
> Thanks for noting it. I think, however, that it would be much more valuable
> to create exact duplicate of the C test API (or a subset of it) for shell
> scripts, as this would permit to remove much of the hacky stuff about
> maintaining TST_COUNT and return value from the shell scripts.
Ok. I'll definitely take that into consideration, but it's up to the
test writer to determine how many `subtestcases' are being executed in
a master testcase.
> Looking at the file you mentioned, I have just a few remarks:
>
> tst_cleanup()
> {
> # Disable the trap EXIT handler.
> trap '' EXIT
> # To ensure set -u passes...
> TCtmp=${TCtmp:=}
>
> Why? Shouldn't it catch invalid use (eg. without doing tst_setup first)?
Yeah, that's useless if TCtmp is exported in tst_setup and tst_setup
is executed to completion (or at least this variable is exported
there) first. I may need to adjust the trap(1) to get this to function
in a better way.
> # Nuke the testcase temporary directory if it exists.
> [ -d "$TCtmp" ] && rm -rf "$TCtmp" (1)
> }
>
> tst_setup() {
>
> TST_COUNT=1
> TST_TOTAL=${TST_TOTAL:=1} (2)
> export TCID TST_COUNT TST_TOTAL
>
> for varname in TST_TOTAL; do
> if eval "test -z \"\$${varname}\""; then
> end_testcase "You must set ${varname} before calling setup()."
> fi
> done
>
> What is the sense of doing "test -z "$TST_TOTAL"" in such an elaborate way,
> especially when you reset TST_TOTAL in (2) so test -z $TST_TOTAL can never
> be true here?
I was trying to avoid duplicate logic, but if it makes sense to do:
if test "x$foo" = x ; then
fi
if test "x$foo" = x ; then
fi
and do some basic arithmetic on the values to ensure they're in range,
then I'll gladly rewrite it :]. The point was to avoid the nasty `you
need to defined variable X.Y.Z' message from tst_res*(3), etc, because
this is quick and resolves coding issues with the underlying
testcases.
> ...
>
> TCtmp=${TCtmp:=$TEMPDIR/$TC$$}
> # User wants a temporary sandbox to play with.
> if [ -n "$TCtmp" -a "$TCtmp" != "$TEMPDIR/$$" ] ; then
> test -d "$TCtmp" || mkdir -p "$TCtmp"
>
> What is so special about "$TEMPDIR/$$" that you refuse to create a directory
> with this name, but still delete it in (1)?
Good point; this is not very well thought-out logic that I implemented
on impulse a while ago (I think that the original logic test was
`"$TCtmp" != "$TEMPDIR"').
> ...
> }
>
> incr_tst_count()
> {
> : $(( TST_COUNT + 1 ))
> }
>
> Was this really meant this way (ie. as a code with no effect), or should it
> be "+="?
That's a really stupid mistake that I made. Fixed now (thanks!).
Thanks for the review!
-Garrett
------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread
[parent not found: <4adf2acd.8b13f30a.0849.7847SMTPIN_ADDED@mx.google.com>]
* Re: [LTP] [PATCH] Fix some bashisms
[not found] <4adf2acd.8b13f30a.0849.7847SMTPIN_ADDED@mx.google.com>
@ 2009-10-21 19:38 ` Mike Frysinger
0 siblings, 0 replies; 28+ messages in thread
From: Mike Frysinger @ 2009-10-21 19:38 UTC (permalink / raw)
To: ltp-list; +Cc: Jiri Palecek
[-- Attachment #1.1: Type: Text/Plain, Size: 447 bytes --]
On Tuesday 20 October 2009 20:19:58 Jiri Palecek wrote:
> this is another patch fixing bashisms in LTP tests (the fixes are more or
> less the same as in the previous patches, except for a few exceptions).
> Note that the patch is not complete, in the sense that there may remain
> further bashisms in the source even after applying the patch (like use of
> arrays, which is visible even from this patch).
thanks, these look good to me
-mike
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 399 bytes --]
------------------------------------------------------------------------------
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
[-- Attachment #3: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread
* [LTP] [PATCH] Fix some bashisms
@ 2009-10-21 0:19 Jiri Palecek
0 siblings, 0 replies; 28+ messages in thread
From: Jiri Palecek @ 2009-10-21 0:19 UTC (permalink / raw)
Cc: ltp-list
Hello,
this is another patch fixing bashisms in LTP tests (the fixes are more or less the same as in the previous patches, except for a few exceptions). Note that the patch is not complete, in the sense that there may remain further bashisms in the source even after applying the patch (like use of arrays, which is visible even from this patch).
Regards
Jiri Palecek
Signed-off-by: Jiri Palecek <jpalecek@web.de>
---
.../controllers/cgroup_fj/cgroup_fj_utility.sh | 2 +-
.../controllers/cgroup_fj/run_cgroup_test_fj.sh | 8 ++--
.../controllers/cpuctl_fj/run_cpuctl_test_fj.sh | 51 ++++++++++----------
.../memcg/functional/memcg_function_test.sh | 6 +-
.../controllers/memcg/stress/memcg_stress_test.sh | 18 ++++----
testcases/kernel/fs/acls/acl_test01 | 12 ++--
testcases/kernel/fs/fs-bench/modaltr.sh | 2 +-
testcases/kernel/fs/fs_di/fs_di | 4 +-
testcases/kernel/fs/mongo/test.sh | 8 +--
.../hotplug/cpu_hotplug/functional/hotplug02.sh | 6 +-
.../hotplug/cpu_hotplug/functional/hotplug03.sh | 16 +++---
.../hotplug/cpu_hotplug/functional/hotplug04.sh | 10 ++--
.../cpu_hotplug/functional/hotplug06.sar.sh | 6 +-
.../cpu_hotplug/functional/hotplug06.top.sh | 6 +-
.../hotplug/cpu_hotplug/functional/hotplug07.sh | 6 +-
.../network/can/filter-tests/run_ltp-can_tests.sh | 2 +-
testcases/network/tcp_cmds/netstat/netstat01 | 2 +-
17 files changed, 82 insertions(+), 83 deletions(-)
diff --git a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_utility.sh b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_utility.sh
index 4ba15d6..ed161fa 100755
--- a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_utility.sh
+++ b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_utility.sh
@@ -547,7 +547,7 @@ reclaim_foundling()
if [ -e /proc/$cur_pid/ ];then
echo "ERROR: pid $cur_pid reclaimed"
do_echo 0 1 "$cur_pid" "/dev/cgroup/tasks"
- let "foundlings = $foundlings + 1"
+ : $((foundlings += 1))
fi
done
diff --git a/testcases/kernel/controllers/cgroup_fj/run_cgroup_test_fj.sh b/testcases/kernel/controllers/cgroup_fj/run_cgroup_test_fj.sh
index 70e4078..eb2d1db 100755
--- a/testcases/kernel/controllers/cgroup_fj/run_cgroup_test_fj.sh
+++ b/testcases/kernel/controllers/cgroup_fj/run_cgroup_test_fj.sh
@@ -33,7 +33,7 @@ export TMPFILE=$TESTROOT/tmp_tasks
export CASENO1=0
export CASENO2=0
-if [ "$UID" -ne 0 ]; then
+if [ "$(id -ru)" -ne 0 ]; then
echo "***error***:you must use root to test"
exit -1
fi
@@ -107,17 +107,17 @@ do
if [ $? -ne 0 ]; then
case $CASETYPE in
"function" )
- let "CASENO1 = $CASENO1 + 1"
+ : $(( CASENO1 += 1 ))
export CASENO1=$CASENO1
$TESTROOT/cgroup_fj_function.sh $CASECMD
;;
"function2" )
- let "CASENO1 = $CASENO1 + 1"
+ : $(( CASENO1 += 1 ))
export CASENO1=$CASENO1
$TESTROOT/cgroup_fj_function2.sh $CASECMD
;;
"stress" )
- let "CASENO2 = $CASENO2 + 1"
+ : $(( CASENO2 += 1 ))
export CASENO2=$CASENO2
$TESTROOT/cgroup_fj_stress.sh $CASECMD
;;
diff --git a/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh b/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh
index 6ab0f65..f02f59a 100755
--- a/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh
+++ b/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh
@@ -58,8 +58,8 @@ setup()
# Write the cleanup function
cleanup()
{
- mount | grep "$CPUCTL" &> /dev/null || {
- rm -rf "$CPUCTL" &> /dev/null
+ mount | grep "$CPUCTL" > /dev/null 2>&1 || {
+ rm -rf "$CPUCTL" > /dev/null 2>&1
return 0
}
@@ -73,22 +73,19 @@ cleanup()
done
umount $CPUCTL || return 1
- rmdir $CPUCTL &> /dev/null
+ rmdir $CPUCTL > /dev/null 2>&1
}
creat_process()
{
cat /dev/zero > /dev/null 2>/dev/null &
- taskset -p 1 $! &>/dev/null
+ taskset -p 1 $! >/dev/null 2>&1
echo $!
}
get_cpu_usage()
{
- top=($(top -b -n 1 -p $1 | tail -2 | head -1))
- top=${top[8]}
- top=`echo $top | awk -F "." '{print $1}'`
- echo "$top"
+ top -b -n 1 -p $1 | tail -2 | head -1 | awk 'print $9' | awk -F "." '{print $1}'
}
kill_all_pid()
@@ -424,7 +421,7 @@ case12 ()
wait $pid
}
-max_shares=$((2**18))
+max_shares=$((1 << 18))
# echo MAX_SHARES into shares
case13 ()
@@ -589,7 +586,7 @@ case19()
echo "pid $pid cpu_usage $cpu_usage"
kill -9 $pid $pid_other
- expr 96 \< "$cpu_usage" \& "$cpu_usage" \< 103 &> /dev/null || return 1
+ expr 96 \< "$cpu_usage" \& "$cpu_usage" \< 103 > /dev/null 2>&1 || return 1
return 0
}
@@ -605,7 +602,7 @@ case20()
echo "pid $pid cpu_usage $cpu_usage"
kill -9 $pid $pid_other
- expr 96 \< "$cpu_usage" \& "$cpu_usage" \< 103 &> /dev/null || return 1
+ expr 96 \< "$cpu_usage" \& "$cpu_usage" \< 103 > /dev/null 2>&1 || return 1
return 0
}
@@ -615,7 +612,7 @@ case21()
pid=$(creat_process)
echo $pid > "$CPUCTL/1/tasks"
- while ((1))
+ while true
do
creat_process > "$CPUCTL/1/2/tasks"
sleep 1
@@ -625,18 +622,20 @@ case21()
sleep 10
ret=0
- for ((top_times=0; top_times<10 && ret==0; top_times++))
+ top_times=0
+ while [ "$top_times" -lt 10 -a "$ret" = 0 ]
do
cpu_usage=$(get_cpu_usage $pid)
echo "pid $pid cpu_usage $cpu_usage"
- expr 44 \< "$cpu_usage" \& "$cpu_usage" \< 56 &> /dev/null
+ expr 44 \< "$cpu_usage" \& "$cpu_usage" \< 56 > /dev/null 2>&1
ret=$?
+ : $(( top_times+=1 ))
done
- kill -9 $pid $loop_pid &> /dev/null
- wait $pid $loop_pid &>/dev/null
+ kill -9 $pid $loop_pid > /dev/null 2>&1
+ wait $pid $loop_pid >/dev/null 2>&1
sleep 2
- kill_all_pid < "$CPUCTL/1/2/tasks" &>/dev/null
+ kill_all_pid < "$CPUCTL/1/2/tasks" >/dev/null 2>&1
sleep 2
return $ret
}
@@ -645,7 +644,7 @@ case22()
{
mkdir "$CPUCTL/1" "$CPUCTL/1/2"
pid=$(creat_process)
- while ((1))
+ while true
do
echo $pid > "$CPUCTL/1/tasks"
echo $pid > "$CPUCTL/1/2/tasks"
@@ -656,26 +655,28 @@ case22()
sleep 10
ret=0
- for ((top_times=0; top_times<10 && ret==0; top_times++))
+ top_times=0
+ while [ "$top_times" -lt 10 -a "$ret" = 0 ]
do
cpu_usage=$(get_cpu_usage $pid)
echo "pid $pid cpu_usage $cpu_usage"
- expr 94 \< "$cpu_usage" \& "$cpu_usage" \< 106 &> /dev/null
+ expr 94 \< "$cpu_usage" \& "$cpu_usage" \< 106 > /dev/null 2>&1
ret=$?
+ : $(( top_times+=1 ))
done
- kill -9 $pid $loop_pid &> /dev/null
- wait $pid $loop_pid &>/dev/null
+ kill -s KILL $pid $loop_pid > /dev/null 2>&1
+ wait $pid $loop_pid >/dev/null 2>&1
return $ret
}
-rm -rf "$CPUCTL_TMP" &>/dev/null || exit 1
+rm -rf "$CPUCTL_TMP" >/dev/null 2>&1 || exit 1
mkdir -p "$CPUCTL_TMP" || exit 1
# test
do_test ()
{
- for (( i=1; i<=$TST_TOTAL; i++ ))
+ for i in $(seq 1 $TST_TOTAL)
do
setup || {
tst_resm TFAIL "case$i FAIL"
@@ -698,5 +699,5 @@ do_test ()
do_test
-rm -rf "$CPUCTL_TMP" &>/dev/null
+rm -rf "$CPUCTL_TMP" >/dev/null 2>&1
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_function_test.sh b/testcases/kernel/controllers/memcg/functional/memcg_function_test.sh
index 0f11835..003af1c 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_function_test.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_function_test.sh
@@ -536,8 +536,8 @@ do_mount()
}
# Run all the test cases
-for ((i = 1; i <= $TST_TOTAL; i++))
-{
+for i in $(seq 1 $TST_TOTAL)
+do
export TST_COUNT=$(( $TST_COUNT + 1 ))
cur_id=$i
@@ -556,7 +556,7 @@ for ((i = 1; i <= $TST_TOTAL; i++))
rmdir /dev/memcg/$i
cleanup;
-}
+done
echo $shmmax > /proc/sys/kernel/shmmax
diff --git a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
index 86b8cb9..6c9cd75 100755
--- a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
+++ b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
@@ -66,29 +66,29 @@ run_stress()
{
do_mount;
- for ((i = 0; i < $1; i++))
- {
+ for i in $(seq 0 $(($1-1)))
+ do
mkdir /dev/memcg/$i 2> /dev/null
./memcg_process_stress $2 $3 &
pid[$i]=$!
echo ${pid[$i]} > /dev/memcg/$i/tasks
- }
+ done
- for ((i = 0; i < $1; i++))
- {
+ for i in $(seq 0 $(($1-1)))
+ do
/bin/kill -s SIGUSR1 ${pid[$i]} 2> /dev/null
- }
+ done
sleep $4
- for ((i = 0; i < $1; i++))
- {
+ for i in $(seq 0 $(($1-1)))
+ do
/bin/kill -s SIGINT ${pid[$i]} 2> /dev/null
wait ${pid[$i]}
rmdir /dev/memcg/$i 2> /dev/null
- }
+ done
cleanup;
}
diff --git a/testcases/kernel/fs/acls/acl_test01 b/testcases/kernel/fs/acls/acl_test01
index c892b0e..20cd1ac 100755
--- a/testcases/kernel/fs/acls/acl_test01
+++ b/testcases/kernel/fs/acls/acl_test01
@@ -51,7 +51,7 @@ if [ "z$iam" = "z$TEST_USER1" ]
then
echo ""
else
-if [ $UID != 0 ]
+if [ $(id -ru) != 0 ]
then
echo "FAILED: Must have root access to execute this script"
exit 1
@@ -76,7 +76,7 @@ if [ $? != 0 ]
then
echo ""
echo "FAILED: [ losetup ] Must have loop device support by kernel"
- echo -e "\t to execute this script"
+ printf "\t to execute this script\n"
exit 1
fi
@@ -90,8 +90,8 @@ then
then
echo ""
echo "FAILED: [ mount ] Make sure that ACL (Access Control List)"
- echo -e "\t and Extended Attribute are built into the kernel"
- echo -e "\t Can not mount ext3 file system with acl and user_xattr options"
+ printf "\t and Extended Attribute are built into the kernel\n"
+ printf "\t Can not mount ext3 file system with acl and user_xattr options\n"
exit 1
fi
else
@@ -102,8 +102,8 @@ else
then
echo ""
echo "FAILED: [ mount ] Make sure that ACL (Access Control List)"
- echo -e "\t and Extended Attribute are built into the kernel"
- echo -e "\t Can not mount ext2 file system with acl and user_xattr options"
+ printf "\t and Extended Attribute are built into the kernel\n"
+ printf "\t Can not mount ext2 file system with acl and user_xattr options\n"
exit 1
fi
fi
diff --git a/testcases/kernel/fs/fs-bench/modaltr.sh b/testcases/kernel/fs/fs-bench/modaltr.sh
index 85d2c30..36e6f0c 100755
--- a/testcases/kernel/fs/fs-bench/modaltr.sh
+++ b/testcases/kernel/fs/fs-bench/modaltr.sh
@@ -43,7 +43,7 @@ LOG_DIR1=/tmp/log1
HOME_DIR=/home
BLOCK_DIR=/dev/mtdblock
export PATH=$PATH:/sbin
- if [ $UID -ne 0 ];
+ if [ $(id -ru) -ne 0 ];
then
echo "must be root to run this"
exit
diff --git a/testcases/kernel/fs/fs_di/fs_di b/testcases/kernel/fs/fs_di/fs_di
index 54dd8b4..c6447ef 100755
--- a/testcases/kernel/fs/fs_di/fs_di
+++ b/testcases/kernel/fs/fs_di/fs_di
@@ -201,10 +201,10 @@ $trace_logic
end_testcase "Could not create testfile of size ${SIZE}Mb"
fi
RANDOM_DEPTH=$RANDOM
- let "RANDOM_DEPTH %= 500"
+ : $(( RANDOM_DEPTH %= 500 ))
RANDOM_LENGTH=$RANDOM
- let "RANDOM_LENGTH %= 500"
+ : $(( RANDOM_LENGTH %= 500 ))
RANDOM_LENGTH=$(( $RANDOM_LENGTH / 10 ))
NameCount=0
diff --git a/testcases/kernel/fs/mongo/test.sh b/testcases/kernel/fs/mongo/test.sh
index fe75664..eccb079 100755
--- a/testcases/kernel/fs/mongo/test.sh
+++ b/testcases/kernel/fs/mongo/test.sh
@@ -26,7 +26,7 @@ TEST_DIR=testdir
#should be root to execute this script .
- if [ $UID -ne 0 ]; then
+ if [ $(id -ru) -ne 0 ]; then
echo "This script must be run as root"
exit
fi
@@ -52,8 +52,7 @@ modprobe loop
fi
#run the mongo test on reiserfs file system type
-function reiserfs
-
+reiserfs()
{
cat > fs.sh <<EOF
echo "performing mongo on reiserfs"
@@ -71,8 +70,7 @@ EOF
#To run on jfs file system type
-function JFS
-
+JFS()
{
cat >> fs.sh <<EOF
echo "performing mongo on jfs file system"
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug02.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug02.sh
index 08e9301..7f1c5b1 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug02.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug02.sh
@@ -15,8 +15,8 @@ fi
# Includes:
LHCS_PATH=${LHCS_PATH:-".."}
-source $LHCS_PATH/include/testsuite.fns
-source $LHCS_PATH/include/hotplug.fns
+. $LHCS_PATH/include/testsuite.fns
+. $LHCS_PATH/include/hotplug.fns
echo "Name: $CASE"
echo "Date: `date`"
@@ -73,7 +73,7 @@ until [ $loop = 0 ]; do
# Turn the CPU back online just to see what happens.
online_cpu ${CPU_TO_TEST}
- let "loop = loop - 1"
+ : $(( loop -= 1 ))
done
sleep 2
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug03.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug03.sh
index c550890..97d5205 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug03.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug03.sh
@@ -15,8 +15,8 @@ fi
# Includes:
LHCS_PATH=${LHCS_PATH:-".."}
-source $LHCS_PATH/include/testsuite.fns
-source $LHCS_PATH/include/hotplug.fns
+. $LHCS_PATH/include/testsuite.fns
+. $LHCS_PATH/include/hotplug.fns
echo "Name: $CASE"
echo "Date: `date`"
@@ -48,7 +48,7 @@ do_clean()
# Turn off the CPUs that were off before the test start
until [ $cpu = 0 ];do
offline_cpu ${on[${cpu}]}
- let "cpu = cpu - 1"
+ : $(( cpu -= 1 ))
done
}
@@ -60,10 +60,10 @@ until [ $loop = 0 ]; do
for i in $( get_all_cpus ); do
online_cpu $1
if [ $? = 0 ]; then
- let "cpu = cpu + 1"
+ : $(( cpu += 1 ))
on[${cpu}]=$i
fi
- let "number_of_cpus = number_of_cpus + 1"
+ : $(( number_of_cpus += 1 ))
done
offline_cpu ${CPU_TO_TEST}
@@ -76,11 +76,11 @@ until [ $loop = 0 ]; do
# CPUs we have. This is to help ensure we've got enough processes
# that at least one will migrate to the new CPU. Store the PIDs
# so we can kill them later.
- let "number_of_cpus = number_of_cpus * 2"
+ : $(( number_of_cpus *= 2 ))
until [ $number_of_cpus = 0 ]; do
$LHCS_PATH/tools/do_spin_loop > /dev/null 2>&1 &
echo $! >> /var/run/hotplug4_$$.pid
- let "number_of_cpus = number_of_cpus - 1"
+ : $(( number_of_cpus -= 1 ))
done
ps aux | head -n 1
@@ -111,7 +111,7 @@ until [ $loop = 0 ]; do
do_clean
- let "loop = loop -1"
+ : $(( loop -=1 ))
done
exit_clean
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug04.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug04.sh
index b147286..00a634b 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug04.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug04.sh
@@ -9,8 +9,8 @@ loop=${HOTPLUG04_LOOPS:-1}
# Includes:
LHCS_PATH=${LHCS_PATH:-".."}
-source $LHCS_PATH/include/testsuite.fns
-source $LHCS_PATH/include/hotplug.fns
+. $LHCS_PATH/include/testsuite.fns
+. $LHCS_PATH/include/hotplug.fns
echo "Name: $CASE"
echo "Date: `date`"
@@ -26,7 +26,7 @@ until [ $loop = 0 ]; do
online_cpu $i
RC=$?
if [ $RC != 0 ]; then
- let "cpu = cpu + 1"
+ : $(( cpu += 1 ))
on[${cpu}]=$i
echo "${on[${cpu}]}"
fi
@@ -51,7 +51,7 @@ until [ $loop = 0 ]; do
# Online the ones that were on initially
until [ $cpu = 0 ]; do
online_cpu ${on[${cpu}]}
- let "cpu = cpu - 1"
+ : $(( cpu -= 1 ))
done
# Return CPU 0 to its initial state
@@ -61,7 +61,7 @@ until [ $loop = 0 ]; do
offline_cpu 0
fi
- let "loop = loop -1"
+ : $(( loop -=1 ))
done
exit_clean
\ No newline at end of file
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug06.sar.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug06.sar.sh
index d6f4601..aba658a 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug06.sar.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug06.sar.sh
@@ -15,8 +15,8 @@ fi
# Includes:
LHCS_PATH=${LHCS_PATH:-".."}
-source $LHCS_PATH/include/testsuite.fns
-source $LHCS_PATH/include/hotplug.fns
+. $LHCS_PATH/include/testsuite.fns
+. $LHCS_PATH/include/hotplug.fns
echo "Name: $CASE"
echo "Date: `date`"
@@ -81,7 +81,7 @@ until [ $loop = 0 ]; do
# Check that SAR registered the change in CPU online/offline states
NEW_NUMBER_CPU_OFF=`cat /tmp/log_$$ | grep ${time} | grep -i nan | wc -l`
- let "NUMBER_CPU_OFF = NUMBER_CPU_OFF - 1"
+ : $(( NUMBER_CPU_OFF -= 1 ))
if [ $NUMBER_CPU_OFF = $NEW_NUMBER_CPU_OFF ]; then
echo "$CASE PASS: CPU was found after turned on."
else
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug06.top.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug06.top.sh
index a9bf17e..f9efe2a 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug06.top.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug06.top.sh
@@ -15,8 +15,8 @@ fi
# Includes:
LHCS_PATH=${LHCS_PATH:-".."}
-source $LHCS_PATH/include/testsuite.fns
-source $LHCS_PATH/include/hotplug.fns
+. $LHCS_PATH/include/testsuite.fns
+. $LHCS_PATH/include/hotplug.fns
echo "Name: $CASE"
echo "Date: `date`"
@@ -76,7 +76,7 @@ until [ $loop = 0 ]; do
exit_clean -1
fi
- let "loop = loop - 1"
+ : $(( loop -= 1 ))
done
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug07.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug07.sh
index d57c561..8f5ca44 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug07.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/hotplug07.sh
@@ -11,8 +11,8 @@ loop_one=${HOTPLUG07_LOOPS:-1}
# Includes:
LHCS_PATH=${LHCS_PATH:-".."}
-source $LHCS_PATH/include/testsuite.fns
-source $LHCS_PATH/include/hotplug.fns
+. $LHCS_PATH/include/testsuite.fns
+. $LHCS_PATH/include/hotplug.fns
echo "Name: HotPlug Test - Test Case 7"
echo "Date: `date`"
@@ -89,7 +89,7 @@ do
RC=$?
echo "Onlining cpu${CPU_TO_TEST}: Return Code = ${RC}"
- let "loop_one = loop_one - 1"
+ : $(( loop_one -= 1 ))
done
diff --git a/testcases/network/can/filter-tests/run_ltp-can_tests.sh b/testcases/network/can/filter-tests/run_ltp-can_tests.sh
index aefcbe1..6d7aafc 100644
--- a/testcases/network/can/filter-tests/run_ltp-can_tests.sh
+++ b/testcases/network/can/filter-tests/run_ltp-can_tests.sh
@@ -19,7 +19,7 @@
## ##
################################################################################
-if [ $UID -ne 0 ]; then
+if [ $(id -ru) -ne 0 ]; then
echo You need to be root to execute these tests
exit 1
fi
diff --git a/testcases/network/tcp_cmds/netstat/netstat01 b/testcases/network/tcp_cmds/netstat/netstat01
index 1cf0d9d..f0b2462 100755
--- a/testcases/network/tcp_cmds/netstat/netstat01
+++ b/testcases/network/tcp_cmds/netstat/netstat01
@@ -77,7 +77,7 @@ do_test() {
do
for COMMAND in "netstat -s" "netstat -rn" "netstat -i" "netstat -gn" "netstat -apn"
do
- $COMMAND 2>&1 1>/dev/null
+ $COMMAND 1>/dev/null 2>&1
[ $? -eq 0 ] || end_testcase "$COMMAND failed"
done
--
1.6.4.3
------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 28+ messages in thread[parent not found: <4a413e9b.160bca0a.2226.fffff184SMTPIN_ADDED@mx.google.com>]
* Re: [LTP] [PATCH] Fix some bashisms
[not found] <4a413e9b.160bca0a.2226.fffff184SMTPIN_ADDED@mx.google.com>
@ 2009-07-06 17:45 ` Garrett Cooper
2009-07-06 22:02 ` Mike Frysinger
2009-07-06 22:47 ` Jiri Palecek
0 siblings, 2 replies; 28+ messages in thread
From: Garrett Cooper @ 2009-07-06 17:45 UTC (permalink / raw)
To: Jiri Palecek; +Cc: ltp-list
Jiri,
This patch looks ok for the most part, but here are some comments:
1. if [[ -z "$vnet0" -z "$vnet1" ]] => if [ -z "$vnet0" ] || [ -z "$vnet1" ]
It's better read as the following, IMO:
[ -z "$vnet0" -o -z "$vnet1" ]
2. All numeric test(1) comparisons could and should be switched from:
command
if [ $? = 0 ]; then
to:
if command; then
for brevity.
3. About &>
Redirecting Standard Output and Standard Error
Bash allows both the standard output (file descriptor 1) and
the standard error output (file descriptor 2) to be redirected to the
file whose name is the expansion of word with this construct.
There are two formats for redirecting standard output and standard error:
&>word
and
>&word
The output redirection above captures all output (and most of the time
you're capturing stdout, but losing stderr to the operating console,
which can be undesirable). >& is more portable IIRC (it works with
many ash variants, like FreeBSD's sh -- for sure -- and Solaris's sh
-- IIRC), which makes it more ideal than &>.
Thanks,
-Garrett
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [LTP] [PATCH] Fix some bashisms
2009-07-06 17:45 ` Garrett Cooper
@ 2009-07-06 22:02 ` Mike Frysinger
2009-07-06 22:47 ` Jiri Palecek
1 sibling, 0 replies; 28+ messages in thread
From: Mike Frysinger @ 2009-07-06 22:02 UTC (permalink / raw)
To: ltp-list; +Cc: Jiri Palecek
[-- Attachment #1.1: Type: text/plain, Size: 1541 bytes --]
On Monday 06 July 2009 13:45:08 Garrett Cooper wrote:
> 2. All numeric test(1) comparisons could and should be switched from:
>
> command
> if [ $? = 0 ]; then
>
> to:
>
> if command; then
>
> for brevity.
that works the command is sufficiently short. if it's a long command and/or
has line wrappings itself, i find nesting it in the if statement makes the
situation much worse.
> 3. About &>
>
> Redirecting Standard Output and Standard Error
> Bash allows both the standard output (file descriptor 1) and
> the standard error output (file descriptor 2) to be redirected to the
> file whose name is the expansion of word with this construct.
>
> There are two formats for redirecting standard output and standard
> error:
>
> &>word
> and
>
> >&word
>
> The output redirection above captures all output (and most of the time
> you're capturing stdout, but losing stderr to the operating console,
> which can be undesirable). >& is more portable IIRC (it works with
> many ash variants, like FreeBSD's sh -- for sure -- and Solaris's sh
> -- IIRC), which makes it more ideal than &>.
what bash does doesnt matter. the redirection used needs to be in POSIX:
http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07
the "&>" form is not in POSIX, so should never be used. the ">&" format
cannot be used in POSIX without a word argument (you didnt say it could, just
making sure things are kept explicit).
-mike
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 79 bytes --]
------------------------------------------------------------------------------
[-- Attachment #3: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [LTP] [PATCH] Fix some bashisms
2009-07-06 17:45 ` Garrett Cooper
2009-07-06 22:02 ` Mike Frysinger
@ 2009-07-06 22:47 ` Jiri Palecek
2009-07-06 23:33 ` Garrett Cooper
1 sibling, 1 reply; 28+ messages in thread
From: Jiri Palecek @ 2009-07-06 22:47 UTC (permalink / raw)
To: Garrett Cooper; +Cc: ltp-list
On Monday 06 July 2009 19:45:08 Garrett Cooper wrote:
> Jiri,
> This patch looks ok for the most part, but here are some comments:
>
> 1. if [[ -z "$vnet0" -z "$vnet1" ]] => if [ -z "$vnet0" ] || [ -z "$vnet1" ]
>
> It's better read as the following, IMO:
>
> [ -z "$vnet0" -o -z "$vnet1" ]
I think this is another "I like this more than that, because this is cool and that sucks" debate. If other think test's "-o" should be used in this case, I would make the change. After all, this can be done by hand directly on the patch...
> 2. All numeric test(1) comparisons could and should be switched from:
>
> command
> if [ $? = 0 ]; then
>
> to:
>
> if command; then
>
> for brevity.
Why should them be changed? This is only a cosmetic change, which would make the patch unnecessarily larger (when it's already a little too large IMHO). If it could be in the former form till now, I think it can stay there a few months/years.
IMHO this usage is still much better than
command; RC=$?
if [ $RC = 0 ] ...
... RC is not read later ...
or (incorrect)
command || RC=$?
if [ $RC = 0 ] ...
> 3. About &>
>
> Redirecting Standard Output and Standard Error
> Bash allows both the standard output (file descriptor 1) and
> the standard error output (file descriptor 2) to be redirected to the
> file whose name is the expansion of word with this construct.
>
> There are two formats for redirecting standard output and standard error:
>
> &>word
> and
> >&word
>
> The output redirection above captures all output (and most of the time
> you're capturing stdout, but losing stderr to the operating console,
> which can be undesirable). >& is more portable IIRC (it works with
> many ash variants, like FreeBSD's sh -- for sure -- and Solaris's sh
> -- IIRC), which makes it more ideal than &>.
Still, it isn't POSIX, it doesn't work with dash and actually causes pain. See:
cmd &> fn
POSIX: run cmd in background, write empty file fn
BASH: run cmd (foreground), send its (normal & error) output to file fn
cmd >& fn
POSIX: syntax error
BASH: same as above
But I don't see the point you are making here - do you have a system, where the POSIX way
cmd > fn 2>&1
doesn't work? Or did you see something else in the patch?
Regards
Jiri Palecek
BTW: Jiri Palecek <jirka@debian.org> is not my address.
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [LTP] [PATCH] Fix some bashisms
2009-07-06 22:47 ` Jiri Palecek
@ 2009-07-06 23:33 ` Garrett Cooper
2009-07-07 0:16 ` Jiří Paleček
0 siblings, 1 reply; 28+ messages in thread
From: Garrett Cooper @ 2009-07-06 23:33 UTC (permalink / raw)
To: Jiri Palecek; +Cc: ltp-list
On Mon, Jul 6, 2009 at 3:47 PM, Jiri Palecek<jpalecek@web.de> wrote:
> On Monday 06 July 2009 19:45:08 Garrett Cooper wrote:
>> Jiri,
>> This patch looks ok for the most part, but here are some comments:
>>
>> 1. if [[ -z "$vnet0" -z "$vnet1" ]] => if [ -z "$vnet0" ] || [ -z "$vnet1" ]
>>
>> It's better read as the following, IMO:
>>
>> [ -z "$vnet0" -o -z "$vnet1" ]
>
> I think this is another "I like this more than that, because this is cool and that sucks" debate. If other think test's "-o" should be used in this case, I would make the change. After all, this can be done by hand directly on the patch...
Why call [(1) twice?
>> 2. All numeric test(1) comparisons could and should be switched from:
>>
>> command
>> if [ $? = 0 ]; then
>>
>> to:
>>
>> if command; then
>>
>> for brevity.
>
> Why should them be changed? This is only a cosmetic change, which would make the patch unnecessarily larger (when it's already a little too large IMHO). If it could be in the former form till now, I think it can stay there a few months/years.
>
> IMHO this usage is still much better than
>
> command; RC=$?
> if [ $RC = 0 ] ...
> ... RC is not read later ...
>
> or (incorrect)
>
> command || RC=$?
> if [ $RC = 0 ] ...
Yes, I agree with what you said about the above usage, but if you're
not using $? for other than just the [ $? -ne 0 ], then I wouldn't
even bother doing that, because if command; then saves a fork-exec,
and an additional line in the source. As long as it's readable and
doesn't expand multiple lines with a trailing \, you're fine.
>> 3. About &>
>>
>> Redirecting Standard Output and Standard Error
>> Bash allows both the standard output (file descriptor 1) and
>> the standard error output (file descriptor 2) to be redirected to the
>> file whose name is the expansion of word with this construct.
>>
>> There are two formats for redirecting standard output and standard error:
>>
>> &>word
>> and
>> >&word
>>
>> The output redirection above captures all output (and most of the time
>> you're capturing stdout, but losing stderr to the operating console,
>> which can be undesirable). >& is more portable IIRC (it works with
>> many ash variants, like FreeBSD's sh -- for sure -- and Solaris's sh
>> -- IIRC), which makes it more ideal than &>.
>
> Still, it isn't POSIX, it doesn't work with dash and actually causes pain. See:
>
> cmd &> fn
>
> POSIX: run cmd in background, write empty file fn
> BASH: run cmd (foreground), send its (normal & error) output to file fn
>
> cmd >& fn
>
> POSIX: syntax error
> BASH: same as above
>
> But I don't see the point you are making here - do you have a system, where the POSIX way
>
> cmd > fn 2>&1
>
> doesn't work? Or did you see something else in the patch?
This changes the behavior of the patch though. That's the point ;)...
> Regards
> Jiri Palecek
>
> BTW: Jiri Palecek <jirka@debian.org> is not my address.
Ok. Your original REPLY-TO email is wonky in your emails though, so I
was playing it by ear...
Thanks,
-Garrett
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [LTP] [PATCH] Fix some bashisms
2009-07-06 23:33 ` Garrett Cooper
@ 2009-07-07 0:16 ` Jiří Paleček
2009-07-07 0:31 ` Garrett Cooper
0 siblings, 1 reply; 28+ messages in thread
From: Jiří Paleček @ 2009-07-07 0:16 UTC (permalink / raw)
To: Garrett Cooper; +Cc: ltp-list
On Tue, 07 Jul 2009 01:33:29 +0200, Garrett Cooper <yanegomi@gmail.com>
wrote:
> On Mon, Jul 6, 2009 at 3:47 PM, Jiri Palecek<jpalecek@web.de> wrote:
>> On Monday 06 July 2009 19:45:08 Garrett Cooper wrote:
>>> Jiri,
>>> This patch looks ok for the most part, but here are some comments:
>>>
>>> 1. if [[ -z "$vnet0" -z "$vnet1" ]] => if [ -z "$vnet0" ] || [ -z
>>> "$vnet1" ]
>>>
>>> It's better read as the following, IMO:
>>>
>>> [ -z "$vnet0" -o -z "$vnet1" ]
>>
>> I think this is another "I like this more than that, because this is
>> cool and that sucks" debate. If other think test's "-o" should be used
>> in this case, I would make the change. After all, this can be done by
>> hand directly on the patch...
>
> Why call [(1) twice?
Does it (measurably) matter? Do the shell scripts contribute a big part to
the time the tests take?
>>> 2. All numeric test(1) comparisons could and should be switched from:
>>>
>>> command
>>> if [ $? = 0 ]; then
>>>
>>> to:
>>>
>>> if command; then
>>>
>>> for brevity.
>>
>> Why should them be changed? This is only a cosmetic change, which would
>> make the patch unnecessarily larger (when it's already a little too
>> large IMHO). If it could be in the former form till now, I think it can
>> stay there a few months/years.
>>
>> IMHO this usage is still much better than
>>
>> command; RC=$?
>> if [ $RC = 0 ] ...
>> ... RC is not read later ...
>>
>> or (incorrect)
>>
>> command || RC=$?
>> if [ $RC = 0 ] ...
>
> Yes, I agree with what you said about the above usage, but if you're
> not using $? for other than just the [ $? -ne 0 ], then I wouldn't
> even bother doing that, because if command; then saves a fork-exec,
> and an additional line in the source. As long as it's readable and
> doesn't expand multiple lines with a trailing \, you're fine.
Are you talking only about efficiency and bash scripts? :-)
Anyway, if you want to save the fork-exec, you can just use a shell with a
test builtin (ksh, bash, dash ... and I believe many others do).
If you are concerned about readability, I suggest considering another
alternative:
command || {
do_something_on_error
}
command && {
do_something_when_ok
}
Of coures, usable only when there's no "else" branch.
Still, I think the original form is correct and quite straightforward. I
would probably not use the extra test myself, but I don't feel like it
needs changing. Just looking at the patch, I see places where the check is
done really suspiciously:
tst_resm TINFO "Test #1: changing mtu size of eth0:1 device."
- ip link set eth0:1 mtu 300 &>$LTPTMP/tst_ip.err
+ ip link set eth0:1 mtu 300 >$LTPTMP/tst_ip.err 2>&1
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
I think this needs much more attention than "calling [ twice" or "extra
line in the script".
>>> 3. About &>
>>>
>>> Redirecting Standard Output and Standard Error
>>> Bash allows both the standard output (file descriptor 1) and
>>> the standard error output (file descriptor 2) to be redirected to the
>>> file whose name is the expansion of word with this construct.
>>>
>>> There are two formats for redirecting standard output and
>>> standard error:
>>>
>>> &>word
>>> and
>>> >&word
>>>
>>> The output redirection above captures all output (and most of the time
>>> you're capturing stdout, but losing stderr to the operating console,
>>> which can be undesirable). >& is more portable IIRC (it works with
>>> many ash variants, like FreeBSD's sh -- for sure -- and Solaris's sh
>>> -- IIRC), which makes it more ideal than &>.
>>
>> Still, it isn't POSIX, it doesn't work with dash and actually causes
>> pain. See:
>>
>> cmd &> fn
>>
>> POSIX: run cmd in background, write empty file fn
>> BASH: run cmd (foreground), send its (normal & error) output to file fn
>>
>> cmd >& fn
>>
>> POSIX: syntax error
>> BASH: same as above
>>
>> But I don't see the point you are making here - do you have a system,
>> where the POSIX way
>>
>> cmd > fn 2>&1
>>
>> doesn't work? Or did you see something else in the patch?
>
> This changes the behavior of the patch though. That's the point ;)...
How does it change the semantics? It redirects standard output to fn, and
standard error to standard output (which is redirected to fn). Is there
anything else it should do?
Regards
Jiri Palecek
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [LTP] [PATCH] Fix some bashisms
2009-07-07 0:16 ` Jiří Paleček
@ 2009-07-07 0:31 ` Garrett Cooper
2009-07-07 10:29 ` Jiří Paleček
0 siblings, 1 reply; 28+ messages in thread
From: Garrett Cooper @ 2009-07-07 0:31 UTC (permalink / raw)
To: Jiří Paleček; +Cc: ltp-list
2009/7/6 Jiří Paleček <jpalecek@web.de>:
> On Tue, 07 Jul 2009 01:33:29 +0200, Garrett Cooper <yanegomi@gmail.com>
> wrote:
>
>> On Mon, Jul 6, 2009 at 3:47 PM, Jiri Palecek<jpalecek@web.de> wrote:
>>>
>>> On Monday 06 July 2009 19:45:08 Garrett Cooper wrote:
>>>>
>>>> Jiri,
>>>> This patch looks ok for the most part, but here are some comments:
>>>>
>>>> 1. if [[ -z "$vnet0" -z "$vnet1" ]] => if [ -z "$vnet0" ] || [ -z
>>>> "$vnet1" ]
>>>>
>>>> It's better read as the following, IMO:
>>>>
>>>> [ -z "$vnet0" -o -z "$vnet1" ]
>>>
>>> I think this is another "I like this more than that, because this is cool
>>> and that sucks" debate. If other think test's "-o" should be used in this
>>> case, I would make the change. After all, this can be done by hand directly
>>> on the patch...
>>
>> Why call [(1) twice?
>
> Does it (measurably) matter? Do the shell scripts contribute a big part to
> the time the tests take?
>
>>>> 2. All numeric test(1) comparisons could and should be switched from:
>>>>
>>>> command
>>>> if [ $? = 0 ]; then
>>>>
>>>> to:
>>>>
>>>> if command; then
>>>>
>>>> for brevity.
>>>
>>> Why should them be changed? This is only a cosmetic change, which would
>>> make the patch unnecessarily larger (when it's already a little too large
>>> IMHO). If it could be in the former form till now, I think it can stay there
>>> a few months/years.
>>>
>>> IMHO this usage is still much better than
>>>
>>> command; RC=$?
>>> if [ $RC = 0 ] ...
>>> ... RC is not read later ...
>>>
>>> or (incorrect)
>>>
>>> command || RC=$?
>>> if [ $RC = 0 ] ...
>>
>> Yes, I agree with what you said about the above usage, but if you're
>> not using $? for other than just the [ $? -ne 0 ], then I wouldn't
>> even bother doing that, because if command; then saves a fork-exec,
>> and an additional line in the source. As long as it's readable and
>> doesn't expand multiple lines with a trailing \, you're fine.
>
> Are you talking only about efficiency and bash scripts? :-)
Efficiency, and more importantly readability.
> Anyway, if you want to save the fork-exec, you can just use a shell with a
> test builtin (ksh, bash, dash ... and I believe many others do).
>
> If you are concerned about readability, I suggest considering another
> alternative:
>
> command || {
> do_something_on_error
> }
>
> command && {
> do_something_when_ok
> }
>
> Of course, usable only when there's no "else" branch.
That's ugly and hard to read with large logic blocks.
> Still, I think the original form is correct and quite straightforward. I
> would probably not use the extra test myself, but I don't feel like it needs
> changing. Just looking at the patch, I see places where the check is done
> really suspiciously:
>
>
> tst_resm TINFO "Test #1: changing mtu size of eth0:1 device."
>
> - ip link set eth0:1 mtu 300 &>$LTPTMP/tst_ip.err
> + ip link set eth0:1 mtu 300 >$LTPTMP/tst_ip.err 2>&1
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_ip.err \
>
> I think this needs much more attention than "calling [ twice" or "extra line
> in the script".
Yeah, true. Why not run everything through set -u then?
>>>> 3. About &>
>>>>
>>>> Redirecting Standard Output and Standard Error
>>>> Bash allows both the standard output (file descriptor 1) and
>>>> the standard error output (file descriptor 2) to be redirected to the
>>>> file whose name is the expansion of word with this construct.
>>>>
>>>> There are two formats for redirecting standard output and
>>>> standard error:
>>>>
>>>> &>word
>>>> and
>>>> >&word
>>>>
>>>> The output redirection above captures all output (and most of the time
>>>> you're capturing stdout, but losing stderr to the operating console,
>>>> which can be undesirable). >& is more portable IIRC (it works with
>>>> many ash variants, like FreeBSD's sh -- for sure -- and Solaris's sh
>>>> -- IIRC), which makes it more ideal than &>.
>>>
>>> Still, it isn't POSIX, it doesn't work with dash and actually causes
>>> pain. See:
>>>
>>> cmd &> fn
>>>
>>> POSIX: run cmd in background, write empty file fn
>>> BASH: run cmd (foreground), send its (normal & error) output to file fn
>>>
>>> cmd >& fn
>>>
>>> POSIX: syntax error
>>> BASH: same as above
>>>
>>> But I don't see the point you are making here - do you have a system,
>>> where the POSIX way
>>>
>>> cmd > fn 2>&1
>>>
>>> doesn't work? Or did you see something else in the patch?
>>
>> This changes the behavior of the patch though. That's the point ;)...
>
> How does it change the semantics? It redirects standard output to fn, and
> standard error to standard output (which is redirected to fn). Is there
> anything else it should do?
Ugh. Nevermind -- you're right ><. Keep on forgetting about that bloody syntax.
-Garrett
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [LTP] [PATCH] Fix some bashisms
2009-07-07 0:31 ` Garrett Cooper
@ 2009-07-07 10:29 ` Jiří Paleček
0 siblings, 0 replies; 28+ messages in thread
From: Jiří Paleček @ 2009-07-07 10:29 UTC (permalink / raw)
To: Garrett Cooper; +Cc: ltp-list
On Tue, 07 Jul 2009 02:31:25 +0200, Garrett Cooper <yanegomi@gmail.com>
wrote:
> 2009/7/6 Jiří Paleček <jpalecek@web.de>:
>> On Tue, 07 Jul 2009 01:33:29 +0200, Garrett Cooper <yanegomi@gmail.com>
>> wrote:
>>
>>> On Mon, Jul 6, 2009 at 3:47 PM, Jiri Palecek<jpalecek@web.de> wrote:
>>>>
>>>> On Monday 06 July 2009 19:45:08 Garrett Cooper wrote:
>>>>>
>>>>> 2. All numeric test(1) comparisons could and should be switched from:
>>>>>
>>>>> command
>>>>> if [ $? = 0 ]; then
>>>>>
>>>>> to:
>>>>>
>>>>> if command; then
>>>>>
>>>>> for brevity.
>>>>
>>>> Why should them be changed? This is only a cosmetic change, which
>>>> would
>>>> make the patch unnecessarily larger (when it's already a little too
>>>> large
>>>> IMHO). If it could be in the former form till now, I think it can
>>>> stay there
>>>> a few months/years.
>>>>
>>>> IMHO this usage is still much better than
>>>>
>>>> command; RC=$?
>>>> if [ $RC = 0 ] ...
>>>> ... RC is not read later ...
>>>>
>>>> or (incorrect)
>>>>
>>>> command || RC=$?
>>>> if [ $RC = 0 ] ...
>>>
>>> Yes, I agree with what you said about the above usage, but if you're
>>> not using $? for other than just the [ $? -ne 0 ], then I wouldn't
>>> even bother doing that, because if command; then saves a fork-exec,
>>> and an additional line in the source. As long as it's readable and
>>> doesn't expand multiple lines with a trailing \, you're fine.
>>
>> Are you talking only about efficiency and bash scripts? :-)
>
> Efficiency, and more importantly readability.
>
>> Anyway, if you want to save the fork-exec, you can just use a shell
>> with a
>> test builtin (ksh, bash, dash ... and I believe many others do).
>>
>> If you are concerned about readability, I suggest considering another
>> alternative:
>>
>> command || {
>> do_something_on_error
>> }
>>
>> command && {
>> do_something_when_ok
>> }
>>
>> Of course, usable only when there's no "else" branch.
>
> That's ugly and hard to read with large logic blocks.
I don't think so; I have no problems with a similar syntax in C, moreover,
I consider the braces more distinguishable than keywords.
>> Still, I think the original form is correct and quite straightforward. I
>> would probably not use the extra test myself, but I don't feel like it
>> needs
>> changing. Just looking at the patch, I see places where the check is
>> done
>> really suspiciously:
>>
>>
>> tst_resm TINFO "Test #1: changing mtu size of eth0:1 device."
>>
>> - ip link set eth0:1 mtu 300 &>$LTPTMP/tst_ip.err
>> + ip link set eth0:1 mtu 300 >$LTPTMP/tst_ip.err 2>&1
>> if [ $RC -ne 0 ]
>> then
>> tst_res TFAIL $LTPTMP/tst_ip.err \
>>
>> I think this needs much more attention than "calling [ twice" or "extra
>> line
>> in the script".
>
> Yeah, true. Why not run everything through set -u then?
It would not help, IMO. At least in this particular case, the variable is
properly initialized.
Regards
Jiri Palecek
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread
[parent not found: <4a413e95.8d13f30a.1199.ffffdccbSMTPIN_ADDED@mx.google.com>]
* Re: [LTP] [PATCH] Fix some bashisms
[not found] <4a413e95.8d13f30a.1199.ffffdccbSMTPIN_ADDED@mx.google.com>
@ 2009-06-23 21:21 ` Mike Frysinger
2009-06-25 9:09 ` Subrata Modak
0 siblings, 1 reply; 28+ messages in thread
From: Mike Frysinger @ 2009-06-23 21:21 UTC (permalink / raw)
To: ltp-list; +Cc: Jiri Palecek > (none)
[-- Attachment #1.1: Type: text/plain, Size: 2243 bytes --]
On Sunday 31 May 2009 17:27:51 Jiri Palecek > wrote:
> -echo -e "Completed running Default LTP\n\n"
> +echo "Completed running Default LTP"
> +echo
> +echo
use printf, not bloat the file with echos
> -echo "Distro type is: $tvar \n"
> +echo "Distro type is: $tvar"
>
these are not equivalent
> --- a/testcases/commands/unzip/unzip_tests.sh
> +++ b/testcases/commands/unzip/unzip_tests.sh
> @@ -62,7 +62,6 @@ chk_ifexists()
> # - non-zero on failure.
> cleanup()
> {
> - popd
> # remove all the temporary files created by this test.
> tst_resm TINFO "CLEAN: removing \"$LTPTMP\""
> rm -fr "$LTPTMP"
> @@ -90,7 +89,6 @@ init()
> # create the temporary directory used by this testcase
> LTPTMP=`mktemp -d -t $$.XXXXXX` || tst_resm TBROK "Unable to create
> temporary directory with: mktemp -d $$.XXXXXX" trap "cleanup" 0
> - pushd "$LTPTMP"
>
> # check if commands tst_*, unzip, awk, etc exists.
> chk_ifexists INIT tst_resm || return $RC
umm, you remove the push/popd, but dont replace it with proper cd statements ?
i'm guessing you didnt test this change.
> --- a/testcases/kernel/containers/netns/delchild.sh
> +++ b/testcases/kernel/containers/netns/delchild.sh
> - kill -9 $sshpid $pid > /dev/null 2>&1
> + kill -s KILL $sshpid $pid > /dev/null 2>&1
this isnt a bashism, this is a crappy kill implementation
> for tttype in `ls /dev/tty*`
> do
> -device_no=${tttype:8}
> +device_no=${tttype##/dev/tty}
> ...
> for tttype in `ls /dev/tty*`
> do
> -device_no=${tttype:8}
> +device_no=${tttype##/dev/tty}
using the greedy expansion (##) doesnt make much sense. really should be #.
> - let step_errors="$step_errors + 1"
> + step_errors=$(($step_errors + 1))
> - let i="$i + 1"
> + i=$(($i + 1))
> - let k="$k + 1"
> + k=$(($k + 1))
> - let j="$j + 1"
> + j=$(($j + 1))
> .....
this syntax sucks. please use something like:
: $(( step_errors += 1))
> - echo $"fs_inod on $TCtmp finished."
> + echo "fs_inod on $TCtmp finished."
these are not equivalent, but i doubt this shell script is using the bash
gettext function in the first place, so it's fine
-mike
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 79 bytes --]
------------------------------------------------------------------------------
[-- Attachment #3: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [LTP] [PATCH] Fix some bashisms
2009-06-23 21:21 ` Mike Frysinger
@ 2009-06-25 9:09 ` Subrata Modak
2009-06-30 7:41 ` Subrata Modak
0 siblings, 1 reply; 28+ messages in thread
From: Subrata Modak @ 2009-06-25 9:09 UTC (permalink / raw)
To: Mike Frysinger; +Cc: ltp-list, Jiri Palecek
New Changes to Mikeś comments ?
Regards--
Subrata
On Tue, 2009-06-23 at 17:21 -0400, Mike Frysinger wrote:
> On Sunday 31 May 2009 17:27:51 Jiri Palecek > wrote:
> > -echo -e "Completed running Default LTP\n\n"
> > +echo "Completed running Default LTP"
> > +echo
> > +echo
>
> use printf, not bloat the file with echos
>
> > -echo "Distro type is: $tvar \n"
> > +echo "Distro type is: $tvar"
> >
>
> these are not equivalent
>
> > --- a/testcases/commands/unzip/unzip_tests.sh
> > +++ b/testcases/commands/unzip/unzip_tests.sh
> > @@ -62,7 +62,6 @@ chk_ifexists()
> > # - non-zero on failure.
> > cleanup()
> > {
> > - popd
> > # remove all the temporary files created by this test.
> > tst_resm TINFO "CLEAN: removing \"$LTPTMP\""
> > rm -fr "$LTPTMP"
> > @@ -90,7 +89,6 @@ init()
> > # create the temporary directory used by this testcase
> > LTPTMP=`mktemp -d -t $$.XXXXXX` || tst_resm TBROK "Unable to create
> > temporary directory with: mktemp -d $$.XXXXXX" trap "cleanup" 0
> > - pushd "$LTPTMP"
> >
> > # check if commands tst_*, unzip, awk, etc exists.
> > chk_ifexists INIT tst_resm || return $RC
>
> umm, you remove the push/popd, but dont replace it with proper cd statements ?
> i'm guessing you didnt test this change.
>
> > --- a/testcases/kernel/containers/netns/delchild.sh
> > +++ b/testcases/kernel/containers/netns/delchild.sh
> > - kill -9 $sshpid $pid > /dev/null 2>&1
> > + kill -s KILL $sshpid $pid > /dev/null 2>&1
>
> this isnt a bashism, this is a crappy kill implementation
>
> > for tttype in `ls /dev/tty*`
> > do
> > -device_no=${tttype:8}
> > +device_no=${tttype##/dev/tty}
> > ...
> > for tttype in `ls /dev/tty*`
> > do
> > -device_no=${tttype:8}
> > +device_no=${tttype##/dev/tty}
>
> using the greedy expansion (##) doesnt make much sense. really should be #.
>
> > - let step_errors="$step_errors + 1"
> > + step_errors=$(($step_errors + 1))
> > - let i="$i + 1"
> > + i=$(($i + 1))
> > - let k="$k + 1"
> > + k=$(($k + 1))
> > - let j="$j + 1"
> > + j=$(($j + 1))
> > .....
>
> this syntax sucks. please use something like:
> : $(( step_errors += 1))
>
> > - echo $"fs_inod on $TCtmp finished."
> > + echo "fs_inod on $TCtmp finished."
>
> these are not equivalent, but i doubt this shell script is using the bash
> gettext function in the first place, so it's fine
> -mike
> ------------------------------------------------------------------------------
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [LTP] [PATCH] Fix some bashisms
2009-06-25 9:09 ` Subrata Modak
@ 2009-06-30 7:41 ` Subrata Modak
2009-07-06 23:12 ` Jiri Palecek
0 siblings, 1 reply; 28+ messages in thread
From: Subrata Modak @ 2009-06-30 7:41 UTC (permalink / raw)
To: Jiri Palecek; +Cc: ltp-list, Mike Frysinger
On Thu, 2009-06-25 at 14:39 +0530, Subrata Modak wrote:
> New Changes to Mikeś comments ?
Ping.
>
> Regards--
> Subrata
>
> On Tue, 2009-06-23 at 17:21 -0400, Mike Frysinger wrote:
> > On Sunday 31 May 2009 17:27:51 Jiri Palecek > wrote:
> > > -echo -e "Completed running Default LTP\n\n"
> > > +echo "Completed running Default LTP"
> > > +echo
> > > +echo
> >
> > use printf, not bloat the file with echos
> >
> > > -echo "Distro type is: $tvar \n"
> > > +echo "Distro type is: $tvar"
> > >
> >
> > these are not equivalent
> >
> > > --- a/testcases/commands/unzip/unzip_tests.sh
> > > +++ b/testcases/commands/unzip/unzip_tests.sh
> > > @@ -62,7 +62,6 @@ chk_ifexists()
> > > # - non-zero on failure.
> > > cleanup()
> > > {
> > > - popd
> > > # remove all the temporary files created by this test.
> > > tst_resm TINFO "CLEAN: removing \"$LTPTMP\""
> > > rm -fr "$LTPTMP"
> > > @@ -90,7 +89,6 @@ init()
> > > # create the temporary directory used by this testcase
> > > LTPTMP=`mktemp -d -t $$.XXXXXX` || tst_resm TBROK "Unable to create
> > > temporary directory with: mktemp -d $$.XXXXXX" trap "cleanup" 0
> > > - pushd "$LTPTMP"
> > >
> > > # check if commands tst_*, unzip, awk, etc exists.
> > > chk_ifexists INIT tst_resm || return $RC
> >
> > umm, you remove the push/popd, but dont replace it with proper cd statements ?
> > i'm guessing you didnt test this change.
> >
> > > --- a/testcases/kernel/containers/netns/delchild.sh
> > > +++ b/testcases/kernel/containers/netns/delchild.sh
> > > - kill -9 $sshpid $pid > /dev/null 2>&1
> > > + kill -s KILL $sshpid $pid > /dev/null 2>&1
> >
> > this isnt a bashism, this is a crappy kill implementation
> >
> > > for tttype in `ls /dev/tty*`
> > > do
> > > -device_no=${tttype:8}
> > > +device_no=${tttype##/dev/tty}
> > > ...
> > > for tttype in `ls /dev/tty*`
> > > do
> > > -device_no=${tttype:8}
> > > +device_no=${tttype##/dev/tty}
> >
> > using the greedy expansion (##) doesnt make much sense. really should be #.
> >
> > > - let step_errors="$step_errors + 1"
> > > + step_errors=$(($step_errors + 1))
> > > - let i="$i + 1"
> > > + i=$(($i + 1))
> > > - let k="$k + 1"
> > > + k=$(($k + 1))
> > > - let j="$j + 1"
> > > + j=$(($j + 1))
> > > .....
> >
> > this syntax sucks. please use something like:
> > : $(( step_errors += 1))
> >
> > > - echo $"fs_inod on $TCtmp finished."
> > > + echo "fs_inod on $TCtmp finished."
> >
> > these are not equivalent, but i doubt this shell script is using the bash
> > gettext function in the first place, so it's fine
> > -mike
> > ------------------------------------------------------------------------------
> > _______________________________________________
> > Ltp-list mailing list
> > Ltp-list@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/ltp-list
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [LTP] [PATCH] Fix some bashisms
2009-06-30 7:41 ` Subrata Modak
@ 2009-07-06 23:12 ` Jiri Palecek
0 siblings, 0 replies; 28+ messages in thread
From: Jiri Palecek @ 2009-07-06 23:12 UTC (permalink / raw)
To: subrata; +Cc: ltp-list, Mike Frysinger
On Tuesday 30 June 2009 09:41:10 Subrata Modak wrote:
> On Thu, 2009-06-25 at 14:39 +0530, Subrata Modak wrote:
> > New Changes to Mikeś comments ?
>
> Ping.
Ok, I finally got time to look into this. I'll send a separate patch which reflects the comments.
> >
> > Regards--
> > Subrata
> >
> > On Tue, 2009-06-23 at 17:21 -0400, Mike Frysinger wrote:
> > > On Sunday 31 May 2009 17:27:51 Jiri Palecek > wrote:
> > > > --- a/testcases/commands/unzip/unzip_tests.sh
> > > > +++ b/testcases/commands/unzip/unzip_tests.sh
> > > > @@ -62,7 +62,6 @@ chk_ifexists()
> > > > # - non-zero on failure.
> > > > cleanup()
> > > > {
> > > > - popd
> > > > # remove all the temporary files created by this test.
> > > > tst_resm TINFO "CLEAN: removing \"$LTPTMP\""
> > > > rm -fr "$LTPTMP"
> > > > @@ -90,7 +89,6 @@ init()
> > > > # create the temporary directory used by this testcase
> > > > LTPTMP=`mktemp -d -t $$.XXXXXX` || tst_resm TBROK "Unable to create
> > > > temporary directory with: mktemp -d $$.XXXXXX" trap "cleanup" 0
> > > > - pushd "$LTPTMP"
> > > >
> > > > # check if commands tst_*, unzip, awk, etc exists.
> > > > chk_ifexists INIT tst_resm || return $RC
> > >
> > > umm, you remove the push/popd, but dont replace it with proper cd statements ?
> > > i'm guessing you didnt test this change.
Oh yes, I did, but I tested it with other changes which rendered the pushd/popd unnecessary. You're right this wouldn't work.
> > > > --- a/testcases/kernel/containers/netns/delchild.sh
> > > > +++ b/testcases/kernel/containers/netns/delchild.sh
> > > > - kill -9 $sshpid $pid > /dev/null 2>&1
> > > > + kill -s KILL $sshpid $pid > /dev/null 2>&1
> > >
> > > this isnt a bashism, this is a crappy kill implementation
Formally speaking, this is an XSI extension to POSIX. I don't think this "-9" is any better than "-s KILL", so I won't change this.
> > > > for tttype in `ls /dev/tty*`
> > > > do
> > > > -device_no=${tttype:8}
> > > > +device_no=${tttype##/dev/tty}
> > > > ...
> > > > for tttype in `ls /dev/tty*`
> > > > do
> > > > -device_no=${tttype:8}
> > > > +device_no=${tttype##/dev/tty}
> > >
> > > using the greedy expansion (##) doesnt make much sense. really should be #.
> > >
> > > > - let step_errors="$step_errors + 1"
> > > > + step_errors=$(($step_errors + 1))
> > > > - let i="$i + 1"
> > > > + i=$(($i + 1))
> > > > - let k="$k + 1"
> > > > + k=$(($k + 1))
> > > > - let j="$j + 1"
> > > > + j=$(($j + 1))
> > > > .....
> > >
> > > this syntax sucks. please use something like:
> > > : $(( step_errors += 1))
If it hurts your aesthetic sense ... ok.
> > >
> > > > - echo $"fs_inod on $TCtmp finished."
> > > > + echo "fs_inod on $TCtmp finished."
> > >
> > > these are not equivalent, but i doubt this shell script is using the bash
> > > gettext function in the first place, so it's fine
> > > -mike
> > > ------------------------------------------------------------------------------
> > > _______________________________________________
> > > Ltp-list mailing list
> > > Ltp-list@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/ltp-list
> >
> >
> > ------------------------------------------------------------------------------
> > _______________________________________________
> > Ltp-list mailing list
> > Ltp-list@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/ltp-list
>
>
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 28+ messages in thread
* [LTP] [PATCH] Fix some bashisms
@ 2009-05-31 21:27 Jiri Palecek >
0 siblings, 0 replies; 28+ messages in thread
From: Jiri Palecek > @ 2009-05-31 21:27 UTC (permalink / raw)
Cc: ltp-list
Hello,
this patch removes another load of bashisms.
Regards
Jiri Palecek
Signed-off-by: Jiri Palecek <jpalecek@web.de>
---
runalltests.sh | 60 +++++++++++-----------
testcases/commands/cron/cron02 | 4 +-
testcases/commands/cron/cron03 | 2 +-
testcases/commands/cron/cron_allow01 | 10 ++--
testcases/commands/cron/cron_deny01 | 14 +++---
testcases/commands/su/su01 | 18 +++---
testcases/commands/unzip/unzip_tests.sh | 2 -
testcases/kernel/containers/netns/child.sh | 2 +-
testcases/kernel/containers/netns/child_1.sh | 2 +-
testcases/kernel/containers/netns/childipv6.sh | 4 +-
testcases/kernel/containers/netns/childns.sh | 4 +-
testcases/kernel/containers/netns/delchild.sh | 8 ++--
testcases/kernel/containers/netns/par_ftp.sh | 2 +-
testcases/kernel/containers/netns/parent.sh | 2 +-
testcases/kernel/containers/netns/parent_1.sh | 2 +-
testcases/kernel/containers/netns/parent_2.sh | 2 +-
testcases/kernel/containers/netns/parentns.sh | 4 +-
testcases/kernel/containers/netns/paripv6.sh | 4 +-
testcases/kernel/containers/netns/rename_net.sh | 6 +-
testcases/kernel/syscalls/ioctl/test_ioctl | 4 +-
testcases/misc/tcore_patch_test_suites/tcore.sh | 11 ++--
testcases/network/iproute/ip_tests.sh | 62 +++++++++++-----------
testcases/network/nfs/nfs03/nfs03 | 26 +++++-----
23 files changed, 128 insertions(+), 127 deletions(-)
diff --git a/runalltests.sh b/runalltests.sh
index aa7a7d5..db80777 100755
--- a/runalltests.sh
+++ b/runalltests.sh
@@ -29,17 +29,17 @@
## ##
################################################################################
-echo -e "*******************************************************************"
-echo -e "*******************************************************************"
-echo -e "** **"
-echo -e "** This script is being re-written to cover all aspects of **"
-echo -e "** testing LTP, which includes running all those tests which **"
-echo -e "** are not run by default with ./runltp script. Special setup **"
-echo -e "** in system environment will be done to run all those tests **"
-echo -e "** like the File System tests, SELinuxtest, etc **"
-echo -e "** **"
-echo -e "*******************************************************************"
-echo -e "*******************************************************************"
+echo "*******************************************************************"
+echo "*******************************************************************"
+echo "** **"
+echo "** This script is being re-written to cover all aspects of **"
+echo "** testing LTP, which includes running all those tests which **"
+echo "** are not run by default with ./runltp script. Special setup **"
+echo "** in system environment will be done to run all those tests **"
+echo "** like the File System tests, SELinuxtest, etc **"
+echo "** **"
+echo "*******************************************************************"
+echo "*******************************************************************"
export LTPROOT=${PWD}
export RUN_BALLISTA=0
@@ -210,19 +210,21 @@ export HTML_OUTPUT_FILE_NAME=$LTP_VERSION_$HOSTNAME_$KERNEL_VERSION_$HARDWARE_TY
## The First one i plan to run is the default LTP run ##
## START => Test Series 1 ##
-echo -e "Running Default LTP..."
+echo "Running Default LTP..."
./runltp -g $HTML_OUTPUT_FILE_NAME
-echo -e "Completed running Default LTP\n\n"
+echo "Completed running Default LTP"
+echo
+echo
## END => Test Series 1 ##
## The next one i plan to run is ballista ##
## START => Test Series 2 ##
if [ $RUN_BALLISTA -eq 1 ]
then
- echo -e "Running Ballista..."
+ echo "Running Ballista..."
export TEST_START_TIME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`
./runltp -f ballista -o $LTP_VERSION-BALLISTA_RUN_ON-$HOSTNAME-$KERNEL_VERSION-$HARDWARE_TYPE-$TEST_START_TIME.out
- echo -e "Completed running Ballista\n\n"
+ echo "Completed running Ballista"; echo; echo
fi
## END => Test Series 2 ##
@@ -230,9 +232,9 @@ fi
## START => Test Series 3 ##
if [ $RUN_OPENPOSIX -eq 1 ]
then
- echo -e "Running Open Posix Tests..."
+ echo "Running Open Posix Tests..."
(cd testcases/open_posix_testsuite; make)
- echo -e "Completed running Open Posix Tests\n\n"
+ echo "Completed running Open Posix Tests"; echo; echo
fi
## END => Test Series 3 ##
@@ -242,9 +244,9 @@ fi
## START => Test Series 4 ##
if [ $RUN_MM_CORE_APIS -eq 1 ]
then
- echo -e "Initializing ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
+ echo "Initializing ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
# Check to see if User is Root
- if [ $EUID -ne 0 ]
+ if [ $(id -u) -ne 0 ]
then
echo You need to be root to Install libmm and run mem/libmm/mm_core_apis
echo Aborting ltp/testcases/kernel/mem/libmm/mm_core_apis
@@ -262,13 +264,13 @@ then
else
echo libmm-1.4.2 already installed in your system
fi
- echo -e "Running ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
+ echo "Running ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
(cd testcases/kernel/mem/libmm; \
make; \
make install; \
$LTPROOT/testcases/bin/mm_core_apis; )
fi
- echo -e "Completed running ltp/testcases/kernel/mem/libmm/mm_core_apis...\n\n"
+ echo "Completed running ltp/testcases/kernel/mem/libmm/mm_core_apis..."; echo; echo
fi
## END => Test Series 4 ##
@@ -278,9 +280,9 @@ fi
## START => Test Series 5 ##
if [ $RUN_AIOTESTS -eq 1 ]
then
- echo -e "Initializing ltp/testcases/kernel/io/aio ..."
+ echo "Initializing ltp/testcases/kernel/io/aio ..."
# Check to see if User is Root
- if [ $EUID -ne 0 ]
+ if [ $(id -u) -ne 0 ]
then
echo You need to be root to Install libaio-0.3.92 and run ltp/testcases/kernel/io/aio
echo Aborting ltp/testcases/kernel/io/aio
@@ -298,13 +300,13 @@ if [ $RUN_AIOTESTS -eq 1 ]
else
echo libaio-0.3.92 already installed in your system
fi
- echo -e "Building & Running ltp/testcases/kernel/io/aio..."
+ echo "Building & Running ltp/testcases/kernel/io/aio..."
(cd testcases/kernel/io/aio; \
make > /dev/null; \
./aio01/aio01; \
./aio02/runfstests.sh -a aio02/cases/aio_tio; \
make clean 1>&2 > /dev/null )
- echo -e "Completed running ltp/testcases/kernel/io/aio...\n\n"
+ echo "Completed running ltp/testcases/kernel/io/aio..."; echo; echo
fi
fi
## END => Test Series 5 ##
@@ -316,9 +318,9 @@ fi
## START => Test Series 6 ##
if [ $RUN_FILECAPS -eq 1 ]
then
- echo -e "Initializing ltp/testcases/kernel/security/filecaps ..."
+ echo "Initializing ltp/testcases/kernel/security/filecaps ..."
# Check to see if User is Root
- if [ $EUID -ne 0 ]
+ if [ $(id -u) -ne 0 ]
then
echo You need to be root to Install libcaps and run ltp/testcases/kernel/security/filecaps
echo Aborting ltp/testcases/kernel/security/filecaps
@@ -336,11 +338,11 @@ then
else
echo libcaps already installed in your system
fi
- echo -e "Building & Running ltp/testcases/kernel/security/filecaps"
+ echo "Building & Running ltp/testcases/kernel/security/filecaps"
(cd ltp/testcases/kernel/security/filecaps; \
make && make install > /dev/null; )
./runltp -f filecaps
- echo -e "Completed running ltp/testcases/kernel/io/aio...\n\n"
+ echo "Completed running ltp/testcases/kernel/io/aio..."; echo; echo
fi
fi
## END => Test Series 6 ##
diff --git a/testcases/commands/cron/cron02 b/testcases/commands/cron/cron02
index c1dc245..7f45172 100755
--- a/testcases/commands/cron/cron02
+++ b/testcases/commands/cron/cron02
@@ -37,7 +37,7 @@ TEST_USER_HOMEDIR="/home/$TEST_USER"
do_setup(){
#erase any data from potential defunt cron test
- rm -rf /tmp/crontest &> /dev/null
+ rm -rf /tmp/crontest > /dev/null 2>&1
#erase user if he may exist , so we can have a clean env
rm -rf /home/$TEST_USER
@@ -56,7 +56,7 @@ do_setup(){
# Red Hat uses crond, SuSE/Other uses cron. Check if this is Red Hat/SuSE/Other
tvar=${MACHTYPE%-*}
tvar=${tvar#*-}
-echo "Distro type is: $tvar \n"
+echo "Distro type is: $tvar"
if [ $tvar != "redhat" -a $tvar != "redhat-linux" ]; then
diff --git a/testcases/commands/cron/cron03 b/testcases/commands/cron/cron03
index 58fbe1b..2573cc7 100755
--- a/testcases/commands/cron/cron03
+++ b/testcases/commands/cron/cron03
@@ -59,7 +59,7 @@ do_setup(){
# Red Hat uses crond, SuSE/Other uses cron. Check if this is Red Hat/SuSE/Other
tvar=${MACHTYPE%-*}
tvar=${tvar#*-}
-echo "Distro type is: $tvar \n"
+echo "Distro type is: $tvar"
if [ $tvar != "redhat" -a $tvar != "redhat-linux" ]; then
diff --git a/testcases/commands/cron/cron_allow01 b/testcases/commands/cron/cron_allow01
index 839ad81..266700a 100755
--- a/testcases/commands/cron/cron_allow01
+++ b/testcases/commands/cron/cron_allow01
@@ -47,9 +47,9 @@ TEST_USER2_HOME="/home/$TEST_USER2"
do_setup() {
#move any files that may get in the way
- rm /tmp/cron_allow_test &> /dev/null
- rm /tmp/cron_allow_test1 &> /dev/null
- mv $CRON_ALLOW $CRON_ALLOW.old &> /dev/null
+ rm /tmp/cron_allow_test > /dev/null 2>&1
+ rm /tmp/cron_allow_test1 > /dev/null 2>&1
+ mv $CRON_ALLOW $CRON_ALLOW.old > /dev/null 2>&1
#remove users for clean enviroment
su $TEST_USER1 -c "crontab -r"
@@ -90,8 +90,8 @@ do_cleanup(){
userdel $TEST_USER1
userdel $TEST_USER2
rm $CRON_ALLOW
- mv $CRON_ALLOW.old $CRON_ALLOW &> /dev/null
- rm /tmp/cron_allow_test &>/dev/null
+ mv $CRON_ALLOW.old $CRON_ALLOW > /dev/null 2>&1
+ rm /tmp/cron_allow_test >/dev/null 2>&1
}
#-----------------------------------------------------------------------
diff --git a/testcases/commands/cron/cron_deny01 b/testcases/commands/cron/cron_deny01
index f7f8fd4..527d79c 100755
--- a/testcases/commands/cron/cron_deny01
+++ b/testcases/commands/cron/cron_deny01
@@ -49,11 +49,11 @@ TEST_USER2_HOME="/home/$TEST_USER2"
do_setup() {
#move any files that may get in the way
- rm /tmp/cron_deny_test &> /dev/null
- rm /tmp/cron_deny_test1 &> /dev/null
+ rm /tmp/cron_deny_test > /dev/null 2>&1
+ rm /tmp/cron_deny_test1 > /dev/null 2>&1
- mv $CRON_DENY $CRON_DENY.old &> /dev/null
- mv $CRON_ALLOW $CRON_ALLOW.old &> /dev/null
+ mv $CRON_DENY $CRON_DENY.old > /dev/null 2>&1
+ mv $CRON_ALLOW $CRON_ALLOW.old > /dev/null 2>&1
#remove users for clean enviroment
su $TEST_USER1 -c "crontab -r"
@@ -94,9 +94,9 @@ do_cleanup(){
userdel $TEST_USER1
userdel $TEST_USER2
rm $CRON_DENY
- mv $CRON_DENY.old $CRON_DENY &> /dev/null
- mv $CRON_ALLOW.old $CRON_ALLOW &> /dev/null
- rm /tmp/cron_allow_test &>/dev/null
+ mv $CRON_DENY.old $CRON_DENY > /dev/null 2>&1
+ mv $CRON_ALLOW.old $CRON_ALLOW > /dev/null 2>&1
+ rm /tmp/cron_allow_test >/dev/null 2>&1
}
#-----------------------------------------------------------------------
diff --git a/testcases/commands/su/su01 b/testcases/commands/su/su01
index e6b8a05..2a43f66 100755
--- a/testcases/commands/su/su01
+++ b/testcases/commands/su/su01
@@ -41,7 +41,7 @@ tvar=${tvar#*-}
# need to export tvar for su01_s1
export tvar
-echo "Machine type is: $tvar \n"
+echo "Machine type is: $tvar"
if [ $tvar = "redhat" -o $tvar = "redhat-linux" ]
# Need to also set group for TEST_USER2
@@ -76,9 +76,9 @@ export TEST_ENV_FILE2="/tmp/TEST_ENV_FILE_ROOT2"
do_setup(){
#REMOVE ANY TEMPOARY FILES THAT MAY STILL BE AROUND
-rm -f $TEST_ENV_FILE_USER &> /dev/null
-rm -f $TEST_ENV_FILE2 &> /dev/null
-rm -f $TEST_ENV_FILE &> /dev/null
+rm -f $TEST_ENV_FILE_USER > /dev/null 2>&1
+rm -f $TEST_ENV_FILE2 > /dev/null 2>&1
+rm -f $TEST_ENV_FILE > /dev/null 2>&1
#Create 1st test user
@@ -108,7 +108,7 @@ rm -f $TEST_ENV_FILE &> /dev/null
}
fi
- usermod -p $TEST_USER1_ENCRYPTED_PASSWD $TEST_USER1 &> /dev/null
+ usermod -p $TEST_USER1_ENCRYPTED_PASSWD $TEST_USER1 > /dev/null 2>&1
if [ $? != 0 ]
then {
echo "Could not set password for test user $TEST_USER1"
@@ -144,7 +144,7 @@ rm -f $TEST_ENV_FILE &> /dev/null
}
fi
- usermod -p $TEST_USER2_ENCRYPTED_PASSWD $TEST_USER2 &> /dev/null
+ usermod -p $TEST_USER2_ENCRYPTED_PASSWD $TEST_USER2 > /dev/null 2>&1
if [ $? != 0 ]
then {
echo "Could not set password for test user $TEST_USER2"
@@ -164,9 +164,9 @@ do_cleanup() {
userdel $TEST_USER1
userdel $TEST_USER2
#REMOVE ANY TEMPOARY FILES THAT MAY STILL BE AROUND
- rm -f $TEST_ENV_FILE_USER &> /dev/null
- rm -f $TEST_ENV_FILE2 &> /dev/null
- rm -f $TEST_ENV_FILE &> /dev/null
+ rm -f $TEST_ENV_FILE_USER > /dev/null 2>&1
+ rm -f $TEST_ENV_FILE2 > /dev/null 2>&1
+ rm -f $TEST_ENV_FILE > /dev/null 2>&1
}
#-----------------------------------------------------------------------
diff --git a/testcases/commands/unzip/unzip_tests.sh b/testcases/commands/unzip/unzip_tests.sh
index 5881ea4..5cf4f4c 100755
--- a/testcases/commands/unzip/unzip_tests.sh
+++ b/testcases/commands/unzip/unzip_tests.sh
@@ -62,7 +62,6 @@ chk_ifexists()
# - non-zero on failure.
cleanup()
{
- popd
# remove all the temporary files created by this test.
tst_resm TINFO "CLEAN: removing \"$LTPTMP\""
rm -fr "$LTPTMP"
@@ -90,7 +89,6 @@ init()
# create the temporary directory used by this testcase
LTPTMP=`mktemp -d -t $$.XXXXXX` || tst_resm TBROK "Unable to create temporary directory with: mktemp -d $$.XXXXXX"
trap "cleanup" 0
- pushd "$LTPTMP"
# check if commands tst_*, unzip, awk, etc exists.
chk_ifexists INIT tst_resm || return $RC
diff --git a/testcases/kernel/containers/netns/child.sh b/testcases/kernel/containers/netns/child.sh
index a7fbc4b..6e8ed62 100755
--- a/testcases/kernel/containers/netns/child.sh
+++ b/testcases/kernel/containers/netns/child.sh
@@ -34,7 +34,7 @@ export TST_TOTAL
ping -qc 2 $IP1 > /dev/null
- if [ $? == 0 ] ; then
+ if [ $? = 0 ] ; then
tst_resm TINFO "PASS: Pinging ParentNS from ChildNS"
status=0
else
diff --git a/testcases/kernel/containers/netns/child_1.sh b/testcases/kernel/containers/netns/child_1.sh
index d44eebd..1fa71a7 100755
--- a/testcases/kernel/containers/netns/child_1.sh
+++ b/testcases/kernel/containers/netns/child_1.sh
@@ -65,7 +65,7 @@ export TST_TOTAL
# Pinging CHILD2 from CHILD1
debug "INFO: Trying for pinging CHILD2..."
ping -qc 2 $IP4 > /dev/null
- if [ $? == 0 ];
+ if [ $? = 0 ];
then
tst_resm TINFO "PASS: Child2 is pinging from CHILD1 !"
else
diff --git a/testcases/kernel/containers/netns/childipv6.sh b/testcases/kernel/containers/netns/childipv6.sh
index 4e904be..54bd6e6 100755
--- a/testcases/kernel/containers/netns/childipv6.sh
+++ b/testcases/kernel/containers/netns/childipv6.sh
@@ -52,7 +52,7 @@ status=0
#starting the sshd inside the child NS
/usr/sbin/sshd -p $PORT
- if [ $? == 0 ]; then
+ if [ $? = 0 ]; then
debug "INFO: started the sshd @ port no $PORT"
sshpid=`ps -ef | grep "sshd -p $PORT" | awk '{ print $2 ; exit 0} ' `
else
@@ -68,7 +68,7 @@ status=0
# checking if parent ns responding
ping6 -I $vnet1 -qc 2 $parIPv6 >/dev/null 2>&1
- if [ $? == 0 ] ; then
+ if [ $? = 0 ] ; then
tst_resm TINFO "IPv6: Pinging Parent from Child: PASS"
else
tst_resm TFAIL "IPv6: Pinging Parent from Child: FAIL"
diff --git a/testcases/kernel/containers/netns/childns.sh b/testcases/kernel/containers/netns/childns.sh
index 6fe47ab..5a831ba 100755
--- a/testcases/kernel/containers/netns/childns.sh
+++ b/testcases/kernel/containers/netns/childns.sh
@@ -41,7 +41,7 @@ export TST_TOTAL
. initialize.sh
status=0
- if [ $# == 1 ] ; then
+ if [ $# = 1 ] ; then
childscrpt=$1
debug "INFO: The script to be executed in child NS is $childscrpt"
fi
@@ -63,7 +63,7 @@ status=0
#starting the sshd inside the child NS
/usr/sbin/sshd -p $PORT
- if [ $? == 0 ]; then
+ if [ $? = 0 ]; then
debug "INFO: started the sshd @ port no $PORT"
sshpid=`ps -ef | grep "sshd -p $PORT" | awk '{ print $2 ; exit 0} ' `
else
diff --git a/testcases/kernel/containers/netns/delchild.sh b/testcases/kernel/containers/netns/delchild.sh
index 88822f2..d294e26 100755
--- a/testcases/kernel/containers/netns/delchild.sh
+++ b/testcases/kernel/containers/netns/delchild.sh
@@ -41,7 +41,7 @@ export TST_TOTAL
newnet=`cat /tmp/FIFO4`
debug "INFO: new dev is $newnet"
- if [ $newnet == -1 ] ; then
+ if [ $newnet = -1 ] ; then
status=-1
fi
@@ -50,17 +50,17 @@ export TST_TOTAL
debug "INFO: Deleting the child NS created.. "
debug "INFO: Killing processes $sshpid $pid"
- kill -9 $sshpid $pid > /dev/null 2>&1
+ kill -s KILL $sshpid $pid > /dev/null 2>&1
sleep 1
ls /sys/class/net > /tmp/sys_aftr_child_killed
diff -q /tmp/sys_b4_child_killed /tmp/sys_aftr_child_killed
- if [ $? == 0 ] ; then
+ if [ $? = 0 ] ; then
debug "INFO: No difference in the contents of sysfs after deleting the child"
else
grep -qw $newnet /tmp/sys_aftr_child_killed
- if [ $? == 0 ]; then
+ if [ $? = 0 ]; then
debug "INFO: Device $newnet is moved to ParentNS"
else
debug "INFO: Device $newnet is moved under diff name in ParentNS"
diff --git a/testcases/kernel/containers/netns/par_ftp.sh b/testcases/kernel/containers/netns/par_ftp.sh
index fa672a4..3bfb47b 100755
--- a/testcases/kernel/containers/netns/par_ftp.sh
+++ b/testcases/kernel/containers/netns/par_ftp.sh
@@ -35,7 +35,7 @@ export TST_TOTAL
ping -q -c 2 $IP2 > /dev/null
- if [ $? == 0 ] ; then
+ if [ $? = 0 ] ; then
tst_resm TINFO "Pinging ChildNS from ParentNS"
else
tst_resm TFAIL "Error: Unable to ping ChildNS from ParentNS"
diff --git a/testcases/kernel/containers/netns/parent.sh b/testcases/kernel/containers/netns/parent.sh
index a12f284..61bb500 100755
--- a/testcases/kernel/containers/netns/parent.sh
+++ b/testcases/kernel/containers/netns/parent.sh
@@ -33,7 +33,7 @@ export TST_COUNT
export TST_TOTAL
ping -q -c 2 $IP2 > /dev/null
- if [ $? == 0 ] ; then
+ if [ $? = 0 ] ; then
tst_resm TINFO "PASS: Pinging ChildNS from ParentNS"
status=0
else
diff --git a/testcases/kernel/containers/netns/parent_1.sh b/testcases/kernel/containers/netns/parent_1.sh
index b42436e..1b91a58 100755
--- a/testcases/kernel/containers/netns/parent_1.sh
+++ b/testcases/kernel/containers/netns/parent_1.sh
@@ -38,7 +38,7 @@ export TST_TOTAL
create_veth
vnet0=$dev0
vnet1=$dev1
- if [[ -z $vnet0 || -z $vnet1 ]] ; then
+ if [ -z "$vnet0" ] || [ -z "$vnet1" ] ; then
tst_resm TFAIL "Error: unable to create veth pair in $0"
exit -1
else
diff --git a/testcases/kernel/containers/netns/parent_2.sh b/testcases/kernel/containers/netns/parent_2.sh
index 86eb172..c39bc7c 100755
--- a/testcases/kernel/containers/netns/parent_2.sh
+++ b/testcases/kernel/containers/netns/parent_2.sh
@@ -35,7 +35,7 @@ export TST_TOTAL
vnet2=$dev0
vnet3=$dev1
- if [[ -z $vnet2 || -z $vnet3 ]] ; then
+ if [ -z "$vnet2" ] || [ -z "$vnet3" ] ; then
tst_resm TFAIL "Error: unable to create veth pair in $0"
exit -1
else
diff --git a/testcases/kernel/containers/netns/parentns.sh b/testcases/kernel/containers/netns/parentns.sh
index 43cdcdb..b6488a4 100755
--- a/testcases/kernel/containers/netns/parentns.sh
+++ b/testcases/kernel/containers/netns/parentns.sh
@@ -43,7 +43,7 @@ export TST_TOTAL
status=0
# Checks if any script is passed as argument.
- if [ $# == 2 ]; then
+ if [ $# = 2 ]; then
scrpt=$1
debug "INFO: Script to be executed in parent NS is $scrpt"
fi
@@ -56,7 +56,7 @@ status=0
create_veth
vnet0=$dev0
vnet1=$dev1
- if [[ -z $vnet0 || -z $vnet1 ]] ; then
+ if [ -z "$vnet0" ] || [ -z "$vnet1" ] ; then
tst_resm TFAIL "Error: unable to create veth pair"
exit -1
else
diff --git a/testcases/kernel/containers/netns/paripv6.sh b/testcases/kernel/containers/netns/paripv6.sh
index 568c86f..67c8636 100755
--- a/testcases/kernel/containers/netns/paripv6.sh
+++ b/testcases/kernel/containers/netns/paripv6.sh
@@ -49,7 +49,7 @@ status=0
create_veth
vnet0=$dev0
vnet1=$dev1
- if [[ -z $vnet0 || -z $vnet1 ]] ; then
+ if [ -z "$vnet0" ] || [ -z "$vnet1" ] ; then
tst_resm TFAIL "Error: unable to create veth pair"
exit -1
else
@@ -76,7 +76,7 @@ status=0
echo $parIPv6 > /tmp/FIFO4
ping6 -I $vnet0 -qc 2 $childIPv6 >/dev/null 2>&1
- if [ $? == 0 ] ; then
+ if [ $? = 0 ] ; then
tst_resm TINFO "IPv6: Pinging child from parent: PASS"
status=0
else
diff --git a/testcases/kernel/containers/netns/rename_net.sh b/testcases/kernel/containers/netns/rename_net.sh
index cadf7e2..ffbe07f 100755
--- a/testcases/kernel/containers/netns/rename_net.sh
+++ b/testcases/kernel/containers/netns/rename_net.sh
@@ -46,9 +46,9 @@ export TST_TOTAL
ip link set $vnet1 name $newdev
ifconfig $newdev $IP2/24 up > /dev/null 2>&1
- if [ $? == 0 ] ; then
+ if [ $? = 0 ] ; then
tst_resm TINFO "Successfully Renamed device to $newdev"
- if [ DEBUG == 1 ]; then
+ if [ "$DEBUG" = 1 ]; then
ifconfig
fi
else
@@ -56,7 +56,7 @@ export TST_TOTAL
status=-1
fi
- if [ $status == 0 ] ; then
+ if [ $status = 0 ] ; then
echo $sshpid > /tmp/FIFO3
echo $newdev > /tmp/FIFO4
else
diff --git a/testcases/kernel/syscalls/ioctl/test_ioctl b/testcases/kernel/syscalls/ioctl/test_ioctl
index 2ea3e39..7ae9e71 100755
--- a/testcases/kernel/syscalls/ioctl/test_ioctl
+++ b/testcases/kernel/syscalls/ioctl/test_ioctl
@@ -25,7 +25,7 @@ export TST_COUNT=0
for tttype in `ls /dev/tty*`
do
-device_no=${tttype:8}
+device_no=${tttype##/dev/tty}
case "$device_no" in
[0-9]|[0-9][0-9])
tst_resm TINFO "Testing ioctl01 with $tttype"
@@ -43,7 +43,7 @@ done
for tttype in `ls /dev/tty*`
do
-device_no=${tttype:8}
+device_no=${tttype##/dev/tty}
case "$device_no" in
[0-9]|[0-9][0-9])
tst_resm TINFO "Testing ioctl02 with $tttype"
diff --git a/testcases/misc/tcore_patch_test_suites/tcore.sh b/testcases/misc/tcore_patch_test_suites/tcore.sh
index f087fa7..4b032dc 100755
--- a/testcases/misc/tcore_patch_test_suites/tcore.sh
+++ b/testcases/misc/tcore_patch_test_suites/tcore.sh
@@ -107,13 +107,13 @@ Test_gen_core()
rm -f core.*
fi
pid=`$BIN_DIR/tcore |grep "consumer pid"|awk '{print $2}'|cut -d = -f 2`
- echo -e "Test whether we can generate the needed core file"
+ echo "Test whether we can generate the needed core file"
if [ -f core.* ];then
- echo -e "PASS"
+ echo "PASS"
pass=`expr $pass + 1`
return 0
else
- echo -e "FAIL"
+ echo "FAIL"
fail=`expr $fail + 1`
return 1
fi
@@ -124,14 +124,14 @@ Test_core_file()
cd $TEST_DIR
prepare_gdb
mv -f $TEST_DIR/core.* $TEST_DIR/corefile >/dev/null 2>&1
- echo -e "Test whether the core support bt,fpu and threads commands "
+ echo "Test whether the core support bt,fpu and threads commands "
expect $BIN_DIR/tcore.exp
return=$?
pass=`expr $pass + $return`
fail=`expr 3 - $return + $fail`
}
-echo -e "Test Tcore patch "
+echo "Test Tcore patch "
check_install
Test_gen_core
Test_core_file
@@ -142,3 +142,4 @@ cleanup $fail
+
diff --git a/testcases/network/iproute/ip_tests.sh b/testcases/network/iproute/ip_tests.sh
index c622700..59322b6 100755
--- a/testcases/network/iproute/ip_tests.sh
+++ b/testcases/network/iproute/ip_tests.sh
@@ -61,7 +61,7 @@ init()
trap "cleanup" 0
# create the tmp directory for this testcase.
- mkdir -p $LTPTMP/ &>/dev/null || RC=$?
+ mkdir -p $LTPTMP/ >/dev/null 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brkm TBROK "INIT: Unable to create temporary directory"
@@ -69,7 +69,7 @@ init()
fi
# Check to see if test harness functions are in the path.
- which tst_resm &>$LTPTMP/tst_ip.err || RC=$?
+ which tst_resm >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brkm TBROK NULL \
@@ -77,7 +77,7 @@ init()
return $RC
fi
- which awk &>$LTPTMP/tst_ip.err || RC=$?
+ which awk >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brkm TBROK NULL \
@@ -85,7 +85,7 @@ init()
return $RC
fi
- which ip &>$LTPTMP/tst_ip.err || RC=$?
+ which ip >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brkm TBROK NULL \
@@ -93,7 +93,7 @@ init()
return $RC
fi
- which ifconfig &>$LTPTMP/tst_ip.err || RC=$?
+ which ifconfig >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brkm TBROK NULL \
@@ -104,13 +104,13 @@ init()
tst_resm TINFO "INIT: Inititalizing tests."
# Aliasing eth0 to create private network.
- /sbin/ifconfig eth0:1 10.1.1.12 &>$LTPTMP/tst_ip.err || RC=$?
+ /sbin/ifconfig eth0:1 10.1.1.12 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brk TBROK "INIT: failed aliasing eth0:1 with IP 10.1.1.12"
return $RC
else
- /sbin/route add -host 10.1.1.12 dev eth0:1 &>$LTPTMP/tst_ip.err \
+ /sbin/route add -host 10.1.1.12 dev eth0:1 >$LTPTMP/tst_ip.err 2>&1 \
|| RC=$?
if [ $RC -ne 0 ]
then
@@ -153,10 +153,10 @@ cleanup()
TST_COUNT=0
RC=0
- /sbin/ifconfig eth0:1 &>$LTPTMP/tst_ip.err || RC=$?
+ /sbin/ifconfig eth0:1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -eq 0 ]
then
- /sbin/ifconfig eth0:1 down &>$LTPTMP/tst_ip.err
+ /sbin/ifconfig eth0:1 down >$LTPTMP/tst_ip.err 2>&1
fi
rm -fr $LTPTMP
@@ -187,7 +187,7 @@ test01()
tst_resm TINFO "Test #1: changing mtu size of eth0:1 device."
- ip link set eth0:1 mtu 300 &>$LTPTMP/tst_ip.err
+ ip link set eth0:1 mtu 300 >$LTPTMP/tst_ip.err 2>&1
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -232,7 +232,7 @@ test02()
tst_resm TINFO \
"Test #2: Installing dummy.o in kernel"
- modprobe dummy &>$LTPTMP/tst_ip.out || RC=$?
+ modprobe dummy >$LTPTMP/tst_ip.out 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brk TBROK $LTPTMP/tst_ip.out NULL \
@@ -240,7 +240,7 @@ test02()
return $RC
fi
- ip link show dummy0 | grep dummy0 &>$LTPTMP/tst_ip.err || RC=$?
+ ip link show dummy0 | grep dummy0 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err "Test #2: ip command failed. Reason:"
@@ -278,7 +278,7 @@ test03()
tst_resm TINFO \
"Test #3: ip addr add - adds a new protolcol address to the device"
- ip addr add 127.6.6.6 dev lo &>$LTPTMP/tst_ip.err || RC=$?
+ ip addr add 127.6.6.6 dev lo >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -287,7 +287,7 @@ test03()
else
tst_resm TINFO \
"Test #3: ip addr show dev <device> - shows protocol address."
- ip addr show dev lo | grep 127.6.6.6 &>$LTPTMP/tst_ip.err || RC=$?
+ ip addr show dev lo | grep 127.6.6.6 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -297,14 +297,14 @@ test03()
tst_resm TINFO \
"Test #3: ip addr del <ip> dev <device> - deletes protocol address."
- ip addr del 127.6.6.6 dev lo &>$LTPTMP/tst_ip.err || RC=$?
+ ip addr del 127.6.6.6 dev lo >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
"Test #3: ip addr del command failed. Reason: "
return $RC
else
- ip addr show dev lo | grep 127.6.6.6 &>$LTPTMP/tst_ip.err || RC=$?
+ ip addr show dev lo | grep 127.6.6.6 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -eq 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -343,7 +343,7 @@ test04()
tst_resm TINFO \
"Test #4: ip neigh add - adds a new neighbour to arp tables."
- ip neigh add 127.0.0.1 dev lo nud reachable &>$LTPTMP/tst_ip.err || RC=$?
+ ip neigh add 127.0.0.1 dev lo nud reachable >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -357,7 +357,7 @@ test04()
127.0.0.1 dev lo lladdr 00:00:00:00:00:00 nud reachable
EOF
- ip neigh show 127.0.0.1 | head -n1 &>$LTPTMP/tst_ip.out || RC=$?
+ ip neigh show 127.0.0.1 | head -n1 >$LTPTMP/tst_ip.out 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -365,7 +365,7 @@ test04()
return $RC
else
diff -iwB $LTPTMP/tst_ip.out $LTPTMP/tst_ip.exp \
- &>$LTPTMP/tst_ip.err || RC=$?
+ >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res FAIL $LTPTMP/tst_ip.err \
@@ -377,14 +377,14 @@ test04()
tst_resm TINFO \
"Test #4: ip neigh del - deletes neighbour from the arp table."
- ip neigh del 127.0.0.1 dev lo &>$LTPTMP/tst_ip.err || RC=$?
+ ip neigh del 127.0.0.1 dev lo >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
"Test #4: ip neigh del command failed return = $RC. Reason: "
return $RC
else
- ip neigh show | grep 127.0.0.1 grep -v "nud failed$" &>$LTPTMP/tst_ip.err || RC=$?
+ ip neigh show | grep 127.0.0.1 grep -v "nud failed$" >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -eq 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -426,7 +426,7 @@ test05()
tst_resm TINFO \
"Test #5: create an interface with inet 10.6.6.6 alias to eth0"
- ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 &>$LTPTMP/tst_ip.err || RC=$?
+ ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brk TBROK $LTPTMP/tst_ip.err NULL \
@@ -434,7 +434,7 @@ test05()
return $RC
fi
- ip route add 10.6.6.6 via 127.0.0.1 &>$LTPTMP/tst_ip.err || RC=$?
+ ip route add 10.6.6.6 via 127.0.0.1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -449,7 +449,7 @@ test05()
10.6.6.6 via 127.0.0.1 dev lo
EOF
- ip route show | head -n1 &>$LTPTMP/tst_ip.out || RC=$?
+ ip route show | head -n1 >$LTPTMP/tst_ip.out 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -457,7 +457,7 @@ test05()
return $RC
else
diff -iwB $LTPTMP/tst_ip.out $LTPTMP/tst_ip.exp \
- &>$LTPTMP/tst_ip.err || RC=$?
+ >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res FAIL $LTPTMP/tst_ip.err \
@@ -469,14 +469,14 @@ test05()
tst_resm TINFO \
"Test #5: ip route del - deletes route from the route table."
- ip route del 10.6.6.6 via 127.0.0.1 &>$LTPTMP/tst_ip.err || RC=$?
+ ip route del 10.6.6.6 via 127.0.0.1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
"Test #5: ip route del command failed return = $RC. Reason: "
return $RC
else
- ip route show | grep 127.0.0.1 &>$LTPTMP/tst_ip.err || RC=$?
+ ip route show | grep 127.0.0.1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -eq 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -514,7 +514,7 @@ test06()
tst_resm TINFO \
"Test #6: ip maddr add - adds a new multicast addr"
- ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 &>$LTPTMP/tst_ip.err || RC=$?
+ ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_brk TBROK $LTPTMP/tst_ip.err NULL \
@@ -522,7 +522,7 @@ test06()
return $RC
fi
- ip maddr add 66:66:00:00:00:66 dev eth0:1 &>$LTPTMP/tst_ip.err || RC=$?
+ ip maddr add 66:66:00:00:00:66 dev eth0:1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -536,7 +536,7 @@ test06()
link 66:66:00:00:00:66 static
EOF
- ip maddr show | grep "66:66:00:00:00:66" &>$LTPTMP/tst_ip.out || RC=$?
+ ip maddr show | grep "66:66:00:00:00:66" >$LTPTMP/tst_ip.out 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
@@ -556,7 +556,7 @@ test06()
tst_resm TINFO \
"Test #6: ip maddr del - deletes multicast addr."
- ip maddr del 66:66:00:00:00:66 dev eth0:1 &>$LTPTMP/tst_ip.err || RC=$?
+ ip maddr del 66:66:00:00:00:66 dev eth0:1 >$LTPTMP/tst_ip.err 2>&1 || RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_ip.err \
diff --git a/testcases/network/nfs/nfs03/nfs03 b/testcases/network/nfs/nfs03/nfs03
index 8cbd3a4..f4fc6ee 100755
--- a/testcases/network/nfs/nfs03/nfs03
+++ b/testcases/network/nfs/nfs03/nfs03
@@ -91,10 +91,10 @@ fs_inod()
#
# RETURNS: None.
#=============================================================================
-function err_log
+err_log()
{
error "$1"
- let step_errors="$step_errors + 1"
+ step_errors=$(($step_errors + 1))
}
@@ -107,7 +107,7 @@ function err_log
#
# RETURNS: None.
#=============================================================================
-function make_subdirs
+make_subdirs()
{
i=0;
while [ "$i" -lt "$numsubdirs" ]; do
@@ -115,7 +115,7 @@ function make_subdirs
echo "$0: mkdir dir$i"
mkdir -p dir$i || echo "mkdir dir$i FAILED"
}
- let i="$i + 1"
+ i=$(($i + 1))
done;
}
@@ -129,7 +129,7 @@ function make_subdirs
#
# RETURNS: None.
#=============================================================================
-function touch_files
+touch_files()
{
echo "$0: touch files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
j=0;
@@ -140,10 +140,10 @@ function touch_files
while [ "$k" -lt "$numfiles" ]; do
>file$j$k || err_log ">file$j$k FAILED"
- let k="$k + 1"
+ k=$(($k + 1))
done
- let j="$j + 1"
+ j=$(($j + 1))
cd ..
done
}
@@ -158,7 +158,7 @@ function touch_files
#
# RETURNS: None.
#=============================================================================
-function rm_files
+rm_files()
{
echo "$0: rm files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
j=0;
@@ -169,10 +169,10 @@ function rm_files
while [ "$k" -lt "$numfiles" ]; do
rm -f file$j$k || err_log "rm -f file$j$k FAILED"
- let k="$k + 1"
+ k=$(($k + 1))
done
- let j="$j + 1"
+ j=$(($j + 1))
cd ..
done
}
@@ -187,7 +187,7 @@ function rm_files
#
# RETURNS: None.
#=============================================================================
-function step1
+step1()
{
echo "=============================================="
echo "MULTIPLE PROCESSES CREATING AND DELETING FILES"
@@ -240,7 +240,7 @@ function step1
rm_files &
pid2=$!
- let i="$i + 1"
+ i=$(($i + 1))
done
# wait for all background processes to complete execution
@@ -376,7 +376,7 @@ $trace_logic
echo "fs_inod starting on $TCtmp."
fs_inod $TCtmp $DIR_NUM $FILE_NUM 1
retval=$?
- echo $"fs_inod on $TCtmp finished."
+ echo "fs_inod on $TCtmp finished."
if [ "$retval" != 0 ]; then
end_testcase "Errors have resulted from this test: fs_inod returned $retval."
--
1.6.3.1
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 28+ messages in thread
end of thread, other threads:[~2009-11-01 0:24 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-07 8:35 [LTP] [PATCH] Fix some bashisms Jiri Palecek
2009-07-07 15:32 ` Subrata Modak
2009-07-07 16:26 ` Garrett Cooper
2009-07-08 19:05 ` Mike Frysinger
2009-07-08 18:13 ` Subrata Modak
[not found] <200910211528.n9LFST8q028289@e35.co.us.ibm.com>
2009-10-26 17:02 ` Subrata Modak
2009-10-26 19:37 ` Garrett Cooper
2009-10-29 18:12 ` JiříPaleček
2009-10-30 11:37 ` Subrata Modak
2009-10-30 12:53 ` Jiří Paleček
2009-10-30 12:19 ` Subrata Modak
2009-10-31 6:39 ` Garrett Cooper
2009-10-31 11:42 ` Jiří Paleček
2009-11-01 0:15 ` Garrett Cooper
[not found] <4adf2acd.8b13f30a.0849.7847SMTPIN_ADDED@mx.google.com>
2009-10-21 19:38 ` Mike Frysinger
-- strict thread matches above, loose matches on Subject: below --
2009-10-21 0:19 Jiri Palecek
[not found] <4a413e9b.160bca0a.2226.fffff184SMTPIN_ADDED@mx.google.com>
2009-07-06 17:45 ` Garrett Cooper
2009-07-06 22:02 ` Mike Frysinger
2009-07-06 22:47 ` Jiri Palecek
2009-07-06 23:33 ` Garrett Cooper
2009-07-07 0:16 ` Jiří Paleček
2009-07-07 0:31 ` Garrett Cooper
2009-07-07 10:29 ` Jiří Paleček
[not found] <4a413e95.8d13f30a.1199.ffffdccbSMTPIN_ADDED@mx.google.com>
2009-06-23 21:21 ` Mike Frysinger
2009-06-25 9:09 ` Subrata Modak
2009-06-30 7:41 ` Subrata Modak
2009-07-06 23:12 ` Jiri Palecek
2009-05-31 21:27 Jiri Palecek >
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox