Blob Blame History Raw
mysql_plugin.test fails when run in mysql-test RPM, though the build-time
regression test is OK.  This patch is from the pre-existing upstream bug
report, except we also fix the part that tries to scribble on the
read-only-to-us plugin directory.

rhbz #789530, upstream at http://bugs.mysql.com/bug.php?id=62907


diff -up mysql-5.5.21/mysql-test/t/mysql_plugin-master.opt.plugin mysql-5.5.21/mysql-test/t/mysql_plugin-master.opt
--- mysql-5.5.21/mysql-test/t/mysql_plugin-master.opt.plugin	2012-01-31 12:28:15.000000000 +0100
+++ mysql-5.5.21/mysql-test/t/mysql_plugin-master.opt	2012-03-14 16:54:19.060951822 +0100
@@ -1 +1 @@
---plugin-dir=$DAEMONEXAMPLE_DIR
+--plugin-dir=$MYSQLTEST_VARDIR/plugin
diff -up mysql-5.5.21/mysql-test/t/mysql_plugin.test.plugin mysql-5.5.21/mysql-test/t/mysql_plugin.test
--- mysql-5.5.21/mysql-test/t/mysql_plugin.test.plugin	2012-01-31 12:28:15.000000000 +0100
+++ mysql-5.5.21/mysql-test/t/mysql_plugin.test	2012-03-14 17:11:40.769295981 +0100
@@ -25,8 +25,10 @@
 # Add the datadir, basedir, plugin_dir to the bootstrap command
 let $MYSQLD_DATADIR= `select @@datadir`;
 let $MYSQL_BASEDIR= `select @@basedir`;
+let $MYSQLD_TMP_BASEDIR= $MYSQLTEST_VARDIR/tmp;
 let $MYSQL_ERRMSG_BASEDIR=`select @@lc_messages_dir`;
 let $PLUGIN_DIR=`select @@plugin_dir`;
+let $PLUGIN_BASEDIR=$DAEMONEXAMPLE_DIR;
 
 --disable_abort_on_error
 
@@ -51,10 +53,11 @@ use File::Basename;
   {
     print FILE "let \$DAEMONEXAMPLE_DIR= $not_found;\n";
   }
-  if ((!-e $plugindir_ini) || (!-r $plugindir_ini))
-  {
-    print FILE "let \$PLUGIN_DIR= $not_found;\n";
-  }
+# This test doesn't work because $ENV{PLUGIN_DIR} is empty
+#  if ((!-e $plugindir_ini) || (!-r $plugindir_ini))
+#  {
+#    print FILE "let \$PLUGIN_DIR= $not_found;\n";
+#  }
   close FILE;
 EOF
 
@@ -66,10 +69,14 @@ remove_file $MYSQL_TMP_DIR/mysqld.inc;
 # mysql version, so errmsg.sys will be copied to "basedir/share", we create
 # and remove this structure. 
 
---mkdir $MYSQLD_BASEDIR/share
---mkdir $MYSQLD_BASEDIR/share/mysql
---copy_file $MYSQL_ERRMSG_BASEDIR/english/errmsg.sys $MYSQLD_BASEDIR/share/errmsg.sys
---copy_file $MYSQL_ERRMSG_BASEDIR/english/errmsg.sys $MYSQLD_BASEDIR/share/mysql/errmsg.sys
+--mkdir $MYSQLD_TMP_BASEDIR/share
+--mkdir $MYSQLD_TMP_BASEDIR/share/community-mysql
+--mkdir $PLUGIN_DIR
+--copy_file $MYSQL_ERRMSG_BASEDIR/english/errmsg.sys $MYSQLD_TMP_BASEDIR/share/errmsg.sys
+--copy_file $MYSQL_ERRMSG_BASEDIR/english/errmsg.sys $MYSQLD_TMP_BASEDIR/share/community-mysql/errmsg.sys
+--copy_file $PLUGIN_BASEDIR/libdaemon_example.so $PLUGIN_DIR/libdaemon_example.so
+--copy_file $PLUGIN_BASEDIR/daemon_example.ini $PLUGIN_DIR/daemon_example.ini
+
 
 # The mysql_plugin tool now accepts --my-print-defaults which points to the
 # executable my_print_defaults.exe we can get this path from the variable
@@ -100,7 +107,7 @@ if ($PLUGIN_DIR == '')
 
 # Build client command for reuse.
 
-let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR;
+let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_TMP_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR;
 
 --echo #
 --echo # Ensure the plugin isn't loaded.
@@ -202,7 +209,7 @@ EOF
 # we must copy the example daemon to a new location renaming it.
 
 let $DAEMON_RELOAD = lib$DAEMONEXAMPLE;
---copy_file $PLUGIN_DIR/$DAEMONEXAMPLE $PLUGIN_DIR/$DAEMON_RELOAD
+--copy_file $PLUGIN_BASEDIR/$DAEMONEXAMPLE $PLUGIN_DIR/$DAEMON_RELOAD
 --copy_file include/libdaemon_example.ini $PLUGIN_DIR/libdaemon_example.ini
 
 # Now reload it and see that it is a different name.
@@ -395,8 +402,11 @@ EOF
 --remove_file $expect_file
 
 # Cleanup the share folder in the binary path.
---remove_file $MYSQLD_BASEDIR/share/errmsg.sys
---rmdir $MYSQLD_BASEDIR/share/mysql
---rmdir $MYSQLD_BASEDIR/share
+--remove_file $PLUGIN_DIR/daemon_example.ini
+--remove_file $PLUGIN_DIR/libdaemon_example.so
+--rmdir $PLUGIN_DIR
+--remove_file $MYSQLD_TMP_BASEDIR/share/errmsg.sys
+--rmdir $MYSQLD_TMP_BASEDIR/share/community-mysql
+--rmdir $MYSQLD_TMP_BASEDIR/share
 
 --enable_abort_on_error