From: Hangbin Liu <liuhangbin@gmail.com>
To: Caspar Zhang <caspar@casparzhang.com>
Cc: ltp-list@lists.sourceforge.net, Xie Lingyun <lingyun.xie@bj.cs2c.com.cn>
Subject: Re: [LTP] [PATCH 2/2 v3] xinetd/xinetd_tests.sh: add IPv6 test for xinetd
Date: Thu, 11 Jul 2013 15:55:43 +0800 [thread overview]
Message-ID: <20130711075543.GO27609@aaa.aa> (raw)
In-Reply-To: <51DD9A44.4090409@casparzhang.com>
On Thu, Jul 11, 2013 at 01:30:44AM +0800, Caspar Zhang wrote:
> On 07/10/2013 07:03 PM, Xie Lingyun wrote:
> >If IPv6 is enabled, telnet ::1 will be tested. Otherwise, IPv4 only.
> >The IPv6 test will be executed first and give a separate result.
> >
> >Signed-off-by: Xie Lingyun <lingyun.xie@bj.cs2c.com.cn>
> >---
> > testcases/network/xinetd/xinetd_tests.sh | 81 +++++++++++++++++++++++++++++---
> > 1 file changed, 75 insertions(+), 6 deletions(-)
> >
> >diff --git a/testcases/network/xinetd/xinetd_tests.sh b/testcases/network/xinetd/xinetd_tests.sh
> >index ea89658..143ea76 100755
> >--- a/testcases/network/xinetd/xinetd_tests.sh
> >+++ b/testcases/network/xinetd/xinetd_tests.sh
> >@@ -84,11 +84,22 @@ init()
> > return $RC
> > fi
> >
> >+ # sometimes the default telnet may be /usr/kerberos/bin/telnet
> >+ TELNET_COMM='/usr/bin/telnet'
> >+
> > # check if commands tst_*, xinetd, awk exists.
> > chk_ifexists INIT tst_resm || return $RC
> > chk_ifexists INIT xinetd || return $RC
> > chk_ifexists INIT diff || return $RC
> >- chk_ifexists INIT telnet || return $RC
> >+ chk_ifexists INIT ip || return $RC
> >+ chk_ifexists INIT $TELNET_COMM || return $RC
> >+
> >+ IPV6_ENABLED=0
> >+ ip a | grep inet6 > /dev/null 2>&1
> >+ if [ $? -eq 0 ]
> >+ then
> >+ IPV6_ENABLED=1
> >+ fi
> >
> > # Create custom xinetd.conf file.
> > # tst_xinetd.conf.1 config file has telnet service disabled.
> >@@ -128,7 +139,7 @@ EOF
> >
> > # Create expected file with telnet disabled.
> > cat > $LTPTMP/tst_xinetd.exp.1 <<-EOF || RC=$?
> >-telnet: Unable to connect to remote host: Connection refused
> >+telnet: connect to address 127.0.0.1: Connection refused
> > EOF
> >
> > if [ $RC -ne 0 ]
> >@@ -138,10 +149,23 @@ EOF
> > return $RC
> > fi
> >
> >+ if [ $IPV6_ENABLED -eq 1 ]
> >+ then
> >+ cat > $LTPTMP/tst_xinetd.exp.1.ipv6 <<-EOF || RC=$?
> >+telnet: connect to address ::1: Connection refused
> >+EOF
> >+
> >+ if [ $RC -ne 0 ]
> >+ then
> >+ tst_brkm TBROK NULL \
> >+ "INIT: unable to create expected file $LTPTMP/tst_xinetd.exp.1"
> >+ fi
> >+ fi
> >+
> > # Create expected file with telnet enabled.
> > cat > $LTPTMP/tst_xinetd.exp.2 <<-EOF || RC=$?
> > Trying 127.0.0.1...
> >-Connected to localhost (127.0.0.1).
> >+Connected to 127.0.0.1.
> > Escape character is '^]'.
> > Connection closed by foreign host.
> > EOF
> >@@ -149,10 +173,26 @@ EOF
> > if [ $RC -ne 0 ]
> > then
> > tst_brkm TBROK NULL \
> >- "INIT: unable to create expected file $LTPTMP/tst_xinetd.exp.1"
> >+ "INIT: unable to create expected file $LTPTMP/tst_xinetd.exp.2"
> > return $RC
> > fi
> >
> >+ if [ $IPV6_ENABLED -eq 1 ]
> >+ then
> >+ cat > $LTPTMP/tst_xinetd.exp.2.ipv6 <<-EOF || RC=$?
> >+Trying ::1...
> >+Connected to ::1.
> >+Escape character is '^]'.
> >+Connection closed by foreign host.
> >+EOF
> >+
> >+ if [ $RC -ne 0 ]
> >+ then
> >+ tst_brkm TBROK NULL \
> >+ "INIT: unable to create expected file $LTPTMP/tst_xinetd.exp.2.ipv6"
> >+ fi
> >+ fi
> >+
> > return $RC
> > }
> >
> >@@ -263,7 +303,20 @@ test01()
> >
> > # Not checking for exit code from telnet command because telnet is
> > # not terminated by the test gracefully.
> >- echo "\x04" | telnet localhost 2>$LTPTMP/tst_xinetd.out 1>/dev/null
> >+ if [ $IPV6_ENABLED -eq 1 ]
> >+ 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=$?
> >+ if [ $RC -ne 0 ]
> >+ then
> >+ tst_res TFAIL $LTPTMP/tst_xinetd.err.ipv6 \
> >+ "Test #1: with telnet diabled expected out differs RC=$RC. Details:"
> >+ return $RC
> >+ fi
> >+ fi
> >+
> >+ 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=$?
> > if [ $RC -ne 0 ]
> >@@ -312,7 +365,23 @@ test01()
> >
> > # Not checking for exit code from telnet command because telnet is
> > # not terminated by the test gracefully.
> >- echo "\x04" | telnet localhost > $LTPTMP/tst_xinetd.out 2>&1
> >+ if [ $IPV6_ENABLED -eq 1 ]
> >+ 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=$?
> >+ if [ $RC -ne 0 ]
> >+ then
> >+ tst_res TFAIL $LTPTMP/tst_xinetd.err.ipv6 \
> >+ "Test #1: with telnet diabled expected out differs RC=$RC. Details:"
> >+ return $RC
> >+ else
> >+ tst_resm TPASS \
> >+ "Test #1: xinetd reads the config file and starts or stops IPv6 services."
> >+ fi
> >+ fi
> >+
> >+ 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=$?
> >
>
> Patch looks good to me.
>
> Could you also give a running result based on your patch? Thanks.
>
> Leo, please help with review if you have some time :-)
Besides the coding style, this patch is good to me.
>
> Thanks,
> Caspar
--
Thanks & Best Regards
Hangbin Liu <liuhangbin@gmail.com>
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2013-07-11 7:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-10 11:03 [LTP] [PATCH 1/2 v3] xinetd/xinetd_tests.sh: cleanup tabs Xie Lingyun
2013-07-10 11:03 ` [LTP] [PATCH 2/2 v3] xinetd/xinetd_tests.sh: add IPv6 test for xinetd Xie Lingyun
2013-07-10 17:30 ` Caspar Zhang
2013-07-11 7:43 ` Xie Lingyun
2013-07-11 8:00 ` Xie Lingyun
2013-07-11 8:03 ` Caspar Zhang
2013-07-12 0:45 ` Wanlong Gao
2013-07-11 7:55 ` Hangbin Liu [this message]
2013-07-10 17:28 ` [LTP] [PATCH 1/2 v3] xinetd/xinetd_tests.sh: cleanup tabs Caspar Zhang
2013-07-11 3:35 ` Hangbin Liu
2013-07-11 3:52 ` Wanlong Gao
2013-07-11 3:55 ` Caspar Zhang
2013-07-11 4:55 ` Hangbin Liu
2013-07-11 7:57 ` Xie Lingyun
2013-07-11 8:00 ` Caspar Zhang
2013-07-12 0:46 ` Wanlong Gao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130711075543.GO27609@aaa.aa \
--to=liuhangbin@gmail.com \
--cc=caspar@casparzhang.com \
--cc=lingyun.xie@bj.cs2c.com.cn \
--cc=ltp-list@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox