All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] xinetd_tests.sh: remove RECORD and eliminate "|| RC=$?"
@ 2013-11-05 10:01 Simon Xu
  2013-11-07 16:14 ` chrubis
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Xu @ 2013-11-05 10:01 UTC (permalink / raw)
  To: ltp-list

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) It's not a good idea to do '|| RC=$?' because because it may not be
   excecuted and the original value in RC can mess things up.

Signed-off-by: Simon Xu <xu.simon@oracle.com>
---
 testcases/network/xinetd/xinetd_tests.sh | 68 ++++++++++++++++++++------------
 1 file changed, 43 insertions(+), 25 deletions(-)

diff --git a/testcases/network/xinetd/xinetd_tests.sh b/testcases/network/xinetd/xinetd_tests.sh
index a607d32..bdc7632 100755
--- a/testcases/network/xinetd/xinetd_tests.sh
+++ b/testcases/network/xinetd/xinetd_tests.sh
@@ -41,7 +41,8 @@ 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."
@@ -77,7 +78,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 +105,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 +139,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 +156,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 +169,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 +186,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
@@ -210,7 +218,8 @@ cleanup()
     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 +229,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 \
@@ -255,8 +265,8 @@ test01()
     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 +275,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 +289,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 +299,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 +319,8 @@ test01()
     then
         echo "\x04" | $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 +331,8 @@ test01()
 
     echo "\x04" | $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 +342,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 +356,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 +365,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 +385,8 @@ test01()
     then
         echo "\x04" | $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 +401,8 @@ test01()
     echo "\x04" | $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 \
-- 
1.8.4.2


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH] xinetd_tests.sh: remove RECORD and eliminate "|| RC=$?"
  2013-11-05 10:01 [LTP] [PATCH] xinetd_tests.sh: remove RECORD and eliminate "|| RC=$?" Simon Xu
@ 2013-11-07 16:14 ` chrubis
  2013-11-08  3:18   ` [LTP] [PATCH V2] " Simon Xu
  0 siblings, 1 reply; 4+ messages in thread
From: chrubis @ 2013-11-07 16:14 UTC (permalink / raw)
  To: Simon Xu; +Cc: ltp-list

Hi!
> 2) It's not a good idea to do '|| RC=$?' because because it may not be
>    excecuted and the original value in RC can mess things up.

I'm OK with that, but remove the RC=0 initializations that are now
unnecessary.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [LTP] [PATCH V2] xinetd_tests.sh: remove RECORD and eliminate "|| RC=$?"
  2013-11-07 16:14 ` chrubis
@ 2013-11-08  3:18   ` Simon Xu
  2013-11-11 17:06     ` chrubis
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Xu @ 2013-11-08  3:18 UTC (permalink / raw)
  To: ltp-list

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.simon@oracle.com>
---
 testcases/network/xinetd/xinetd_tests.sh | 74 +++++++++++++++++++-------------
 1 file changed, 43 insertions(+), 31 deletions(-)

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 "\x04" | $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 "\x04" | $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 "\x04" | $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 "\x04" | $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=$?
-- 
1.8.4.2


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH V2] xinetd_tests.sh: remove RECORD and eliminate "|| RC=$?"
  2013-11-08  3:18   ` [LTP] [PATCH V2] " Simon Xu
@ 2013-11-11 17:06     ` chrubis
  0 siblings, 0 replies; 4+ messages in thread
From: chrubis @ 2013-11-11 17:06 UTC (permalink / raw)
  To: Simon Xu; +Cc: ltp-list

Hi!
> 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.simon@oracle.com>

Pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-11 17:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-05 10:01 [LTP] [PATCH] xinetd_tests.sh: remove RECORD and eliminate "|| RC=$?" Simon Xu
2013-11-07 16:14 ` chrubis
2013-11-08  3:18   ` [LTP] [PATCH V2] " Simon Xu
2013-11-11 17:06     ` chrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.