Blame tests/login/ssh.exp

7f89380
#!/usr/bin/expect -f
7f89380
#
7f89380
# This Expect script was generated by autoexpect on Mon Jan 18 05:25:00 2016
7f89380
# Expect and autoexpect were both written by Don Libes, NIST.
7f89380
#
7f89380
# Note that autoexpect does not guarantee a working script.  It
7f89380
# necessarily has to guess about certain things.  Two reasons a script
7f89380
# might fail are:
7f89380
#
7f89380
# 1) timing - A surprising number of programs (rn, ksh, zsh, telnet,
7f89380
# etc.) and devices discard or ignore keystrokes that arrive "too
7f89380
# quickly" after prompts.  If you find your new script hanging up at
7f89380
# one spot, try adding a short sleep just before the previous send.
7f89380
# Setting "force_conservative" to 1 (see below) makes Expect do this
7f89380
# automatically - pausing briefly before sending each character.  This
7f89380
# pacifies every program I know of.  The -c flag makes the script do
7f89380
# this in the first place.  The -C flag allows you to define a
7f89380
# character to toggle this mode off and on.
7f89380
7f89380
set force_conservative 0  ;# set to 1 to force conservative mode even if
7f89380
            ;# script wasn't run conservatively originally
7f89380
if {$force_conservative} {
7f89380
        set send_slow {1 .1}
7f89380
        proc send {ignore arg} {
7f89380
         sleep .1
7f89380
         exp_send -s -- $arg
7f89380
        }
7f89380
}
7f89380
7f89380
#
7f89380
# 2) differing output - Some programs produce different output each time
7f89380
# they run.  The "date" command is an obvious example.  Another is
7f89380
# ftp, if it produces throughput statistics at the end of a file
7f89380
# transfer.  If this causes a problem, delete these patterns or replace
7f89380
# them with wildcards.  An alternative is to use the -p flag (for
7f89380
# "prompt") which makes Expect only look for the last line of output
7f89380
# (i.e., the prompt).  The -P flag allows you to define a character to
7f89380
# toggle this mode off and on.
7f89380
#
7f89380
# Read the man page for more info.
7f89380
#
7f89380
# -Don
7f89380
7f89380
set timeout -1
7f89380
spawn "/bin/shellbin"
7f89380
match_max 100000
7f89380
expect "# "
7f89380
send -- "ssh -o 'StrictHostKeyChecking no' shelluser@localhost\r"
7f89380
expect "password: "
7f89380
send -- "krava\r"
7f89380
sleep 1
7f89380
send -- "echo \$0 | tee ps3.log\r"
7f89380
send -- "\r"
7f89380
send -- "(bash /home/shelluser/tst.sh &)"
7f89380
expect -exact "(bash /home/shelluser/tst.sh &)"
7f89380
send -- "\r"
7f89380
send -- "\r"
7f89380
send -- "\r"
7f89380
send -- "fg\r"
7f89380
send -- "\r"
7f89380
send -- "\r"
7f89380
send -- "\r"
7f89380
send -- "ls\r"
7f89380
send -- "^D"
7f89380
expect "# "
7f89380
send -- "^D"
7f89380
expect eof