Re: MI testsuite to use PTY for inferior

Nick Roberts
2005-07-30T22:47:46Z

> > > With these arguments, you can't discriminate between
> > >
> > > mi_gdb_test COMMAND PATTERN MESSAGE
> > >
> > > and
> > >
> > > mi_gdb_test COMMAND PATTERN IPATTERN
> > >
> > > (MESSAGE is optional).
> >
> > Yeah, this does look like a problem. Thanks. Is there a good way to work
> > around this in TCL? Or should I make the IPATTERN parameter necessary?
> > Force the user to put "" for IPATTERN?
> >
> > Or rather, should I make the MESSAGE parameter necessary? I have a feeling
> > that all of the MI tests use the MESSAGE parameter. If I do that, I can
> > make the IPATTERN parameter optional, and last.
>
> You're adding a new parameter; having it optional is fine, as long as
> you add it after all existing optional parameters. COMMAND PATTERN
> IPATTERN MESSAGE is more intuitive, but I think that's less important
> than correctness, so I would recommend COMMAND PATTERN [MESSAGE
> [IPATTERN]]. Make sense?

That seems to imply that if IPATTERN is present, MESSAGE can't be omitted.
How about:

# mi_gdb_test COMMAND PATTERN-LIST [MESSAGE]
...
# PATTERN-LIST is the list {PATTERN [IPATTERN]} where:
# PATTERN is the pattern to match for a PASS, and must NOT include
# the \r\n sequence immediately before the gdb prompt.
# IPATTERN is the pattern to match for the inferior's output. This will not
# produce a PASS if successfull, but will produce a FAIL if unsuccessful.

if {[llength $PATTERN-LIST] == 1} {
...
} elseif {[llength $PATTERN-LIST] == 2} {
...

This seems to be compatible with existing arguments as scalars seem to be
considered as lists of length 1. But perhaps you can't have lists within
argument lists in TCL.

Nick