Documentation Home
The MySQL Test Framework, Version 2.0
Download this Manual
PDF (US Ltr) - 0.6Mb
PDF (A4) - 0.6Mb
EPUB - 132.2Kb


The MySQL Test Framework, Version 2.0  /  Writing Test Cases  /  Suppressing Errors and Warning

4.15 Suppressing Errors and Warning

After a test is finished, and if it didn't fail for some other reason, mysql-test-run.pl will check the log written by the server(s) during the test for any warnings or errors. If it finds any, it will print them out and the test will be reported as failed.

However, many warnings and also a few errors may occur normally without signifying a real problem. Also, many tests purposefully perform actions that will provoke warnings. For these not to result in a test failure, it is possible to specify that certain messages are to be suppressed.

There is a list of global suppressions; warnings that will always be suppressed. These are listed in the file include/mtr_warnings.sql. Any error or warning that contains one of the listed strings will be ignored. It is not necessary to include the whole text, and regular expressions can be used, such as .* to match any substring or [0-9]* to match any number.

You will rarely need to change or add to this global list, but you may need to suppress a particular error or warning for a new test case. A typical case is a test that performs some illegal action on purpose to test the respone; if this also results in a warning in the server log, this should not cause this particular test to fail.

To add a suppresion for a warning text like for example The table 't23456' is full where the number in the table name can vary, add this line anywhere in the test case file:

call mtr.add_suppression("The table 't[0-9]*' is full");

This may be put anythere in the test, but we recommend putting it either near the top, or just after the action that may result in the warning. If you're adding this line to an existing test, keep in mind that it will be echoed in the output, so the exact same line also needs to be added to the corresponding place in the result file. Alternatively, you may turn off logging like this, and will then not have to edit the result file:

--disable_query_log
call mtr.add_suppression("The table 't[0-9]*' is full");
--enable_query_log

It is also possible to intruct mysql-test-run.pl to skip the check for errors and warnings completely, by use of the --nowarnings command line option.