summaryrefslogtreecommitdiff
path: root/mysql-test/lib/mtr_match.pm
diff options
context:
space:
mode:
authorunknown <msvensson@pilot.mysql.com>2008-04-08 16:51:26 +0200
committerunknown <msvensson@pilot.mysql.com>2008-04-08 16:51:26 +0200
commit2c4ca510507a8055cdb58d9c0631f5d630e55d90 (patch)
tree638f44865386631837ba11df359423bbc7d0d615 /mysql-test/lib/mtr_match.pm
parent7674605d7940b428a8bbfe23fd0ef497e99c60c1 (diff)
downloadmariadb-git-2c4ca510507a8055cdb58d9c0631f5d630e55d90.tar.gz
Check warnings in servers error log as part of test case
BitKeeper/deleted/.del-rpl_bug33931-slave.opt: Delete: mysql-test/suite/rpl/t/rpl_bug33931-slave.opt mysql-test/include/default_mysqld.cnf: Set a default name for "log-bin" mysql-test/mysql-test-run.pl: Check for warnings in mysqld error log files after each testcase, using SQL mysql-test/lib/mtr_cases.pm: Make mtr_match into a perl module mysql-test/lib/mtr_match.pm: Make mtr_match into a perl module mysql-test/lib/mtr_report.pm: Make mtr_match into a perl module Print warnings if testcase failed from warnings mysql-test/r/information_schema.result: Be more selective which databases and tables are select in the queries mysql-test/r/mysql_upgrade.result: Update result, mysql_upgrade will check _all_ databases mysql-test/r/mysqlcheck.result: Update result, mysql_upgrade should check _all_ databases mysql-test/r/sp-destruct.result: Be more selective which databases and tables are select in the queries mysql-test/r/sp-error.result: Backup and restore mysql.proc table mysql-test/r/sp-security.result: Be more selective which databases and tables are select in the queries mysql-test/r/sp.result: Be more selective which databases and tables are select in the queries mysql-test/suite/rpl/r/rpl_bug33931.result: Move the setting of debug flag into the test file instead of in -slave.opt Add supression mysql-test/suite/rpl/r/rpl_idempotency.result: Add supression Add master-slave-end.inc mysql-test/suite/rpl/t/rpl_bug33931.test: Move the setting of debug flag into the test file instead of in -slave.opt Add supression mysql-test/suite/rpl/t/rpl_idempotency.test: Add supression Add master-slave-end.inc mysql-test/t/information_schema.test: Be more selective which databases and tables are select in the queries mysql-test/t/sp-destruct.test: Be more selective which databases and tables are select in the queries mysql-test/t/sp-error.test: Backup and restore mysql.proc table mysql-test/t/sp-security.test: Be more selective which databases and tables are select in the queries mysql-test/t/sp.test: Be more selective which databases and tables are select in the queries mysql-test/include/check-warnings.test: New BitKeeper file ``mysql-test/include/check-warnings.test'' mysql-test/include/mtr_warnings.sql: New BitKeeper file ``mysql-test/include/mtr_warnings.sql''
Diffstat (limited to 'mysql-test/lib/mtr_match.pm')
-rw-r--r--mysql-test/lib/mtr_match.pm97
1 files changed, 97 insertions, 0 deletions
diff --git a/mysql-test/lib/mtr_match.pm b/mysql-test/lib/mtr_match.pm
new file mode 100644
index 00000000000..40afd4e0336
--- /dev/null
+++ b/mysql-test/lib/mtr_match.pm
@@ -0,0 +1,97 @@
+# -*- cperl -*-
+# Copyright (C) 2004-2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This is a library file used by the Perl version of mysql-test-run,
+# and is part of the translation of the Bourne shell script with the
+# same name.
+
+package mtr_match;
+use strict;
+
+use base qw(Exporter);
+our @EXPORT= qw(mtr_match_prefix
+ mtr_match_extension
+ mtr_match_substring);
+
+#
+# Match a prefix and return what is after the prefix
+#
+sub mtr_match_prefix ($$) {
+ my $string= shift;
+ my $prefix= shift;
+
+ if ( $string =~ /^\Q$prefix\E(.*)$/ ) # strncmp
+ {
+ return $1;
+ }
+ else
+ {
+ return undef; # NULL
+ }
+}
+
+
+#
+# Match extension and return the name without extension
+#
+sub mtr_match_extension ($$) {
+ my $file= shift;
+ my $ext= shift;
+
+ if ( $file =~ /^(.*)\.\Q$ext\E$/ ) # strchr+strcmp or something
+ {
+ return $1;
+ }
+ else
+ {
+ return undef; # NULL
+ }
+}
+
+
+#
+# Match a substring anywere in a string
+#
+sub mtr_match_substring ($$) {
+ my $string= shift;
+ my $substring= shift;
+
+ if ( $string =~ /(.*)\Q$substring\E(.*)$/ ) # strncmp
+ {
+ return $1;
+ }
+ else
+ {
+ return undef; # NULL
+ }
+}
+
+
+sub mtr_match_any_exact ($$) {
+ my $string= shift;
+ my $mlist= shift;
+
+ foreach my $m (@$mlist)
+ {
+ if ( $string eq $m )
+ {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+1;