* Re: [LTP] [PATCH] Use custom prompt in the telnet test, to avoid timeouts in case the user's prompt doesn't contain hostname
[not found] <200906240117.n5O1H5O0007047@e2.ny.us.ibm.com>
@ 2009-06-25 9:09 ` Subrata Modak
0 siblings, 0 replies; 2+ messages in thread
From: Subrata Modak @ 2009-06-25 9:09 UTC (permalink / raw)
To: Jiri Palecek; +Cc: ltp-list
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [LTP] [PATCH] Use custom prompt in the telnet test, to avoid timeouts in case the user's prompt doesn't contain hostname
@ 2009-06-10 11:05 Jiri Palecek >
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Palecek > @ 2009-06-10 11:05 UTC (permalink / raw)
Cc: ltp-list
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>
---
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"
--
1.6.3.1
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-25 9:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <200906240117.n5O1H5O0007047@e2.ny.us.ibm.com>
2009-06-25 9:09 ` [LTP] [PATCH] Use custom prompt in the telnet test, to avoid timeouts in case the user's prompt doesn't contain hostname Subrata Modak
2009-06-10 11:05 Jiri Palecek >
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox