Re: Filtering certain message from expect internal buffer
From: Bruce Hartweg (bruce-news_at_hartweg.us)
Date: 08/10/04
- Next message: Joey Mukherjee: "Local domain sockets"
- Previous message: fryxar_at_datafull.com: "Problems with expect and Fedora / Gentoo"
- In reply to: Don Libes: "Re: Filtering certain message from expect internal buffer"
- Next in thread: Don Libes: "Re: Filtering certain message from expect internal buffer"
- Reply: Don Libes: "Re: Filtering certain message from expect internal buffer"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 10 Aug 2004 10:07:47 -0500
Don Libes wrote:
> eydelv@pacbell.net (Viktor) writes:
>
>
>>Does anybody know how I can implement a filter that will take certain
>>messages out of Expect's internal buffer while keeping all other data
>>intact? The best would be if I could match a pattern, take the data
>>matched in expect_out(0,string) out of expect_out(buffer) and put
>>what's left in expect_out(buffer) back in the internal buffer for
>>further matching. This could be done with expect_before and it would
>>not disturb existing scripts. I even think that I saw some exapmle on
>>how this can be done somewhere, but I am not sure about it anymore...
>>I tried to find it in Don's book but I could not.
>
>
> There's no way to write back to Expect's internal buffer.
>
>
>>Are there other ways of implementing such 'pre-filter'? Here is what
>>I'm trying to solve: the systems we work with can occasionally spit
>>out error/status messages that mess up the output and interfere with
>>the test scripts. I cannot re-write all the scripts to handle
>>additional messages or prevent the messages from being generated.
>
>
> I'm confused. Earlier you said you could do it with expect_before and
> it would not disturb existing scripts. So why don't you just use
> expect_before?
>
I think he meant that if you *could* write back to the internal
buffer, he could do this in an expect befiore block and not have to
add all kinds of special handling throughout the rest of the script.
My guess is he is expecting directly on the console & syslog type
warnings/errors are being insterted intermittantly at random times
which cause the matching logic to get hosed...
i.e. if script is looking for "Foo Bar is Complete", then sometimes
it works, other times what is actually seen is
"Foo BSOME ERROR HAS OCCURREDar is Complete"
and the message could be anywhere within the expected string.
the OP probably knows a list of possible errors that could get
sent and wants to strip them out, but since normal matching also
eats up part of his desired string he is looking for a way to put
back so the expected match works later. As you have said though
you can't write back to the internal buffer.
Maybe a seperate process is the answer
instaed of script A reading ther console (or whatwever source) directly
have it spawn a simple filter script that watches the console and just
echoes everything out (except for filtering out the known error messages)
and then have scirpt A act on this filtered output.
Bruce
- Next message: Joey Mukherjee: "Local domain sockets"
- Previous message: fryxar_at_datafull.com: "Problems with expect and Fedora / Gentoo"
- In reply to: Don Libes: "Re: Filtering certain message from expect internal buffer"
- Next in thread: Don Libes: "Re: Filtering certain message from expect internal buffer"
- Reply: Don Libes: "Re: Filtering certain message from expect internal buffer"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|