From: Caspar Zhang <caspar@casparzhang.com>
To: Xie Lingyun <lingyun.xie@bj.cs2c.com.cn>
Cc: LTP List <ltp-list@lists.sourceforge.net>
Subject: Re: [LTP] [PATCH 1/2 v3] xinetd/xinetd_tests.sh: cleanup tabs
Date: Thu, 11 Jul 2013 16:00:42 +0800 [thread overview]
Message-ID: <51DE662A.6020001@casparzhang.com> (raw)
In-Reply-To: <CALGiYOFbvnDncG5yQLt_bJ=_GLv5juAqSMabJRhh9zcp9dTUuQ@mail.gmail.com>
On 07/11/2013 03:57 PM, Xie Lingyun wrote:
>
> From 67abb4c3a814f54312c518ae04769979c6543591 Mon Sep 17 00:00:00 2001
> From: Xie Lingyun<lingyun.xie@bj.cs2c.com.cn>
> Date: Thu, 11 Jul 2013 15:11:58 +0800
> Subject: [PATCH 1/2 v4] xinetd/xinetd_tests.sh: clean up tabs
>
> replace tabs with 4 spaces.
> The echo <<-EOF lines become no indentation.
>
> Signed-off-by: Xie Lingyun<lingyun.xie@bj.cs2c.com.cn>
> ---
> testcases/network/xinetd/xinetd_tests.sh | 246 +++++++++++++++----------------
> 1 file changed, 123 insertions(+), 123 deletions(-)
>
> diff --git a/testcases/network/xinetd/xinetd_tests.sh b/testcases/network/xinetd/xinetd_tests.sh
> index 83eb8a7..d898af0 100755
> --- a/testcases/network/xinetd/xinetd_tests.sh
> +++ b/testcases/network/xinetd/xinetd_tests.sh
> @@ -90,46 +90,46 @@ init()
> chk_ifexists INIT diff || return $RC
> chk_ifexists INIT telnet || return $RC
>
> - # Create custom xinetd.conf file.
> - # tst_xinetd.conf.1 config file has telnet service disabled.
> - cat > $LTPTMP/tst_xinetd.conf.1 <<-EOF || RC=$?
> - defaults
> - {
> - instances = 25
> - log_type = FILE /var/log/servicelog
> - log_on_success = HOST PID
> - log_on_failure = HOST RECORD
> - disabled = telnet
> - }
> - EOF
> -
> - # tst_xinetd.conf.2 config file has telnet enabled.
> - cat > $LTPTMP/tst_xinetd.conf.2 <<-EOF || RC=$?
> - defaults
> - {
> - instances = 25
> - log_type = FILE /var/log/servicelog
> - log_on_success = HOST PID
> - log_on_failure = HOST
> - # disabled = telnet
> - }
> -
> - service telnet
> - {
> - socket_type = stream
> - protocol = tcp
> - wait = no
> - user = root
> - server = /usr/sbin/in.telnetd
> - server_args = -n
> - no_access =
> - }
> - EOF
> + # Create custom xinetd.conf file.
> + # tst_xinetd.conf.1 config file has telnet service disabled.
> + cat > $LTPTMP/tst_xinetd.conf.1 <<-EOF || RC=$?
> +defaults
> +{
> + instances = 25
> + log_type = FILE /var/log/servicelog
> + log_on_success = HOST PID
> + log_on_failure = HOST RECORD
> + disabled = telnet
> +}
> +EOF
> +
> + # tst_xinetd.conf.2 config file has telnet enabled.
> + cat > $LTPTMP/tst_xinetd.conf.2 <<-EOF || RC=$?
> +defaults
> +{
> + instances = 25
> + log_type = FILE /var/log/servicelog
> + log_on_success = HOST PID
> + log_on_failure = HOST
> + # disabled = telnet
> +}
> +
> +service telnet
> +{
> + socket_type = stream
> + protocol = tcp
> + wait = no
> + user = root
> + server = /usr/sbin/in.telnetd
> + server_args = -n
> + no_access =
> +}
> +EOF
>
> # Create expected file with telnet disabled.
> cat > $LTPTMP/tst_xinetd.exp.1 <<-EOF || RC=$?
> - telnet: Unable to connect to remote host: Connection refused
> - EOF
> +telnet: Unable to connect to remote host: Connection refused
> +EOF
>
> if [ $RC -ne 0 ]
> then
> @@ -139,12 +139,12 @@ init()
> 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).
> - Escape character is '^]'.
> - Connection closed by foreign host.
> - EOF
> + cat > $LTPTMP/tst_xinetd.exp.2 <<-EOF || RC=$?
> +Trying 127.0.0.1...
> +Connected to localhost (127.0.0.1).
> +Escape character is '^]'.
> +Connection closed by foreign host.
> +EOF
>
> if [ $RC -ne 0 ]
> then
> @@ -165,28 +165,28 @@ init()
> # - 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=$?
> - if [ $RC -ne 0 ]
> - then
> - tst_res TINFO $LTPTMP/tst_xinetd.err \
> - "CLEANUP: failed restoring original xinetd.conf RC=$RC. Details:"
> - fi
> -
> - sleep 1s
> -
> - # restoring original services
> - /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
> - if [ $RC -ne 0 ]
> - then
> - tst_res TINFO $LTPTMP/tst_xinetd.err \
> - "CLEANUP: failed restoring original services RC=$RC. Details:"
> - fi
> - fi
> + 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=$?
> + if [ $RC -ne 0 ]
> + then
> + tst_res TINFO $LTPTMP/tst_xinetd.err \
> + "CLEANUP: failed restoring original xinetd.conf RC=$RC. Details:"
> + fi
> +
> + sleep 1s
> +
> + # restoring original services
> + /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
> + if [ $RC -ne 0 ]
> + then
> + tst_res TINFO $LTPTMP/tst_xinetd.err \
> + "CLEANUP: failed restoring original services RC=$RC. Details:"
> + fi
> + fi
>
> # remove all the temporary files created by this test.
> tst_resm TINFO "CLEAN: removing $LTPTMP"
> @@ -214,9 +214,9 @@ 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=$?
> + # create a backup of the original xinetd.conf file.
> + 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 \
> @@ -224,9 +224,9 @@ test01()
> return $RC
> 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=$?
> + # install the new config file with telnet disabled.
> + 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 \
> @@ -236,36 +236,36 @@ test01()
>
> tst_resm TINFO "Test #1: new xinetd.conf installed with telnet disabled."
>
> - sleep 1s
> + sleep 1s
>
> - # restart xinetd to re-start the services
> + # restart xinetd to re-start the services
> /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.out 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_xinetd.out \
> "Test #1: unable to restart service with telnet disabled. Details:"
> return $RC
> - 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=$?
> - if [ $RC -eq 0 ]
> - then
> - tst_res TFAIL $LTPTMP/tst_xinetd.err \
> - "Test #1: xinetd failed to restart. Details"
> - return $RC
> - else
> - RC=0
> - tst_resm TINFO \
> - "Test #1: xinetd re-started successfully with telnet disabled."
> - fi
> - fi
> -
> - # 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
> - diff -iwB $LTPTMP/tst_xinetd.out $LTPTMP/tst_xinetd.exp.1 \
> - > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
> + 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=$?
> + if [ $RC -eq 0 ]
> + then
> + tst_res TFAIL $LTPTMP/tst_xinetd.err \
> + "Test #1: xinetd failed to restart. Details"
> + return $RC
> + else
> + RC=0
> + tst_resm TINFO \
> + "Test #1: xinetd re-started successfully with telnet disabled."
> + fi
> + fi
> +
> + # 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
> + diff -iwB $LTPTMP/tst_xinetd.out $LTPTMP/tst_xinetd.exp.1 \
> + > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_xinetd.err \
> @@ -274,9 +274,9 @@ test01()
> fi
>
> 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=$?
> + # install the xinetd config file with telnet enabled.
> + 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 \
> @@ -286,44 +286,44 @@ test01()
>
> tst_resm TINFO "Test #1: new xinetd.conf installed with telnet enabled."
>
> - sleep 1s
> + sleep 1s
>
> - # restart services.
> + # restart services.
> /etc/init.d/xinetd restart > $LTPTMP/tst_xinetd.out 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_xinetd.out \
> "Test #1: unable to restart services with telnet enabled. Details:"
> 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=$?
> - if [ $RC -eq 0 ]
> - then
> - tst_res TFAIL $LTPTMP/tst_xinetd.err \
> - "Test #1: xinetd failed to restart. Details"
> - return $RC
> - else
> - RC=0
> - tst_resm TINFO \
> - "Test #1: xinetd re-started successfully with telnet enabled."
> - fi
> - fi
> -
> - # 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
> -
> - diff -iwB $LTPTMP/tst_xinetd.out $LTPTMP/tst_xinetd.exp.2 \
> - > $LTPTMP/tst_xinetd.err 2>&1 || 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=$?
> + if [ $RC -eq 0 ]
> + then
> + tst_res TFAIL $LTPTMP/tst_xinetd.err \
> + "Test #1: xinetd failed to restart. Details"
> + return $RC
> + else
> + RC=0
> + tst_resm TINFO \
> + "Test #1: xinetd re-started successfully with telnet enabled."
> + fi
> + fi
> +
> + # 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
> +
> + diff -iwB $LTPTMP/tst_xinetd.out $LTPTMP/tst_xinetd.exp.2 \
> + > $LTPTMP/tst_xinetd.err 2>&1 || RC=$?
> if [ $RC -ne 0 ]
> then
> tst_res TFAIL $LTPTMP/tst_xinetd.err \
> "Test #1: expected output differes from actual. Details:"
> return $RC
> - else
> - tst_resm TPASS \
> - "Test #1: xinetd reads the config file and starts or stops services."
> + else
> + tst_resm TPASS \
> + "Test #1: xinetd reads the config file and starts or stops services."
> fi
>
> return $RC
> -- 1.8.3.1
Reviewed-by: Caspar Zhang <caspar@casparzhang.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 8:00 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
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 [this message]
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=51DE662A.6020001@casparzhang.com \
--to=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