WL#3950: mysqltest per-command filter of error log messages
Affects: Server-7.1
—
Status: Un-Assigned
The current test framework examines the mysqld error log at the end of the test run, and filters out "acceptable" warning/error messages based on a global list of regexps, and then complains about any remaining messages in the log. This isn't a good solution; some tests intentionally cover parts of code which emit warnings/errors in the log, and so they should be able to REQUIRE that the warning is present. Likewise, the warning should NOT be present under any other circumstances. So we need much more fine-grained filtering of messages in the error log. It should be relatively easy to add per-test warnings filters in the test-master.opt file. We already have mtr-specific options in that file which are not passed on to the mysqld. Ideally, we would add a command in mysqltest to specify a warning filter for a single command, and mysqltest would check the log file(s) after each command is run.
Proposal for the .opt solution (can be specified multiple times): --mtr-warnings-filter='/some [Rr]egexp? here/' Proposal for the mysqltest command solution: --let $msg = 'some message' --errlog REQUIRE /^$msg which must be emmitted during the statement/ --errlog IGNORE /^$msg which m(ay|ight) be emmitted .../ select foo, bar from baz ...;
For the simple .opt solution: Add these values to a (global?) hash $warnings_filters{$tname}, and change mtr_report.pl to: 1) combine all global warnings filters into a single regex; this will make matching faster and simpler[*] 2) combine all test-specific warnings filters into another regex (should be done in mtr_cases.pl when done reading .opt file) 3) change test to something like: if (/$global_warnings_filters_regex/ or $warnings_filters{$testname} and /$warnings_filters{$testname}/) { # Skip non-fatal or expected warnings next; } [*] To do this, either use something like Regexp::Assemble, or the simpler method of joining the regexps with |, as described in perlfaq6: $regex = join '|', qw( foo bar baz ); LINE: while(<>) { print if /\b(?:$regex)\b/i; }
Copyright (c) 2000, 2024, Oracle Corporation and/or its affiliates. All rights reserved.