* [LTP] Suggested patch for Debian distro testing, part 2 of 2
@ 2014-03-25 13:42 Joseph Beckenbach
2014-03-25 15:43 ` chrubis
2014-03-25 17:04 ` Mike Frysinger
0 siblings, 2 replies; 3+ messages in thread
From: Joseph Beckenbach @ 2014-03-25 13:42 UTC (permalink / raw)
To: ltp-list@lists.sourceforge.net
Greetings, again!
Second part appended.
I'm pretty sure I can minimize these further, maybe eliminate, given Cyril's comment yesterday to Alexey:
>> +tdir="${LTPROOT}/testcases/bin/"
> I keep telling everybody that this path must be part of the $PATH to
> run a LTP testcase so all binaries from it should be started just by
> their filename.
If this addition to $PATH is necessary, perhaps the wrapping scripts should enforce it,
or the requirement noted in invocation instructions. (So many invocation points, though ....)
That plus shebanging these scripts as /bin/bash would eliminate the rest of this patch.
Thoughts? Thanks!
Joseph
Joseph Beckenbach, senior QA engineer : Automation
=====
diff --git a/testcases/kernel/containers/netns/child_1.sh b/testcases/kernel/containers/netns/child_1.sh
index 4cd3325..4e54136 100755
--- a/testcases/kernel/containers/netns/child_1.sh
+++ b/testcases/kernel/containers/netns/child_1.sh
@@ -29,7 +29,7 @@ export TCID
export TST_COUNT
export TST_TOTAL
-. initialize.sh
+. `dirname $0`/initialize.sh
status=0
# Writing child PID number into /tmp/FIFO
diff --git a/testcases/kernel/containers/netns/child_2.sh b/testcases/kernel/containers/netns/child_2.sh
index 29907cd..5f80893 100755
--- a/testcases/kernel/containers/netns/child_2.sh
+++ b/testcases/kernel/containers/netns/child_2.sh
@@ -28,7 +28,7 @@ TST_COUNT=1
export TCID
export TST_COUNT
export TST_TOTAL
-. initialize.sh
+. `dirname $0`/initialize.sh
status=0
# Writing child PID number into /tmp/FIFO4
diff --git a/testcases/kernel/containers/netns/childipv6.sh b/testcases/kernel/containers/netns/childipv6.sh
index f5eda65..1046b84 100755
--- a/testcases/kernel/containers/netns/childipv6.sh
+++ b/testcases/kernel/containers/netns/childipv6.sh
@@ -37,7 +37,7 @@ TST_COUNT=1
export TCID
export TST_COUNT
export TST_TOTAL
-. initialize.sh
+. `dirname $0`/initialize.sh
status=0
# Passing the PID of child
diff --git a/testcases/kernel/containers/netns/childns.sh b/testcases/kernel/containers/netns/childns.sh
index 5b428a6..e143606 100755
--- a/testcases/kernel/containers/netns/childns.sh
+++ b/testcases/kernel/containers/netns/childns.sh
@@ -33,9 +33,9 @@
# The test case ID, the test case count and the total number of test case
export TCID=${TCID:-childns.sh}
-. cmdlib.sh
+. `dirname $0`/cmdlib.sh
exists awk grep ip ping sshd
-. initialize.sh
+. `dirname $0`/initialize.sh
status=0
SSHD=`which sshd`
diff --git a/testcases/kernel/containers/netns/initialize.sh b/testcases/kernel/containers/netns/initialize.sh
index 1e66dc5..b2ad642 100755
--- a/testcases/kernel/containers/netns/initialize.sh
+++ b/testcases/kernel/containers/netns/initialize.sh
@@ -49,13 +49,13 @@ if [ -n "${LTPROOT:-}" ]; then
fi
else
tst_resm TFAIL "Please set the LTP root env variable, and retry again"
- exit -1
+ exit 255
fi
IPver=`ip -V | awk -F"-" ' { print $2 } '` ;
if ! printf "%s\n%s\n" "ss080417" "$IPver" | sort -c ; then
tst_resm TINFO "ip version should be atleast ss080417"
- exit -1
+ exit 255
fi
i=1
while [ $i -le 6 ] ; do
@@ -68,7 +68,7 @@ netdev=`ip addr show | awk '/^[0-9]*:.*UP/ { a=$2 } /inet / { b=$2 ; \
netdev=`basename $netdev ":"`
if [ -z "$netdev" ] ; then
tst_resm TINFO "Not able to determine the ethernet dev name"
- exit -1
+ exit 255
fi
# copying the values for restoring it later.
diff --git a/testcases/kernel/containers/netns/parent_1.sh b/testcases/kernel/containers/netns/parent_1.sh
index a170b4f..dc5b7d8 100755
--- a/testcases/kernel/containers/netns/parent_1.sh
+++ b/testcases/kernel/containers/netns/parent_1.sh
@@ -32,7 +32,7 @@ export TCID
export TST_COUNT
export TST_TOTAL
- . initialize.sh
+ . `dirname $0`/initialize.sh
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/conf/$netdev/proxy_arp
create_veth
@@ -40,7 +40,7 @@ export TST_TOTAL
vnet1=$dev1
if [ -z "$vnet0" -o -z "$vnet1" ] ; then
tst_resm TFAIL "Error: unable to create veth pair in $0"
- exit -1
+ exit 255
else
debug "INFO: vnet0 = $vnet0 , vnet1 = $vnet1"
fi
diff --git a/testcases/kernel/containers/netns/parent_2.sh b/testcases/kernel/containers/netns/parent_2.sh
index 3e1349f..d2fa19d 100755
--- a/testcases/kernel/containers/netns/parent_2.sh
+++ b/testcases/kernel/containers/netns/parent_2.sh
@@ -29,7 +29,7 @@ TST_COUNT=1
export TCID
export TST_COUNT
export TST_TOTAL
-. initialize.sh
+. `dirname $0`/initialize.sh
create_veth
vnet2=$dev0
@@ -37,7 +37,7 @@ export TST_TOTAL
if [ -z "$vnet2" -o -z "$vnet3" ] ; then
tst_resm TFAIL "Error: unable to create veth pair in $0"
- exit -1
+ exit 255
else
debug "INFO: vnet2 = $vnet2 , vnet3 = $vnet3"
fi
diff --git a/testcases/kernel/containers/netns/parent_share.sh b/testcases/kernel/containers/netns/parent_share.sh
index 158c530..0ce5ab8 100755
--- a/testcases/kernel/containers/netns/parent_share.sh
+++ b/testcases/kernel/containers/netns/parent_share.sh
@@ -36,7 +36,7 @@ export TCID
export TST_COUNT
export TST_TOTAL
ret=0
-. initialize.sh
+. `dirname $0`/initialize.sh
mkdir -p /tmp/par_sysfs /tmp/mnt || ret=1
mount --bind /sys /tmp/par_sysfs || ret=1
@@ -47,5 +47,5 @@ ret=0
$smount /tmp/mnt shared > /dev/null || ret=1
if [ $ret -ne 0 ] ; then
tst_resm TFAIL "Error while doing shared mount"
- exit -1
+ exit 255
fi
diff --git a/testcases/kernel/containers/netns/parentns.sh b/testcases/kernel/containers/netns/parentns.sh
index bb5e8ef..0ed11fb 100755
--- a/testcases/kernel/containers/netns/parentns.sh
+++ b/testcases/kernel/containers/netns/parentns.sh
@@ -39,7 +39,7 @@ export TCID
export TST_COUNT
export TST_TOTAL
#set -x
-. initialize.sh
+. `dirname $0`/initialize.sh
status=0
# Checks if any script is passed as argument.
@@ -58,7 +58,7 @@ status=0
vnet1=$dev1
if [ -z "$vnet0" -o -z "$vnet1" ] ; then
tst_resm TFAIL "Error: unable to create veth pair"
- exit -1
+ exit 255
else
debug "INFO: vnet0 = $vnet0 , vnet1 = $vnet1"
fi
diff --git a/testcases/kernel/containers/netns/paripv6.sh b/testcases/kernel/containers/netns/paripv6.sh
index 8612560..78a88a2 100755
--- a/testcases/kernel/containers/netns/paripv6.sh
+++ b/testcases/kernel/containers/netns/paripv6.sh
@@ -39,7 +39,7 @@ TST_COUNT=1
export TCID
export TST_COUNT
export TST_TOTAL
-. initialize.sh
+. `dirname $0`/initialize.sh
status=0
# Sets up the infrastructure for creating network NS
@@ -51,7 +51,7 @@ status=0
vnet1=$dev1
if [ -z "$vnet0" -o -z "$vnet1" ] ; then
tst_resm TFAIL "Error: unable to create veth pair"
- exit -1
+ exit 255
else
debug "INFO: vnet0 = $vnet0 , vnet1 = $vnet1"
fi
diff --git a/testcases/kernel/containers/netns/runallnetworktests_child.sh b/testcases/kernel/containers/netns/runallnetworktests_child.sh
index 7bba33d..a2f3f5e 100755
--- a/testcases/kernel/containers/netns/runallnetworktests_child.sh
+++ b/testcases/kernel/containers/netns/runallnetworktests_child.sh
@@ -33,7 +33,7 @@ if [ $? -ne 0 ]; then
exit 1;
fi
-. initialize.sh;
+. `dirname $0`/initialize.sh;
/etc/init.d/xinetd restart;
if [ $? -ne 0 ]; then
diff --git a/testcases/kernel/containers/netns/runnetnstest.sh b/testcases/kernel/containers/netns/runnetnstest.sh
index fb494a2..3eff4ef 100755
--- a/testcases/kernel/containers/netns/runnetnstest.sh
+++ b/testcases/kernel/containers/netns/runnetnstest.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
################################################################################
## ##
@@ -106,7 +106,7 @@ echo
#fi
#echo
-. cmdlib.sh
+. `dirname $0`/cmdlib.sh
flag=0
status_daemon vsftpd
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [LTP] Suggested patch for Debian distro testing, part 2 of 2
2014-03-25 13:42 [LTP] Suggested patch for Debian distro testing, part 2 of 2 Joseph Beckenbach
@ 2014-03-25 15:43 ` chrubis
2014-03-25 17:04 ` Mike Frysinger
1 sibling, 0 replies; 3+ messages in thread
From: chrubis @ 2014-03-25 15:43 UTC (permalink / raw)
To: Joseph Beckenbach; +Cc: ltp-list@lists.sourceforge.net
Hi!
> I'm pretty sure I can minimize these further, maybe eliminate, given Cyril's comment yesterday to Alexey:
> >> +tdir="${LTPROOT}/testcases/bin/"
> > I keep telling everybody that this path must be part of the $PATH to
> > run a LTP testcase so all binaries from it should be started just by
> > their filename.
>
> If this addition to $PATH is necessary, perhaps the wrapping scripts should enforce it,
> or the requirement noted in invocation instructions. (So many invocation points, though ....)
> That plus shebanging these scripts as /bin/bash would eliminate the rest of this patch.
You are supposed to run the tests with correct PATH, in case that you
run tests from git checkout that would be:
PATH="$PATH:$PWD" ./foo
> SSHD=`which sshd`
> diff --git a/testcases/kernel/containers/netns/initialize.sh b/testcases/kernel/containers/netns/initialize.sh
> index 1e66dc5..b2ad642 100755
> --- a/testcases/kernel/containers/netns/initialize.sh
> +++ b/testcases/kernel/containers/netns/initialize.sh
> @@ -49,13 +49,13 @@ if [ -n "${LTPROOT:-}" ]; then
> fi
> else
> tst_resm TFAIL "Please set the LTP root env variable, and retry again"
> - exit -1
> + exit 255
> fi
This was wrong to begin with, if test fails it should return 1
> IPver=`ip -V | awk -F"-" ' { print $2 } '` ;
> if ! printf "%s\n%s\n" "ss080417" "$IPver" | sort -c ; then
> tst_resm TINFO "ip version should be atleast ss080417"
> - exit -1
> + exit 255
> fi
> i=1
> while [ $i -le 6 ] ; do
> @@ -68,7 +68,7 @@ netdev=`ip addr show | awk '/^[0-9]*:.*UP/ { a=$2 } /inet / { b=$2 ; \
> netdev=`basename $netdev ":"`
> if [ -z "$netdev" ] ; then
> tst_resm TINFO "Not able to determine the ethernet dev name"
> - exit -1
> + exit 255
> fi
And these are wrong too. Tests should not exit on TINFO. The first one
seems to be candidate for TCONF the second one is probably TBROK.
Description for the exit values can be see at:
https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines
The return values could be found in testcases/lib/test.sh
Also note that calling exit directly is deprecated and usage of the
test.sh library is prefered, but it's not required for changes in
existing tests.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [LTP] Suggested patch for Debian distro testing, part 2 of 2
2014-03-25 13:42 [LTP] Suggested patch for Debian distro testing, part 2 of 2 Joseph Beckenbach
2014-03-25 15:43 ` chrubis
@ 2014-03-25 17:04 ` Mike Frysinger
1 sibling, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2014-03-25 17:04 UTC (permalink / raw)
To: ltp-list; +Cc: Joseph Beckenbach
[-- Attachment #1.1: Type: text/plain, Size: 219 bytes --]
On Tue 25 Mar 2014 13:42:44 Joseph Beckenbach wrote:
> -. initialize.sh
> +. `dirname $0`/initialize.sh
style note: use $(...), not `...`. you also should properly quote:
. "$(dirname "$0")/initialize.sh"
-mike
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 370 bytes --]
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
[-- 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] 3+ messages in thread
end of thread, other threads:[~2014-03-25 17:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-25 13:42 [LTP] Suggested patch for Debian distro testing, part 2 of 2 Joseph Beckenbach
2014-03-25 15:43 ` chrubis
2014-03-25 17:04 ` Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox