Re: Filtering certain message from expect internal buffer

From: Bruce Hartweg (bruce-news_at_hartweg.us)
Date: 08/10/04


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



Relevant Pages

  • Re: Filtering certain message from expect internal buffer
    ... Bruce Hartweg writes: ... >> There's no way to write back to Expect's internal buffer. ... > add all kinds of special handling throughout the rest of the script. ... > instaed of script A reading ther console directly ...
    (comp.lang.tcl)
  • Re: Move computers account to another OU from a txt list
    ... I need a script, that list from OU or txt file, that contains machine ... user objects by changing the ADO filter in the loop. ... ' Change the base of the query to a specific OU. ... ' Filter on all user objects. ...
    (microsoft.public.windows.server.scripting)
  • Re: Problem with Javascript with TDC control
    ... The problem is in getting the total after doing a display and then refreshing the TDC (which invokes the script filter()). ... I tried to put similar looping code at the end of filterto examine what I get from the TDC refresh, but I got a messages of "Operation is not allowed when the object is closed". ... The call of a filter is done in a javascript routine with setting the DataURL and doing inquiry.Resetwhere inquiry is the name of the dataset object. ...
    (comp.lang.javascript)
  • Re: problem using -f file operator
    ... Hi, sorry for the missing information it is my first post here, ... -file: Set the filter file. ... when the script is executed $item contains a full path to ... CONFIG GEN SELECTORS SECTION ...
    (perl.beginners)
  • Re: Type of memory in VMR9 allocator
    ... when there's another downstream filter that is ALSO doing the extra copy. ... If he connects to a video renderer with my suggestion: ... If he connects to a transform filter with my suggestion: ... His filter copies the internal buffer to the output sample (owned ...
    (microsoft.public.win32.programmer.directx.video)