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 <[email protected]>
---
 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to