tags:

views:

103

answers:

1

I have some ncurses apps that I need to automate to test repeatedly. I am placing the "sleep" command between "send" commands. However, what i see is that all the sleep's are executed in the beginning before the screen loads. expect concatenates the sends (I see that at the screen bottom during sleep) then issues them together.

I have tried sending all keys with "send -s" or "send -h". That marginally helps. I've replaced "-f" on line 1 with "-b" - again a tiny difference.

Why isn't "sleep" pausing at the right time. Incidentally, my programs have a getc() loop, so i can't use "expect" command. I tried that too.

#!/usr/bin/expect -f
spawn ruby testsplit.rb
#expect
set send_human {3 3 5 5 7}
set send_slow {10 1}
exp_send -s -- "--"
exec sleep 3
send -s "+"
send -s "="
sleep 1
send -h -- "-"
send -h -- "-"
sleep 1
send -h  -- "v"
interact
A: 

I would guess that you need to wait for your ruby program to start up before you continue with the sends and sleeps. Is there any string the ruby program outputs when it has started (eg. "ready") ? If so, at the point where you have expect commented out I would try expect "ready" so that Expect will wait until the ruby program has started before continuing.

Colin Macleod
Nope. If there was a string, i would have used that. There's a screen with fields, but no string output.
rahul