Re: Questions about Expect buffers & operation



In article <oBhog.5$Qu1.0@xxxxxxxxxxxxxxxxxxxxxxxx>,
Bruce Hartweg <bruce-news@xxxxxxxxxx> wrote:

you don't have to actually send the characters - just expect something you know
doesn't exist - it'll force a read of all available data

expect -timeout 1 "THIS_WILL_NEVER_EVER_SHOW_UP_IN_MY_SPAWNED_PROGRAM" ;# force read
expect -re ".*" ;# clear internal buffer

The problem with this is that there will be at least a one second delay (from
the timeout). In my case that's a killer. From the experiments I did, it
looked like when I sent some characters to the channel that I could then turn
around and match against, the expect command completed much quicker than one
second. The trick was trying to find a character sequence that I could send
out the channel to the virtual console that would not have an adverse effect
on the console.



Oh well, I was warned when I started that this
partitular test would probably resist being scripted and I'm reluctantly
coming to the same conclusion.


don't give up yet, expect scales very well (I worked on a large supercomputing
cluster that all sysadmin was done via expect - from a single command line you
could start with 1000's of computers and it could do a complete setup from scratch
RIS boot the boxes, install the OS, configure all clustering software, create
all the needed filesystems, etc.

you say you are dealing with multiple spawned processes, you do know you
can handle them all at once with a singe expect right? you do not have to
look at them one at a time. Give a list of all the spawn_ids and it'll macth
against all of them.

If I were working with multiple spawned processes, this would be a snap.
Unfortunately, it is a SINGLE spawned process that I'm dealing with. At the
other end of the channel is a virtual console switcher task that, when it
receives a ^A character, switches from one console to the next. An analogy
might be an ASCII terminal connected to an RS-232 switch which then connects
to several individual computers. The switch allows you to flip between
between the consoles of the various computers. The things that complicate
this "picture" are the fact that you can't select a specific switch setting
and be guaranteed to be talking to the desired computer - you can only send
a command (^A) and switch to the next port. If a computer is non-responsive
(for example, it's rebooting and has not yet started putting out characters)
the switcher silently advances to the next responsive port. The switcher will
inject the name of the console into the data stream at the time of the switch,
but this is not necessarily the first thing you will see after sending a ^A;
this is due to possible characters still in the channels output buffer (not
the Expect internal buffer) at the time of the switch. This is the reason I
was trying to find a way to flush the channel buffer before sending a ^A. As
I mentioned in a previous post, there are cases where I have 10 seconds to
locate the virtual console of interest so that I can send a code that will
stop the computer behind it from rebooting automatically. In an extreme case
there could be a couple of dozen virtual console connections behind the
switcher on my channel. Basically, I have to send a ^A to switch to the next
virtual console and then try to locate the name of the console somewhere in
the data stream (which has been injected into the data stream by the switcher).
If I have not fully flushed the channel, there could be the name of one or
more previous consoles still in the data stream, including the one I'm looking
for. If all this wasn't bad enough, there are cases where the virtual console
switcher will automatically switch to a specific console without my knowing it
(and without my sending a ^A). So even if I do manage to locate the console of
interest, it can be silently switched out from under me. This is the first
time in my (expect programming) experience that I have dealt with an interface
whose response was, at least in some cases, non-deterministic. This script is
part of a final test for a large partitionable server system and I've come a
lot closer than others that have tried to script this. Unfortunately, unless
it's bullet-proof then it's not something that we can turn over to one of the
techs to run as part of the overall testing. However, I appreciate your
insights and the time you've taken to respond to this.

Dave


.



Relevant Pages

  • Re: Questions about Expect buffers & operation
    ... it looked like when I sent some characters to the channel that I could then turn ... out the channel to the virtual console that would not have an adverse effect ... to several individual computers. ... The switch allows you to flip between between the consoles of the various computers. ...
    (comp.lang.tcl)
  • Re: mtx_lock_do_what_i_mean()
    ... reducing from multiple active broken console drivers to a single ... fairly usual case where the user has only 1 set of console hardware. ... FreeBSD and all of it in my debugger's i/o routines: ... Natural switch points for ddb are on entry to and exit from interactive ...
    (freebsd-arch)
  • Re: Very slim Desktop Manager
    ... So there is no need to switch ... but there would be a need to switch away from the console. ... Linux is not OpenBSD which is limited to 80x25 and 80x50 consoles. ... that one card support it wonderfully and the other one flackly. ...
    (Debian-User)
  • Re: 2001 Honda Prelude automatic transmission fails to start
    ... Brad wrote: ... open up the console and start investigating. ... Older models had a "console switch" which followed the shift lever to tell the car what gear was selected. ... Apparently this dealership doesn't have anyone competent to troubleshoot electrical problems very well. ...
    (rec.autos.makers.honda)
  • Re: [PATCH TO TEST] VESA [1024x768] mode support for FreeBSD-CURRENT
    ... Michal Mertl wrote: ... >>I feel like I am missing a lot here. ... I want to display 132 characters per ... > who didn't have text mode console covering all LCD surface. ...
    (freebsd-questions)