|
From: Cyril H. <su...@li...> - 2013-11-11 17:51:08
|
The branch, master, has been updated
via a4f5e23bb7dbbe71a52bc89b43edea35e2567382 (commit)
via 4716af77488c50bb0bf929d68e105a0b619c541d (commit)
from bfd9860c64e9b0c7bcb0cc149fae00ef3311574e (commit)
- Log -----------------------------------------------------------------
commit a4f5e23bb7dbbe71a52bc89b43edea35e2567382
Author: Simon Xu <xu....@or...>
Date: Fri Nov 8 11:18:47 2013 +0800
xinetd_tests.sh: remove RECORD and eliminate "|| RC=$?"
1) In xinetd.conf, `RECORD' is not a valid value for entry `log_on_failure'
(I couldn't find a distro in which it's valid), and it makes xinetd
successfully starts and promptly exit with error message:
"Bad log_on_failure flag: RECORD [file=/etc/xinetd.conf] [line=6]",
but the test will pass because telnet service is not started and that's
what it expect.
2) Eliminate '|| RC=$?' because because it may not be excecuted and the
original value in RC can mess things up. Also remove the RC=0
initializations that are now unnecessary.
Signed-off-by: Simon Xu <xu....@or...>
commit 4716af77488c50bb0bf929d68e105a0b619c541d
Author: Simon Xu <xu....@or...>
Date: Fri Nov 8 10:47:42 2013 +0800
sendfile01: rename SF_Server to sendfile01_server and add it into Makefile
1) Rename SF_Server to sendfile01_server to avoid collisions
2) The test always fails because SF_Server is not installed, add
sendfile01_server into sendfile01 makefile to install it.
Signed-off-by: Simon Xu <xu....@or...>
-----------------------------------------------------------------------
Summary of changes:
testcases/network/tcp_cmds/sendfile/Makefile | 2 +-
testcases/network/tcp_cmds/sendfile/sendfile01 | 2 +-
.../sendfile/{SF_Server => sendfile01_server} | 0
testcases/network/xinetd/xinetd_tests.sh | 74 +++++++++++--------
4 files changed, 45 insertions(+), 33 deletions(-)
rename testcases/network/tcp_cmds/sendfile/{SF_Server => sendfile01_server} (100%)
diff --git a/testcases/network/tcp_cmds/sendfile/Makefile b/testcases/network/tcp_cmds/sendfile/Makefile
index 124ce5d..a8b0736 100644
--- a/testcases/network/tcp_cmds/sendfile/Makefile
+++ b/testcases/network/tcp_cmds/sendfile/Makefile
@@ -27,7 +27,7 @@ include $(abs_srcdir)/../Makefile.inc
CPPFLAGS += -I$(abs_srcdir)/../include
-INSTALL_TARGETS := sendfile01
+INSTALL_TARGETS := sendfile01 sendfile01_server
MAKE_TARGETS += testsf_c testsf_s testsf_c6 testsf_s6
diff --git a/testcases/network/tcp_cmds/sendfile/sendfile01 b/testcases/network/tcp_cmds/sendfile/sendfile01
index 46b90e2..ba61873 100755
--- a/testcases/network/tcp_cmds/sendfile/sendfile01
+++ b/testcases/network/tcp_cmds/sendfile/sendfile01
@@ -84,7 +84,7 @@ do_test()
mkdir -p $TCtmp
PORT=$$
- if ! rsh -l root $IPADDR "$LTPROOT/testcases/bin/SF_Server $IPADDR $PORT $LTPROOT/testcases/bin $SERVER"; then
+ if ! rsh -l root $IPADDR "$LTPROOT/testcases/bin/sendfile01_server $IPADDR $PORT $LTPROOT/testcases/bin $SERVER"; then
end_testcase "rsh failed to $IPADDR as root failed"
fi
sleep 10
diff --git a/testcases/network/tcp_cmds/sendfile/SF_Server b/testcases/network/tcp_cmds/sendfile/sendfile01_server
similarity index 100%
rename from testcases/network/tcp_cmds/sendfile/SF_Server
rename to testcases/network/tcp_cmds/sendfile/sendfile01_server
diff --git a/testcases/network/xinetd/xinetd_tests.sh b/testcases/network/xinetd/xinetd_tests.sh
index a607d32..5024280 100755
--- a/testcases/network/xinetd/xinetd_tests.sh
+++ b/testcases/network/xinetd/xinetd_tests.sh
@@ -39,9 +39,8 @@
# - non-zero on failure.
chk_ifexists()
{
- RC=0
-
- which $2 > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
+ which $2 > $LTPTMP/tst_xinetd.err 2>&1
+ RC=$?
if [ $RC -ne 0 ]
then
tst_brkm TBROK NULL "$1: command $2 not found."
@@ -61,7 +60,6 @@ chk_ifexists()
init()
{
# Initialize global variables.
- export RC=0
export TST_TOTAL=2
export TCID="xinetd"
export TST_COUNT=0
@@ -77,7 +75,8 @@ init()
LTPTMP=$TMP/tst_xinetd.$$
fi
- mkdir -p $LTPTMP > /dev/null 2>&1 || RC=$?
+ mkdir -p $LTPTMP > /dev/null 2>&1
+ RC=$?
if [ $RC -ne 0 ]
then
tst_brkm TBROK NULL "INIT: Unable to create temporary directory"
@@ -103,19 +102,20 @@ init()
# Create custom xinetd.conf file.
# tst_xinetd.conf.1 config file has telnet service disabled.
- cat > $LTPTMP/tst_xinetd.conf.1 <<-EOF || RC=$?
+ cat > $LTPTMP/tst_xinetd.conf.1 <<-EOF
defaults
{
instances = 25
log_type = FILE /var/log/servicelog
log_on_success = HOST PID
- log_on_failure = HOST RECORD
+ log_on_failure = HOST
disabled = telnet
}
EOF
+RC=$?
# tst_xinetd.conf.2 config file has telnet enabled.
- cat > $LTPTMP/tst_xinetd.conf.2 <<-EOF || RC=$?
+ cat > $LTPTMP/tst_xinetd.conf.2 <<-EOF
defaults
{
instances = 25
@@ -136,11 +136,13 @@ service telnet
no_access =
}
EOF
+RC=$?
# Create expected file with telnet disabled.
- cat > $LTPTMP/tst_xinetd.exp.1 <<-EOF || RC=$?
+ cat > $LTPTMP/tst_xinetd.exp.1 <<-EOF
telnet: connect to address 127.0.0.1: Connection refused
EOF
+RC=$?
if [ $RC -ne 0 ]
then
@@ -151,9 +153,10 @@ EOF
if [ $IPV6_ENABLED -eq 1 ]
then
- cat > $LTPTMP/tst_xinetd.exp.1.ipv6 <<-EOF || RC=$?
+ cat > $LTPTMP/tst_xinetd.exp.1.ipv6 <<-EOF
telnet: connect to address ::1: Connection refused
EOF
+RC=$?
if [ $RC -ne 0 ]
then
@@ -163,12 +166,13 @@ EOF
fi
# Create expected file with telnet enabled.
- cat > $LTPTMP/tst_xinetd.exp.2 <<-EOF || RC=$?
+ cat > $LTPTMP/tst_xinetd.exp.2 <<-EOF
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Connection closed by foreign host.
EOF
+RC=$?
if [ $RC -ne 0 ]
then
@@ -179,12 +183,13 @@ EOF
if [ $IPV6_ENABLED -eq 1 ]
then
- cat > $LTPTMP/tst_xinetd.exp.2.ipv6 <<-EOF || RC=$?
+ cat > $LTPTMP/tst_xinetd.exp.2.ipv6 <<-EOF
Trying ::1...
Connected to ::1.
Escape character is '^]'.
Connection closed by foreign host.
EOF
+RC=$?
if [ $RC -ne 0 ]
then
@@ -205,12 +210,12 @@ EOF
# - non-zero on failure.
cleanup()
{
- RC=0
# restore the original xinetd.conf if a back up exits.
if [ -f /etc/xinetd.conf.orig ]
then
mv /etc/xinetd.conf.orig /etc/xinetd.conf \
- > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
+ > $LTPTMP/tst_xinetd.err 2>&1
+ RC=$?
if [ $RC -ne 0 ]
then
tst_res TINFO $LTPTMP/tst_xinetd.err \
@@ -220,7 +225,8 @@ cleanup()
sleep 1s
# restoring original services
- /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
+ /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.err 2>&1
+ RC=$?
if [ $RC -ne 0 ]
then
tst_res TINFO $LTPTMP/tst_xinetd.err \
@@ -250,13 +256,12 @@ test01()
TCID=xinetd01
TST_COUNT=1
nhops=0 # Number of hops required to get to host.
- RC=0 # Return value from commands.
tst_resm TINFO "Test #1: restart xinetd with telnet disabled."
# create a backup of the original xinetd.conf file.
- mv /etc/xinetd.conf /etc/xinetd.conf.orig > $LTPTMP/tst_xinetd.err 2>&1 \
- || RC=$?
+ mv /etc/xinetd.conf /etc/xinetd.conf.orig > $LTPTMP/tst_xinetd.err 2>&1
+ RC=$?
if [ $RC -ne 0 ]
then
tst_brk TBROK $LTPTMP/tst_xinetd.err NULL \
@@ -265,8 +270,8 @@ test01()
fi
# install the new config file with telnet disabled.
- mv $LTPTMP/tst_xinetd.conf.1 /etc/xinetd.conf > $LTPTMP/tst_xinetd.err 2>&1 \
- || RC=$?
+ mv $LTPTMP/tst_xinetd.conf.1 /etc/xinetd.conf > $LTPTMP/tst_xinetd.err 2>&1
+ RC=$?
if [ $RC -ne 0 ]
then
tst_brk TBROK $LTPTMP/tst_xinetd.err NULL \
@@ -279,7 +284,8 @@ test01()
sleep 1s
# restart xinetd to re-start the services
- /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.out 2>&1 || RC=$?
+ /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.out 2>&1
+ RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_xinetd.out \
@@ -288,7 +294,8 @@ test01()
else
# even if xinetd restart has zero exit value,
# make certain there was no failure.
- grep -i "fail" $LTPTMP/tst_xinetd.out > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
+ grep -i "fail" $LTPTMP/tst_xinetd.out > $LTPTMP/tst_xinetd.err 2>&1
+ RC=$?
if [ $RC -eq 0 ]
then
tst_res TFAIL $LTPTMP/tst_xinetd.err \
@@ -307,7 +314,8 @@ test01()
then
echo "" | $TELNET_COMM ::1 2>$LTPTMP/tst_xinetd.out.ipv6 1>/dev/null
diff -iwB $LTPTMP/tst_xinetd.out.ipv6 $LTPTMP/tst_xinetd.exp.1.ipv6 \
- > $LTPTMP/tst_xinetd.err.ipv6 2>&1 || RC=$?
+ > $LTPTMP/tst_xinetd.err.ipv6 2>&1
+ RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_xinetd.err.ipv6 \
@@ -318,7 +326,8 @@ test01()
echo "" | $TELNET_COMM 127.0.0.1 2>$LTPTMP/tst_xinetd.out 1>/dev/null
diff -iwB $LTPTMP/tst_xinetd.out $LTPTMP/tst_xinetd.exp.1 \
- > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
+ > $LTPTMP/tst_xinetd.err 2>&1
+ RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_xinetd.err \
@@ -328,8 +337,8 @@ test01()
tst_resm TINFO "Test #1: restart xinetd with telnet enabled."
# install the xinetd config file with telnet enabled.
- mv $LTPTMP/tst_xinetd.conf.2 /etc/xinetd.conf > $LTPTMP/tst_xinetd.err 2>&1 \
- || RC=$?
+ mv $LTPTMP/tst_xinetd.conf.2 /etc/xinetd.conf > $LTPTMP/tst_xinetd.err 2>&1
+ RC=$?
if [ $RC -ne 0 ]
then
tst_brk TBROK $LTPTMP/tst_xinetd.err NULL \
@@ -342,7 +351,8 @@ test01()
sleep 1s
# restart services.
- /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.out 2>&1 || RC=$?
+ /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.out 2>&1
+ RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_xinetd.out \
@@ -350,7 +360,8 @@ test01()
return $RC
else
# even if restart has a zero exit value double check for failure.
- grep -i "fail" $LTPTMP/tst_xinetd.out > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
+ grep -i "fail" $LTPTMP/tst_xinetd.out > $LTPTMP/tst_xinetd.err 2>&1
+ RC=$?
if [ $RC -eq 0 ]
then
tst_res TFAIL $LTPTMP/tst_xinetd.err \
@@ -369,7 +380,8 @@ test01()
then
echo "" | $TELNET_COMM ::1 >$LTPTMP/tst_xinetd.out.ipv6 2>&1
diff -iwB $LTPTMP/tst_xinetd.out.ipv6 $LTPTMP/tst_xinetd.exp.2.ipv6 \
- > $LTPTMP/tst_xinetd.err.ipv6 2>&1 || RC=$?
+ > $LTPTMP/tst_xinetd.err.ipv6 2>&1
+ RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_xinetd.err.ipv6 \
@@ -384,7 +396,8 @@ test01()
echo "" | $TELNET_COMM 127.0.0.1 > $LTPTMP/tst_xinetd.out 2>&1
diff -iwB $LTPTMP/tst_xinetd.out $LTPTMP/tst_xinetd.exp.2 \
- > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
+ > $LTPTMP/tst_xinetd.err 2>&1
+ RC=$?
if [ $RC -ne 0 ]
then
tst_res TFAIL $LTPTMP/tst_xinetd.err \
@@ -406,7 +419,6 @@ test01()
# Exit: - zero on success
# - non-zero on failure.
-RC=0
init || exit $?
test01 || RC=$?
hooks/post-receive
--
ltp
|