* Re: [LTP] [PATCH] ltp-networking/tcp_cmds/finger: fix finger unknown host test
[not found] <1410503959-31712-1-git-send-email-liuhangbin@gmail.com>
@ 2014-09-19 11:18 ` Alexey Kodanev
0 siblings, 0 replies; only message in thread
From: Alexey Kodanev @ 2014-09-19 11:18 UTC (permalink / raw)
To: Hangbin Liu, LTP List; +Cc: Vincent Hsu
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-09-19 11:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1410503959-31712-1-git-send-email-liuhangbin@gmail.com>
2014-09-19 11:18 ` [LTP] [PATCH] ltp-networking/tcp_cmds/finger: fix finger unknown host test Alexey Kodanev
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.