If an expected error is specified and that error occurs, mysqltest continues reading input. If the command is successful or a different error occurs, mysqltest aborts.
If no expected error is specified, mysqltest
aborts unless the command is successful. (It is implicit that you
expect $mysql_errno
to be 0.)
By default, mysqltest aborts for certain conditions:
A statement that fails when it should have succeeded. The
following statement should succeed if table
t
exists;
SELECT * FROM t;
A statement that fails with an error different from that specified:
--error 1 SELECT * FROM no_such_table;
A statement that succeeds when an error was expected:
--error 1 SELECT 'a string';
You can disable the abort for errors of the first type by using
the disable_abort_on_error
command. In this
case, when errors occur for statements that should succeed,
mysqltest continues processing intput.
disable_abort_on_error
does
not cause mysqltest to
ignore errors for the other two types, where you explicitly state
which error you expect. This behavior is intentional. The
rationale is that if you use the error
command
to specify an expected error, it is assumed that the test is
sufficiently well characterized that only the specified error is
accceptable.
If you do not use the error
command, it is
assumed that you might not know which error to expect or that it
might be difficult to characterize all possible errors that could
occur. In this case, disable_abort_on_error
is
useful for causing mysqltest to continue
processing input. This can be helpful in the following
circumstances:
During test case development, it is useful to process all input even if errors occur so that you can see all errors at once, such as those that occur due to typographical or syntax errors. Otherwise, you can see and fix only one scripting problem at a time.
Within a file that is included with a
source
command by several different test
cases, errors might vary depending on the processing
environment that is set up prior to the
source
command.
Tests that follow a given statement that can fail are independent of that statement and do not depend on its result.