From: Alexey Kodanev <alexey.kodanev@oracle.com>
To: Hangbin Liu <liuhangbin@gmail.com>,
LTP List <ltp-list@lists.sourceforge.net>
Cc: Vincent Hsu <vincent.hsu@linaro.org>
Subject: Re: [LTP] [PATCH] ltp-networking/tcp_cmds/finger: fix finger unknown host test
Date: Fri, 19 Sep 2014 15:18:10 +0400 [thread overview]
Message-ID: <541C10F2.6090801@oracle.com> (raw)
In-Reply-To: <1410503959-31712-1-git-send-email-liuhangbin@gmail.com>
Hi!
On 09/12/2014 10:39 AM, Hangbin Liu wrote:
> On RHEL6/7 and Fedora, finger added a patch that will return error like
> finger: Name or service not known: host 'xxxx', service 'finger'
>
> >From commit e1c5e46 ltp-networking/tcp_cmds/finger: fix finger test,
> on Ubuntu will return
> finger: unknown host: xxx
> getaddrinfo: No address associated with hostname
> on CentOS will return
> finger: xxx: nodename nor servname provided, or not known
>
> So modify the check option and only grep finger: .*known
>
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
> testcases/network/tcp_cmds/finger/finger01 | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/network/tcp_cmds/finger/finger01 b/testcases/network/tcp_cmds/finger/finger01
> index 203d746..c00f2cc 100755
> --- a/testcases/network/tcp_cmds/finger/finger01
> +++ b/testcases/network/tcp_cmds/finger/finger01
> @@ -116,10 +116,10 @@ do_test2()
>
> tst_resm TINFO "finger -bad user "
> finger $BADUSER 2>&1 1>/dev/null || end_testcase "finger $BADUSER"
Finger always returns 0 here, test-case pass.
> - finger @$BADHOST 2>&1 1>/dev/null | grep "finger: unknown host" \
> + finger @$BADHOST 2>&1 1>/dev/null | grep "finger: .*known" \
> || end_testcase "finger @$BADHOST"
It doesn't return error exit code when it fails to find users and hosts,
but we could check stderr for the presence of any messages, e.g.:
if [ -z "$(finger $BADUSER 2>&1 >/dev/null)" ]; then
end_testcase "finger $BADUSER"
fi
> if ! finger $BADUSER@$BADHOST 2>&1 1>/dev/null \
> - | grep "finger: unknown host"; then
> + | grep "finger: .*known"; then
> end_testcase "finger $BADUSER@$BADHOST"
> fi
> }
Thanks,
Alexey
------------------------------------------------------------------------------
Slashdot TV. Video for Nerds. Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
parent reply other threads:[~2014-09-19 11:16 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <1410503959-31712-1-git-send-email-liuhangbin@gmail.com>]
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=541C10F2.6090801@oracle.com \
--to=alexey.kodanev@oracle.com \
--cc=liuhangbin@gmail.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=vincent.hsu@linaro.org \
/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