Make gdb_test's question non-optional if specified
gdb_test supports handling scenarios where GDB asks a question before
finishing handling some command. The full prototype of gdb_test is:
# gdb_test COMMAND PATTERN MESSAGE QUESTION RESPONSE
However, QUESTION is a question that GDB _may_ ask, not one that GDB
_must_ ask:
# QUESTION is a question GDB may ask in response to COMMAND, like
# "are you sure?"
# RESPONSE is the response to send if QUESTION appears.
If GDB doesn't raise the question, the test still passes.
I think that this is a misfeature. If GDB regresses and stops asking
a question, the testsuite won't notice. So I think that if a QUESTION
is specified, gdb_test should ensure it comes out of GDB.
Running the testsuite exposed a number of tests that pass
QUESTION/RESPONSE to GDB, but no question comes out. The previous
commits fixed them all, so this commit changes gdb_test's behavior.
A related issue is that gdb_test doesn't enforce that if you specify
QUESTION, that you also specify RESPONSE. I.e., you should pass 1, 2,
3, or 5 arguments to gdb_test, but never 4, or more than 5. Making
gdb_test detect bogus arguments actually regressed some testcases,
also all fixed in previous commits.
Change-Id: I47c39c9034e6a6841129312037a5ca4c5811f0db