A named pipe (FIFO) is meant to be opened twice, once for reading only and once for writing only. Generally, the two ends of a named pipe are expected to be opened by different processes although it should still work if one process opens both.

At the least, you should fork at the beginning of testSequence and have the parent return immediately to the event loop. (You will have to handle synchronization for completing the test and reporting a result back to the parent separately; pipe is likely to be useful for this and I have used it in a number of Tk programs to handle slow background tasks in child processes without blocking the GUI thread.) This will effectively require another event-driven task in the parent to verify the state machine behavior as the child makes incremental progress reports, since the test driver and FSM will be in separate processes.

If you insist on your current approach, inserting recursive calls to the event loop to process the events you create in testSequence is exactly what you must do.


In reply to Re^4: testing of named pipes by jcb
in thread testing of named pipes by lalu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.