netns: Report version of iproute2 tools in ver_linux
PATCH 1/4 netns: Report version of iproute2 tools in ver_linux
Report the version of the ip route tools in ver_linux with ip -V. The version is important to the netns testcases for example. Since it would be useful for other testcases add it to the ver_linux script.
--- ver_linux | 3 +++ 1 file changed, 3 insertions(+)
ver_linux +3 -0
@@ -62,6 +62,9 @@ ps --version 2>&1 | awk 'NR==1{print "Pr ifconfig --version 2>&1 | grep tools | awk \ 'NR==1{print "Net-tools ", $NF}' +ip -V 2>&1 | awk \ +'NR==1{print "iproute2 ", $NF}' + # Kbd needs 'loadkeys -h', loadkeys -h 2>&1 | awk \ '(NR==1 && ($3 !~ /option/)) {print "Kbd ", $3}'
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH 2/4 netns: Add ip tools check to netns tests.
Use ip -V to exclude the network namespace testcases since they require version ("snapshot") ss080725 or higher to set the network namespace of interfaces used for testing.
--- testcases/kernel/containers/netns/runnetnstest.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
testcases/kernel/containers/netns/runnetnstest.sh +21 -0
@@ -24,6 +24,27 @@ rc=0 exit_code=0 + +# Check the iproute2 version (aka "SnapShot") +IPROUTEV=`ip -V | cut -d ',' -f 2 | cut -d '-' -f 2 | sed -e 's/^ss//'` + +# We need to strip leading 0s else bash thinks we're giving it octal numbers. +IPROUTEY=$(echo ${IPROUTEV:0:2} | sed -e 's/^0\+//') # Year +IPROUTEM=$(echo ${IPROUTEV:2:2} | sed -e 's/^0\+//') # Month +IPROUTED=$(echo ${IPROUTEV:4:2} | sed -e 's/^0\+//') # Day + +V=$((${IPROUTEY}*12*32 + ${IPROUTEM}*32 + ${IPROUTED})) + +# +# iproute-ss080725 and later support setting the network namespace of an +# interface. +# +NETNSV=$((8*12*32 + 7*32 + 25)) +if [ ${V} -lt ${NETNSV} ]; then + echo "INFO: iproute tools do not support setting network namespaces. Skipping network namespace tests." + exit $exit_code +fi + crtchild rc=$? if [ $rc -ne 0 ]; then
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH 3/4 netns: Fixup non-sh syntax
In reply to Matt HelsleyFixup some non-sh syntax which seems to trigger problems on my fedora 10 KVM image.
--- testcases/kernel/containers/netns/parentns.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/containers/netns/parentns.sh +1 -1
@@ -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
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH 4/4 netns: Change interpretters from sh to bash
In reply to Matt HelsleyAs best I can tell these tests do not use true sh syntax -- they use bash syntax. Rather than bother hunting down all the bash-isms just convert them to use bash as their interpretter.
Also found with my fedora 10 KVM image.
--- testcases/kernel/containers/netns/ch_ftp.sh | 2 +- testcases/kernel/containers/netns/child.sh | 2 +- testcases/kernel/containers/netns/child_1.sh | 2 +- testcases/kernel/containers/netns/child_2.sh | 2 +- testcases/kernel/containers/netns/child_propagate.sh | 2 +- testcases/kernel/containers/netns/childipv6.sh | 2 +- testcases/kernel/containers/netns/childns.sh | 2 +- testcases/kernel/containers/netns/delchild.sh | 2 +- testcases/kernel/containers/netns/initialize.sh | 2 +- 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/parent_share.sh | 2 +- testcases/kernel/containers/netns/parent_view.sh | 2 +- testcases/kernel/containers/netns/parentns.sh | 2 +- testcases/kernel/containers/netns/paripv6.sh | 2 +- testcases/kernel/containers/netns/rename_net.sh | 8 ++++---- testcases/kernel/containers/netns/runnetnstest.sh | 2 +- 19 files changed, 22 insertions(+), 22 deletions(-)
testcases/kernel/containers/netns/rename_net.sh +4 -4
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ##
@@ -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 [ $? -eq 0 ] ; then tst_resm TINFO "Successfully Renamed device to $newdev" - if [ DEBUG == 1 ]; then + if [ DEBUG -eq 1 ]; then ifconfig fi else
@@ -56,7 +56,7 @@ export TST_TOTAL status=-1 fi - if [ $status == 0 ] ; then + if [ $status -eq 0 ] ; then echo $sshpid > /tmp/FIFO3 echo $newdev > /tmp/FIFO4 else
testcases/kernel/containers/netns/runnetnstest.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ##
testcases/kernel/containers/netns/ch_ftp.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ## ## Copyright (c) International Business Machines Corp., 2008 ##
testcases/kernel/containers/netns/child.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ##
testcases/kernel/containers/netns/child_1.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ## ## Copyright (c) International Business Machines Corp., 2008 ##
testcases/kernel/containers/netns/child_2.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ##
testcases/kernel/containers/netns/child_propagate.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ##
testcases/kernel/containers/netns/childipv6.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ##
testcases/kernel/containers/netns/childns.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ##
testcases/kernel/containers/netns/delchild.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ##
testcases/kernel/containers/netns/initialize.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ##
testcases/kernel/containers/netns/par_ftp.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ##
testcases/kernel/containers/netns/parent.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ##
testcases/kernel/containers/netns/parent_1.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ##
testcases/kernel/containers/netns/parent_2.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ##
testcases/kernel/containers/netns/parent_share.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ##
testcases/kernel/containers/netns/parent_view.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ##
testcases/kernel/containers/netns/parentns.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ##
testcases/kernel/containers/netns/paripv6.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ################################################################################ ## ##
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH 4/4] netns: Change interpretters from sh to bash
Quoted 3 lines · On Thursday 02 July 2009 05:05:32 Matt Helsley wrote:
As best I can tell these tests do not use true sh syntax -- they use bash syntax. Rather than bother hunting down all the bash-isms just convert them to use bash as their interpretter.
the changelog doesnt seem to jive with the commit. if you were merely changing the shebang, why did you also fix the bashisms like s/==/-eq/ ?
at any rate, someone (i dont recall who) posted fixes to these files recently to de-bashify them. there was some feedback though, so perhaps you should address those minor issues and submit an updated patch.
in general, converting sh to bash is a bad idea as it can cause issues for us embedded peeps.
-mike
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH 4/4] netns: Change interpretters from sh to bash
Quoted 7 lines · Mike Frysinger
Quoted 3 lines · On Thursday 02 July 2009 05:05:32 Matt Helsley wrote:
As best I can tell these tests do not use true sh syntax -- they use bash syntax. Rather than bother hunting down all the bash-isms just convert them to use bash as their interpretter.
the changelog doesnt seem to jive with the commit. if you were merely changing the shebang, why did you also fix the bashisms like s/==/-eq/ ?
Good point -- it does make the == -> -eq and the || -> -o conversions pointless.
Quoted 4 lines
at any rate, someone (i dont recall who) posted fixes to these files recently to de-bashify them. there was some feedback though, so perhaps you should address those minor issues and submit an updated patch.
OK, I'll look for that patch and consider it as a replacement for 3 and 4 of this series.
Quoted 4 lines
in general, converting sh to bash is a bad idea as it can cause issues for us embedded peeps.
-mike
I suppose that's because of the memory bash consumes. Is there anything else it does which is bad for embedded?
Cheers,
-Matt Helsley
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH 4/4] netns: Change interpretters from sh to bash
Quoted 6 lines · On Thursday 02 July 2009 16:32:53 Matt Helsley wrote:
Quoted 2 lines · Mike Frysinger
in general, converting sh to bash is a bad idea as it can cause issues for us embedded peeps.
I suppose that's because of the memory bash consumes. Is there anything else it does which is bad for embedded?
there is memory and disk usage concerns, but there are also systems that cant run bash at all (e.g. systems without fork() -- all no-mmu Linux ports) -mike
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH 3/4] netns: Fixup non-sh syntax
In reply to Matt HelsleyQuoted 19 lines · Matt Helsley
Fixup some non-sh syntax which seems to trigger problems on my fedora 10 KVM image.
Signed-off-by Matt Helsley <[email protected]>Cc Daniel Lezcano <[email protected]>Cc Poornima Nayak <[email protected]>Cc Sudhir Kumar <[email protected]>Cc Veerendra C <[email protected]>Cc Munipradeep <[email protected]>---
testcases/kernel/containers/netns/parentns.sh | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)Index:
ltp/testcases/kernel/containers/netns/parentns.sh
===================================================================testcases/kernel/containers/netns/parentns.sh +0
-0@@ -56,7 +56,7 @@ status=0
Quoted 8 lines
create_veth
vnet0=$dev0
vnet1=$dev1
- if [[ -z $vnet0 || -z $vnet1 ]] ; then
+ if [ -z $vnet0 -o -z $vnet1 ] ; then
tst_resmTFAIL "Error: unable to create veth pair" exit -1
else
While you're there, could you please quote "$vnet0"? Thanks,
-Garrett
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 5 lines · Matt Helsley
Report the version of the ip route tools in
ver_linuxwith ip -V. The version is important to the netns testcases for example. Since it would be useful for other testcases add it to thever_linuxscript.Signed-off-by Matt Helsley <[email protected]>
Thanks Matt.
Regards--
Subrata
Quoted 16 lines
Cc Daniel Lezcano <[email protected]>Cc Poornima Nayak <[email protected]>Cc Sudhir Kumar <[email protected]>Cc Veerendra C <[email protected]>Cc Munipradeep <[email protected]>--- ver_linux | 3 +++ 1 file changed, 3 insertions(+)Index: ltp/ver_linux
===================================================================
ver_linux ps --version 2>&1 | awk 'NR==1{print "Pr · line 70
Quoted 9 lines
ver_linux +3
-0@@ -62,6 +62,9 @@ ps --version 2>&1 | awk 'NR==1{print "Pr ifconfig --version 2>&1 | grep tools | awk \ 'NR==1{print "Net-tools ", $NF}' +ip -V 2>&1 | awk \ +'NR==1{print "iproute2 ", $NF}' + # Kbd needs 'loadkeys -h', loadkeys -h 2>&1 | awk \ '(NR==1 && ($3 !~ /option/)) {print "Kbd ", $3}'
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH 4/4] netns: Change interpretters from sh to bash
In reply to Matt HelsleyQuoted 13 lines · Matt Helsley
Quoted 7 lines · Mike Frysinger
Quoted 3 lines · On Thursday 02 July 2009 05:05:32 Matt Helsley wrote:
As best I can tell these tests do not use true sh syntax -- they use bash syntax. Rather than bother hunting down all the bash-isms just convert them to use bash as their interpretter.
the changelog doesnt seem to jive with the commit. if you were merely changing the shebang, why did you also fix the bashisms like s/==/-eq/ ?
Good point -- it does make the == -> -eq and the || -> -o conversions pointless.
Quoted 1 line
Quoted 6 lines
Quoted 3 lines
at any rate, someone (i dont recall who) posted fixes to these files recently to de-bashify them. there was some feedback though, so perhaps you should address those minor issues and submit an updated patch.
OK, I'll look for that patch and consider it as a replacement for 3 and 4 of this series.
Will wait for this from you.
Regards--
Subrata
Quoted 11 lines
Quoted 5 lines
in general, converting sh to bash is a bad idea as it can cause issues for us embedded peeps.
-mikeI suppose that's because of the memory bash consumes. Is there anything else it does which is bad for embedded?
Cheers,
-Matt Helsley
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH 2/4] netns: Add ip tools check to netns tests.
In reply to Matt HelsleyQuoted 5 lines · Matt Helsley
Use ip -V to exclude the network namespace testcases since they require version ("snapshot") ss080725 or higher to set the network namespace of interfaces used for testing.
Signed-off-by Matt Helsley <[email protected]>
Thanks for this as well.
Regards--
Subrata
Quoted 34 lines
Signed-off-by Sachin P. Sant <[email protected]>Cc Daniel Lezcano <[email protected]>Cc Poornima Nayak <[email protected]>Cc Sudhir Kumar <[email protected]>Cc Veerendra C <[email protected]>Cc Munipradeep <[email protected]>--- testcases/kernel/containers/netns/runnetnstest.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)Index:
ltp/testcases/kernel/containers/netns/runnetnstest.sh
===================================================================testcases/kernel/containers/netns/runnetnstest.sh +14
-0@@ -24,6 +24,27 @@ rc=0 exit_code=0 + +# Check the iproute2 version (aka "SnapShot") +IPROUTEV=`ip -V | cut -d ',' -f 2 | cut -d '-' -f 2 | sed -e 's/^ss//'` + +# We need to strip leading 0s else bash thinks we're giving it octal numbers. +IPROUTEY=$(echo ${IPROUTEV:0:2} | sed -e 's/^0\+//') # Year +IPROUTEM=$(echo ${IPROUTEV:2:2} | sed -e 's/^0\+//') # Month +IPROUTED=$(echo ${IPROUTEV:4:2} | sed -e 's/^0\+//') # Day + +V=$((${IPROUTEY}*12*32 + ${IPROUTEM}*32 + ${IPROUTED})) + +# +# iproute-ss080725 and later support setting the network namespace of an +# interface.
testcases/kernel/containers/netns/runnetnstest.sh line 50
Quoted 10 lines
testcases/kernel/containers/netns/runnetnstest.sh +7
-0+# +NETNSV=$((8*12*32 + 7*32 + 25)) +if [ ${V} -lt ${NETNSV} ]; then + echo "INFO: iproute tools do not support setting network namespaces. Skipping network namespace tests." + exit $exit_code +fi + crtchild rc=$? if [ $rc -ne 0 ]; then
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH 1/1 Remove bashisms (WAS Re: [PATCH 4/4] netns: Change interpretters from sh to bash)
In reply to Mike FrysingerQuoted 11 lines · Mike Frysinger
Quoted 6 lines · On Thursday 02 July 2009 16:32:53 Matt Helsley wrote:
Quoted 2 lines · Mike Frysinger
in general, converting sh to bash is a bad idea as it can cause issues for us embedded peeps.
I suppose that's because of the memory bash consumes. Is there anything else it does which is bad for embedded?
there is memory and disk usage concerns, but there are also systems that cant run bash at all (e.g. systems without
fork()-- all no-mmu Linux ports) -mike
Here's that updated patch which hopefully should be able to replace 3 and 4 of my recent series. Unfortunately I haven't had a chance to test it so I'm posting it in case someone else does. As the original author of the patch Jiri is welcome to add his signoff as well.
From: Jiri Palecek <[email protected]>
This patch removes a bunch of bashisms.
It was originally written by Jiri Palecek but lacked changes requested by Mike Frysinger.
---
v2:
Fix pushd/popd removal to save PWD and restore it using a regular
variable.
Remove empty echoes in favor of printf.
Remove non-bashism "kill -s KILL ..." and keep "kill -9 ..."
If this is still a problem then it could be placed in a separate patch.
Keep the exact formatting in cron0X tests -- use printf instead of echo. Use non-greedy expansion of tty device in ioctl test. Change the increment syntax to use : $(( X += 1 )) instead of:
X=$((X + 1))
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/commands/unzip/unzip_tests.sh | 7 +- 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 | 6 +- 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, 130 insertions(+), 126 deletions(-)
runalltests.sh +29 -29
@@ -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_VERSIO ## 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" + echo "Completed running Ballista"; echo; echo 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" + echo "Completed running Open Posix Tests"; echo; echo 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" + echo "Completed running ltp/testcases/kernel/mem/libmm/mm_core_apis..."; echo; echo 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" + echo "Completed running ltp/testcases/kernel/io/aio..."; echo; echo 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" + echo "Completed running ltp/testcases/kernel/io/aio..."; echo; echo fi fi ## END => Test Series 6 ##
testcases/commands/cron/cron02 +2 -2
@@ -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" if [ $tvar != "redhat" -a $tvar != "redhat-linux" ]; then
testcases/commands/cron/cron03 +1 -1
@@ -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" if [ $tvar != "redhat" -a $tvar != "redhat-linux" ]; then
testcases/commands/cron/cron_allow01 +5 -5
@@ -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 } #-----------------------------------------------------------------------
testcases/commands/cron/cron_deny01 +7 -7
@@ -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 } #-----------------------------------------------------------------------
testcases/commands/su/su01 +9 -9
@@ -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_FIL 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 } #-----------------------------------------------------------------------
testcases/commands/unzip/unzip_tests.sh +5 -2
@@ -52,6 +52,8 @@ chk_ifexists() return $RC } +# Save the directory we were invoked from +export INITIAL_DIR=$PWD # Function: cleanup #
@@ -61,7 +63,8 @@ chk_ifexists() # - non-zero on failure. cleanup() { - popd + # Restore initial directory before removing LTPTMP (which was PWD) + cd $INITIAL_DIR # remove all the temporary files created by this test. tst_resm TINFO "CLEAN: removing \"$LTPTMP\"" rm -fr "$LTPTMP"
@@ -89,7 +92,7 @@ init() # create the temporary directory used by this testcase LTPTMP=`mktemp -d $$.XXXXXX` || tst_resm TBROK "Unable to create temporary directory with: mktemp -d $$.XXXXXX" trap "cleanup" 0 - pushd "$LTPTMP" + cd "$LTPTMP" # check if commands tst_*, unzip, awk, etc exists. chk_ifexists INIT tst_resm || return $RC
testcases/kernel/containers/netns/child.sh +1 -1
@@ -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
testcases/kernel/containers/netns/child_1.sh +1 -1
@@ -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
testcases/kernel/containers/netns/childipv6.sh +2 -2
@@ -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"
testcases/kernel/containers/netns/childns.sh +2 -2
@@ -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
testcases/kernel/containers/netns/delchild.sh +3 -3
@@ -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
@@ -56,11 +56,11 @@ export TST_TOTAL 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"
testcases/kernel/containers/netns/par_ftp.sh +1 -1
@@ -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"
testcases/kernel/containers/netns/parent.sh +1 -1
@@ -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
testcases/kernel/containers/netns/parent_1.sh +1 -1
@@ -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
testcases/kernel/containers/netns/parent_2.sh +1 -1
@@ -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
testcases/kernel/containers/netns/parentns.sh +2 -2
@@ -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
testcases/kernel/containers/netns/paripv6.sh +2 -2
@@ -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
testcases/kernel/containers/netns/rename_net.sh +3 -3
@@ -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
testcases/kernel/syscalls/ioctl/test_ioctl +2 -2
@@ -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"
testcases/misc/tcore_patch_test_suites/tcore.sh +6 -5
@@ -92,13 +92,13 @@ Test_gen_core() rm -f core.* fi pid=`$TEST_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
@@ -109,14 +109,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 ./tcore.exp >/dev/null 2>&1 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
@@ -127,3 +127,4 @@ exit $fail +
testcases/network/iproute/ip_tests.sh +31 -31
243 lines not on this page · raw message
testcases/network/nfs/nfs03/nfs03 +13 -13
@@ -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."
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH] Remove bashisms (WAS Re: [PATCH 4/4] netns: Change interpretters from sh to bash)
Quoted 18 lines · Matt Helsley
Quoted 11 lines · Mike Frysinger
Quoted 6 lines · On Thursday 02 July 2009 16:32:53 Matt Helsley wrote:
Quoted 2 lines · Mike Frysinger
in general, converting sh to bash is a bad idea as it can cause issues for us embedded peeps.
I suppose that's because of the memory bash consumes. Is there anything else it does which is bad for embedded?
there is memory and disk usage concerns, but there are also systems that cant run bash at all (e.g. systems without
fork()-- all no-mmu Linux ports) -mikeHere's that updated patch which hopefully should be able to replace 3 and 4 of my recent series. Unfortunately I haven't had a chance to test it so I'm posting it in case someone else does. As the original author of the patch Jiri is welcome to add his signoff as well.
Quoted 8 lines
From: Jiri Palecek <[email protected]>
This patch removes a bunch of bashisms.
It was originally written by Jiri Palecek but lacked changes requested by Mike Frysinger.
Signed-off-by Matt Helsley <[email protected]>
Hi Matt,
Please see the comments I just made to his first diff submitted
back in May 25th. Many of the comments I made there apply to this change as well.
Thanks,
-Garrett
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH] Remove bashisms (WAS Re: [PATCH 4/4] netns: Change interpretters from sh to bash)
In reply to Matt HelsleyHi
Quoted 16 lines · Matt Helsley
Quoted 6 lines · Mike Frysinger
Quoted 2 lines · On Thursday 02 July 2009 16:32:53 Matt Helsley wrote:
Quoted 1 line · Mike Frysinger
in general, converting sh to bash is a bad idea as it can cause
issues
Quoted 2 lines
Quoted 1 line
for us embedded peeps.
Quoted 8 lines
Quoted 1 line
I suppose that's because of the memory bash consumes. Is there
anything
Quoted 1 line
else it does which is bad for embedded?
there is memory and disk usage concerns, but there are also systems that cant
run bash at all (e.g. systems withoutfork()-- all no-mmu Linux ports) -mike
Quoted 5 lines
Here's that updated patch which hopefully should be able to replace 3 and 4 of my recent series. Unfortunately I haven't had a chance to test it so
I'm posting it in case someone else does. As the original author of the patch Jiri is welcome to add his signoff as well.
Thanks for doing this. I have some comments to the patch, see below.
I have made my "version 2" of the patch too, containing also changes to other files (like runpwtest.sh). If you're interreseted, I'll send it.
Quoted 7 lines
From: Jiri Palecek <[email protected]>
This patch removes a bunch of bashisms.
It was originally written by Jiri Palecek but lacked changes requested by Mike Frysinger.
Quoted 6 lines
Signed-off-by Matt Helsley <[email protected]>---
v2:
Fix pushd/popd removal to save PWD and restore it using a regular
variable.
I wonder if this couldn't be done by a simple "cd -", or even left out completely.
Quoted 1 line
Remove empty echoes in favor of printf.
This hasn't been done thoroughly (some empty echoes remain in the patch). Also, the patch misses one thing, that if you use printf, you have to add an extra linefeed at the end, ie:
echo -e "foo\n"
has to be replaced by
printf "foo\n\n"
for it to work equivalently.
Quoted 7 lines
Remove non-bashism "kill -s KILL ..." and keep "kill -9 ..."
If this is still a problem then it could be placed in a separate patch.
Keep the exact formatting in cron0X tests -- use printf instead of echo. Use non-greedy expansion of tty device in ioctl test. Change the increment syntax to use : $(( X += 1 )) instead of:
X=$((X + 1))
I changed this to (IMHO cooler syntax, it's for the sake of aesthetics after all) ": $((X++))" in my patch.
Regards
Jiri Palecek
Quoted 999 lines
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/commands/unzip/unzip_tests.sh | 7 +- 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 | 6 +- 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, 130 insertions(+), 126 deletions(-)Index:
ltp/runalltests.sh
===================================================================runalltests.sh +0
-1@@ -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 "**
**"runalltests.sh +6
-0+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=0runalltests.sh +3
-3@@ -210,19 +210,19 @@ export HTML_OUTPUT_FILE_NAME=$LTP_VERSIO ## 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
runalltests.sh +3
-4- echo -e "Completed running Ballista\n\n" + echo "Completed running Ballista"; echo; echo 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" + echo "Completed running Open Posix Tests"; echo; echo 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..."
runalltests.sh +2
-1+ 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 runmem/libmm/mm_core_apis
echo Aborting ltp/testcases/kernel/mem/libmm/mm_core_apisrunalltests.sh +0
-1@@ -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..."
runalltests.sh +1
-1+ 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 runningltp/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 ##runalltests.sh +2
-2@@ -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 runltp/testcases/kernel/io/aio
echo Aborting ltp/testcases/kernel/io/aiorunalltests.sh +2
-2@@ -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" + echo "Completed running ltp/testcases/kernel/io/aio..."; echo;echo
fi
fi
## END => Test Series 5 ##runalltests.sh +2
-2@@ -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 runltp/testcases/kernel/security/filecaps
echo Aborting ltp/testcases/kernel/security/filecapsrunalltests.sh +0
-1@@ -336,11 +336,11 @@ then else echo libcaps already installed in your system fi - echo -e "Building & Runningltp/testcases/kernel/security/filecaps"
runalltests.sh +2
-1+ 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 ##
Index: ltp/testcases/commands/cron/cron02
===================================================================testcases/commands/cron/cron02 +1
-1@@ -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 RedHat/SuSE/Other
tvar=${MACHTYPE%-*}
tvar=${tvar#*-}testcases/commands/cron/cron02 +1
-1-echo "Distro type is: $tvar \n" +printf "Distro type is: $tvar \n"if [ $tvar != "redhat" -a $tvar != "redhat-linux" ]; then
Index: ltp/testcases/commands/cron/cron03
===================================================================testcases/commands/cron/cron03 +0
-0@@ -59,7 +59,7 @@ do_setup(){ # Red Hat uses crond, SuSE/Other uses cron. Check if this is RedHat/SuSE/Other
tvar=${MACHTYPE%-*}
tvar=${tvar#*-}testcases/commands/cron/cron03 +1
-1-echo "Distro type is: $tvar \n" +printf "Distro type is: $tvar \n"if [ $tvar != "redhat" -a $tvar != "redhat-linux" ]; then
Index: ltp/testcases/commands/cron/cron_allow01
===================================================================testcases/commands/cron/cron_allow01 +5
-5@@ -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 } #-----------------------------------------------------------------------Index: ltp/testcases/commands/cron/cron_deny01
===================================================================testcases/commands/cron/cron_deny01 +7
-7@@ -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 } #-----------------------------------------------------------------------Index: ltp/testcases/commands/su/su01
===================================================================testcases/commands/su/su01 +1
-1@@ -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 forTEST_USER2testcases/commands/su/su01 +4
-4@@ -76,9 +76,9 @@ export TEST_ENV_FILE2="/tmp/TEST_ENV_FIL 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/null2>&1
if [ $? != 0 ] then { echo "Could not set password for test user $TEST_USER1"testcases/commands/su/su01 +1
-1@@ -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/null2>&1
if [ $? != 0 ] then { echo "Could not set password for test user $TEST_USER2"testcases/commands/su/su01 +3
-3@@ -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 } #-----------------------------------------------------------------------Index:
ltp/testcases/commands/unzip/unzip_tests.sh
===================================================================testcases/commands/unzip/unzip_tests.sh +4
-1@@ -52,6 +52,8 @@ chk_ifexists() return $RC } +# Save the directory we were invoked from +export INITIAL_DIR=$PWD # Function: cleanup #@@ -61,7 +63,8 @@ chk_ifexists() # - non-zero on failure. cleanup() { - popd + # Restore initial directory before removing LTPTMP (which was PWD) + cd $INITIAL_DIR # remove all the temporary files created by this test. tst_resm TINFO "CLEAN: removing \"$LTPTMP\"" rm -fr "$LTPTMP"@@ -89,7 +92,7 @@ init() # create the temporary directory used by this testcase LTPTMP=`mktemp -d $$.XXXXXX` || tst_resm TBROK "Unable to createtemporary directory with: mktemp -d $$.XXXXXX"
testcases/commands/unzip/unzip_tests.sh +1
-1trap "cleanup" 0 - pushd "$LTPTMP" + cd "$LTPTMP"# check if commands tst_*, unzip, awk, etc exists. chk_ifexists INIT tst_resm || return $RC Index: ltp/testcases/kernel/containers/netns/child.sh ===================================================================testcases/kernel/containers/netns/child.sh +1
-1@@ -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 elseIndex:
ltp/testcases/kernel/containers/netns/child_1.sh
===================================================================testcases/kernel/containers/netns/child_1.sh +1
-1@@ -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 !" elseIndex:
ltp/testcases/kernel/containers/netns/childipv6.sh
===================================================================testcases/kernel/containers/netns/childipv6.sh +1
-1@@ -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 ; exit0} ' `
elsetestcases/kernel/containers/netns/childipv6.sh +1
-1@@ -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"Index:
ltp/testcases/kernel/containers/netns/childns.sh
===================================================================testcases/kernel/containers/netns/childns.sh +1
-1@@ -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"
fitestcases/kernel/containers/netns/childns.sh +1
-1@@ -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 ; exit0} ' `
else
Index:ltp/testcases/kernel/containers/netns/delchild.sh
===================================================================testcases/kernel/containers/netns/delchild.sh +2
-2@@ -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@@ -56,11 +56,11 @@ export TST_TOTAL 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 afterdeleting the child"
else
grep -qw $newnet/tmp/sys_aftr_child_killedtestcases/kernel/containers/netns/delchild.sh +1
-1- if [ $? == 0 ]; then + if [ $? = 0 ]; then debug "INFO: Device $newnet is moved to ParentNS" else debug "INFO: Device $newnet is moved under diff name inParentNS"
Index:ltp/testcases/kernel/containers/netns/par_ftp.sh
===================================================================testcases/kernel/containers/netns/par_ftp.sh +1
-1@@ -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"Index:
ltp/testcases/kernel/containers/netns/parent.sh
===================================================================testcases/kernel/containers/netns/parent.sh +1
-1@@ -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 elseIndex:
ltp/testcases/kernel/containers/netns/parent_1.sh
===================================================================testcases/kernel/containers/netns/parent_1.sh +1
-1@@ -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 elseIndex:
ltp/testcases/kernel/containers/netns/parent_2.sh
===================================================================testcases/kernel/containers/netns/parent_2.sh +1
-1@@ -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 elseIndex:
ltp/testcases/kernel/containers/netns/parentns.sh
===================================================================testcases/kernel/containers/netns/parentns.sh +2
-2@@ -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 elseIndex:
ltp/testcases/kernel/containers/netns/paripv6.sh
===================================================================testcases/kernel/containers/netns/paripv6.sh +2
-2@@ -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 elseIndex:
ltp/testcases/kernel/containers/netns/rename_net.sh
===================================================================testcases/kernel/containers/netns/rename_net.sh +3
-3@@ -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 elseIndex: ltp/testcases/kernel/syscalls/ioctl/test_ioctl
===================================================================testcases/kernel/syscalls/ioctl/test_ioctl +0
-0@@ -25,7 +25,7 @@ export TST_COUNT=0for tttype in
ls /dev/tty*
dotestcases/kernel/syscalls/ioctl/test_ioctl +1
-1-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 @@ donefor tttype in
ls /dev/tty*
dotestcases/kernel/syscalls/ioctl/test_ioctl +1
-1-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"Index:
ltp/testcases/misc/tcore_patch_test_suites/tcore.sh
===================================================================testcases/misc/tcore_patch_test_suites/tcore.sh +0
-0@@ -92,13 +92,13 @@ Test_gen_core() rm -f core.* fi pid=`$TEST_DIR/tcore |grep "consumer pid"|awk '{print $2}'|cut -d = -f2`
testcases/misc/tcore_patch_test_suites/tcore.sh +6
-5- 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@@ -109,14 +109,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 ./tcore.exp >/dev/null 2>&1 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@@ -127,3 +127,4 @@ exit $fail +Index:
ltp/testcases/network/iproute/ip_tests.sh
===================================================================testcases/network/iproute/ip_tests.sh +16
-16@@ -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=$?
testcases/network/iproute/ip_tests.sh +0
-1if [ $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=$?
testcases/network/iproute/ip_tests.sh +1
-0+ ip neigh add 127.0.0.1 dev lo nud reachable >$LTPTMP/tst_ip.err 2>&1|| RC=$?
testcases/network/iproute/ip_tests.sh +3
-4if [ $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=$?
testcases/network/iproute/ip_tests.sh +1
-0+ ip neigh show | grep 127.0.0.1 grep -v "nud failed$"Quoted 1 line
$LTPTMP/tst_ip.err 2>&1 || RC=$?
testcases/network/iproute/ip_tests.sh +0
-1if [ $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=$?
testcases/network/iproute/ip_tests.sh +1
-0+ ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 >$LTPTMP/tst_ip.err2>&1 || RC=$?
testcases/network/iproute/ip_tests.sh +5
-6if [ $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=$?
testcases/network/iproute/ip_tests.sh +1
-0+ ifconfig eth0:1 10.6.6.6 netmask 255.255.255.0 >$LTPTMP/tst_ip.err2>&1 || RC=$?
testcases/network/iproute/ip_tests.sh +1
-1if [ $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=$?
testcases/network/iproute/ip_tests.sh +1
-1if [ $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=$?
testcases/network/iproute/ip_tests.sh +0
-1if [ $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=$?
testcases/network/iproute/ip_tests.sh +1
-0+ ip maddr del 66:66:00:00:00:66 dev eth0:1 >$LTPTMP/tst_ip.err 2>&1 ||RC=$?
testcases/network/iproute/ip_tests.sh +0
-0if [ $RC -ne 0 ] then tst_res TFAIL $LTPTMP/tst_ip.err \Index: ltp/testcases/network/nfs/nfs03/nfs03
===================================================================testcases/network/nfs/nfs03/nfs03 +13
-13@@ -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_inodreturned $retval."
Signature · 7 lines
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH] Remove bashisms (WAS Re: [PATCH 4/4] netns: Change interpretters from sh to bash)
Quoted 6 lines · On Monday 06 July 2009 19:10:36 Jiří Paleček wrote:
Quoted 2 lines · Matt Helsley
Change the increment syntax to use : $(( X += 1 )) instead of: X=$((X + 1))I changed this to (IMHO cooler syntax, it's for the sake of aesthetics after all) ": $((X++))" in my patch.
yes, x++ is better, but it is marked as "optional" in POSIX and some crappy shell implementations do not implement it (like dash). rather than fix dash, people change the code to not use these operators.
-mike
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH] Remove bashisms (WAS Re: [PATCH 4/4] netns: Change interpretters from sh to bash)
In reply to Jiří PalečekQuoted 27 lines · Jiří Paleček
Hi
Quoted 16 lines · Matt Helsley
Quoted 6 lines · Mike Frysinger
Quoted 2 lines · On Thursday 02 July 2009 16:32:53 Matt Helsley wrote:
Quoted 1 line · Mike Frysinger
in general, converting sh to bash is a bad idea as it can cause
issues
Quoted 2 lines
Quoted 1 line
for us embedded peeps.
Quoted 8 lines
Quoted 1 line
I suppose that's because of the memory bash consumes. Is there
anything
Quoted 1 line
else it does which is bad for embedded?
there is memory and disk usage concerns, but there are also systems that cant
run bash at all (e.g. systems withoutfork()-- all no-mmu Linux ports) -mikeQuoted 5 lines
Here's that updated patch which hopefully should be able to replace 3 and 4 of my recent series. Unfortunately I haven't had a chance to test it so
I'm posting it in case someone else does. As the original author of the patch Jiri is welcome to add his signoff as well.
Quoted 4 lines
Thanks for doing this. I have some comments to the patch, see below.
I have made my "version 2" of the patch too, containing also changes to other files (like
runpwtest.sh). If you're interreseted, I'll send it.
Sure. I'd have happily used that. My main concern is getting these fixed so I can cleanly run the containers testcases. I think it's actually worse than just removing "bashisms" because the interprettern is inconsistent with the scripts and thus nobody can run them.
Quoted 11 lines
Quoted 11 lines
From: Jiri Palecek <[email protected]>
This patch removes a bunch of bashisms.
It was originally written by Jiri Palecek but lacked changes requested by Mike Frysinger.
Signed-off-by Matt Helsley <[email protected]>---
Quoted 6 lines
Quoted 3 lines
v2:
Fix pushd/popd removal to save PWD and restore it using a regular
variable.I wonder if this couldn't be done by a simple "cd -", or even left out completely.
Hmm. I didn't think it could be left out completely because of the way $PWD was inconsistently used. Hence some trash could be left if we didn't cd to LTPTMP before and remove it after the test body.
Quoted 7 lines
Quoted 2 lines
Remove empty echoes in favor of printf.
This hasn't been done thoroughly (some empty echoes remain in the patch). Also, the patch misses one thing, that if you use printf, you have to add an extra linefeed at the end, ie:
Quoted 7 lines
echo -e "foo\n"
has to be replaced by
printf "foo\n\n"
for it to work equivalently.
Ack, you're right.
Quoted 11 lines
Quoted 8 lines
Remove non-bashism "kill -s KILL ..." and keep "kill -9 ..."
If this is still a problem then it could be placed in a separate patch.
Keep the exact formatting in cron0X tests -- use printf instead of echo. Use non-greedy expansion of tty device in ioctl test. Change the increment syntax to use : $(( X += 1 )) instead of:
X=$((X + 1))I changed this to (IMHO cooler syntax, it's for the sake of aesthetics after all) ": $((X++))" in my patch.
As Mike has noted, dash didn't work with that.
Cheers,
-Matt
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list