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.31/mysql-test/t/mysql_plugin-master.opt.p17 mysql-5.5.31/mysql-test/t/mysql_plugin-master.opt
--- mysql-5.5.31/mysql-test/t/mysql_plugin-master.opt.p17	2013-03-25 14:14:58.000000000 +0100
+++ mysql-5.5.31/mysql-test/t/mysql_plugin-master.opt	2013-04-19 13:38:23.761741532 +0200
@@ -1 +1 @@
---plugin-dir=$DAEMONEXAMPLE_DIR
+--plugin-dir=$MYSQLTEST_VARDIR/plugin
diff -up mysql-5.5.31/mysql-test/t/mysql_plugin.test.p17 mysql-5.5.31/mysql-test/t/mysql_plugin.test
--- mysql-5.5.31/mysql-test/t/mysql_plugin.test.p17	2013-03-25 14:14:58.000000000 +0100
+++ mysql-5.5.31/mysql-test/t/mysql_plugin.test	2013-04-19 13:38:25.606742145 +0200
@@ -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/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/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.
@@ -184,7 +191,7 @@ SELECT * FROM mysql.plugin WHERE dl like
 # 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.
@@ -361,8 +368,11 @@ replace_result $MYSQL_PLUGIN mysql_plugi
 --remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
 
 # 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/mysql
+--rmdir $MYSQLD_TMP_BASEDIR/share
 
 --enable_abort_on_error