From: Subrata Modak <subrata@linux.vnet.ibm.com>
To: Jiri Palecek <jpalecek@web.de>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] Use custom prompt in the telnet test, to avoid timeouts in case the user's prompt doesn't contain hostname
Date: Thu, 25 Jun 2009 14:39:53 +0530 [thread overview]
Message-ID: <1245920993.5542.35.camel@subratamodak.linux.ibm.com> (raw)
In-Reply-To: <200906240117.n5O1H5O0007047@e2.ny.us.ibm.com>
On Wed, 2009-06-10 at 13:05 +0200, Jiri Palecek > wrote:
> Hello,
>
> this patch makes the telnet test avoid timeouts when the remote users prompt doesn't contain hostname, or is somehow irregular. It works by explicitly setting the prompt in the remote shell (see the PROMPT variable). Note that setting literal value as a prompt works even when the remote shell is not bash (the classic bash placeholders do not).
>
> Regards
> Jiri Palecek
>
> Signed-off-by: Jiri Palecek <jpalecek@web.de>
Thanks.
Regards--
Subrata
> ---
> testcases/network/tcp_cmds/telnet/telnet01 | 10 ++++++----
> 1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/testcases/network/tcp_cmds/telnet/telnet01 b/testcases/network/tcp_cmds/telnet/telnet01
> index a4b37d3..24cfd11 100755
> --- a/testcases/network/tcp_cmds/telnet/telnet01
> +++ b/testcases/network/tcp_cmds/telnet/telnet01
> @@ -41,6 +41,7 @@ set TC telnet
> set TCtmp "/tmp"
> set SLEEPTIME 3
> set TESTLOG "$TCtmp"
> +set PROMPT "Alpha Bravo"
>
> if [info exists env(RUSER)] {
> set RUSER $env(RUSER)
> @@ -83,20 +84,21 @@ while {$count < $LOOPCOUNT} {
> # telnet to the host
> spawn telnet $HOST
> expect -re "login:"
> - sleep 1
> +
> send "$RUSER\r"
> expect -re "Password:"
> - sleep 1
> +
> send "$PASSWD\r"
>
> + send "PS1=\"$PROMPT\"\r"
> # Wait for shell prompt
> - expect -re "$RUSER@"
> + expect "$PROMPT"
>
> # Run passwd command - and respond to its prompts
> send "LC_ALL=C ls -l /etc/hosts | wc -w > $TESTLOG/$RUSER.$HOST \r"
> # When shell prompt comes back, logout
>
> - expect -re "$RUSER@"
> + expect "$PROMPT"
> exp_send "logout\r"
>
> send_user "CHECKING TELNET STATUS\n"
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next parent reply other threads:[~2009-06-25 9:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200906240117.n5O1H5O0007047@e2.ny.us.ibm.com>
2009-06-25 9:09 ` Subrata Modak [this message]
2009-06-10 11:05 [LTP] [PATCH] Use custom prompt in the telnet test, to avoid timeouts in case the user's prompt doesn't contain hostname Jiri Palecek >
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=1245920993.5542.35.camel@subratamodak.linux.ibm.com \
--to=subrata@linux.vnet.ibm.com \
--cc=jpalecek@web.de \
--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