From a38fc8d47e121e15b82e26b5bffecb9c3d5801ee Mon Sep 17 00:00:00 2001 From: Chuck Bell Date: Tue, 19 Jul 2011 10:17:58 -0400 Subject: WL#5710 : mysql_plugin - enable or disable plugins This patch adds a new client utility that enables or disables plugin features. The utility disables or enables a plugin using values (name, soname, and symbols) provided via a configuration file by the same name. For example, to ENABLE the daemon_example plugin, the utility will read the daemon_example.ini configuration file and use the values contained to enable or disable the plugin. --- mysql-test/t/mysql_plugin.test | 205 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 205 insertions(+) create mode 100644 mysql-test/t/mysql_plugin.test (limited to 'mysql-test/t/mysql_plugin.test') diff --git a/mysql-test/t/mysql_plugin.test b/mysql-test/t/mysql_plugin.test new file mode 100644 index 00000000000..3257adfeb61 --- /dev/null +++ b/mysql-test/t/mysql_plugin.test @@ -0,0 +1,205 @@ +# +# Test mysql_plugin tool +# + +# +# Test currently does not run on Windows because in Windows build trees, +# mysqld.exe is not placed in the ./sql folder - it is placed either +# in ./sql/Debug or ./sql/release. If this behaviour is changed, this test +# can run on Windows. +# +--source include/not_windows.inc + +# Add the datadir, basedir, plugin_dir to the bootstrap command +let $MYSQLD_DATADIR= `select @@datadir`; +let $MYSQLD_BASEDIR= `select @@basedir`; +let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR/sql --plugin-dir=$DAEMONEXAMPLE_DIR; + +--echo # +--echo # Ensure the plugin isn't loaded. +--echo # +SELECT * FROM mysql.plugin WHERE name = 'daemon_example' ORDER BY name; + +--echo # +--echo # Enable the plugin... +--echo # +let $expect_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; +# MTR will remove this file later, but this might be too late. +--error 0,1 +--remove_file $expect_file +--write_file $expect_file +wait +EOF +--shutdown_server 10 +--source include/wait_until_disconnected.inc + +# +# Enable the plugin +# +--exec $MYSQLD_BOOTSTRAP_CMD ENABLE daemon_example + +# +# Ensure enabling an enabled plugin doesn't fail +--exec $MYSQLD_BOOTSTRAP_CMD ENABLE daemon_example + +# +# Restart the server +# +--append_file $expect_file +restart +EOF +--enable_reconnect +--source include/wait_until_connected_again.inc + +--echo # +--echo # Ensure the plugin is now loaded. +--echo # +--replace_regex /\.dll/.so/ +SELECT * FROM mysql.plugin WHERE name = 'daemon_example' ORDER BY name; + +--echo # +--echo # Disable the plugin... +--echo # +# MTR will remove this file later, but this might be too late. +--error 0,1 +--remove_file $expect_file +--write_file $expect_file +wait +EOF +--shutdown_server 10 +--source include/wait_until_disconnected.inc + +# +# Disable the plugin +# +--exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example + +# +# Restart the server +# +--append_file $expect_file +restart +EOF +--enable_reconnect +--source include/wait_until_connected_again.inc + +--echo # +--echo # Ensure the plugin isn't loaded. +--echo # +SELECT * FROM mysql.plugin WHERE name = 'daemon_example' ORDER BY name; + +# +# Stop the server for error conditions +# +let $expect_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; +# MTR will remove this file later, but this might be too late. +--error 0,1 +--remove_file $expect_file +--write_file $expect_file +wait +EOF +--shutdown_server 10 +--source include/wait_until_disconnected.inc + +--echo # +--echo # Attempt to load non-existant plugin +--echo # +--error 1,2,256 +--exec $MYSQLD_BOOTSTRAP_CMD DISABLE NOT_THERE_AT_ALL 2>&1 + +--echo # +--echo # Attempt to use non-existant plugin.ini file +--echo # +--error 1,2,256 +--exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example --plugin-ini=/NOT/THERE/pi.ini 2>&1 + +--echo # +--echo # Attempt to omit the plugin +--echo # +--error 1,2,256 +--exec $MYSQLD_BOOTSTRAP_CMD DISABLE 2>&1 + +--echo # +--echo # Attempt to omit DISABLE|ENABLE +--echo # +--error 1,2,256 +--exec $MYSQLD_BOOTSTRAP_CMD daemon_example 2>&1 + +--echo # +--echo # Attempt to use bad paths - datadir +--echo # +let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=/data_not_there/ --basedir=$MYSQLD_BASEDIR/sql --plugin-dir=$DAEMONEXAMPLE_DIR; +--error 1,2,256 +--exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Attempt to use bad paths - basedir +--echo # +let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=/basedir_not_there/ --plugin-dir=$DAEMONEXAMPLE_DIR; +--error 1,2,256 +--exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Attempt to use bad paths - plugin_dir +--echo # +let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR/sql --plugin-dir=/plugin_not_there/; +--error 1,2,256 +--exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Missing library +--echo # +let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR/sql --plugin-dir=$MYSQL_TEST_DIR/include/; +--error 1,2,256 +--exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Bad format for config file +--echo # +let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR/sql --plugin-dir=$DAEMONEXAMPLE_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_format.ini; +--error 1,2,256 +--exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Missing base_dir option +--echo # +let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --plugin-dir=$DAEMONEXAMPLE_DIR; +--error 1,2,139,256 +--exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Missing data_dir option +--echo # +let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --basedir=$MYSQLD_BASEDIR/sql --plugin-dir=$DAEMONEXAMPLE_DIR; +--error 1,2,139,256 +--exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Missing plugin_dir option +--echo # +let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR/sql; +--error 1,2,139,256 +--exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Show the help. +--echo # +replace_result $MYSQL_PLUGIN mysql_plugin; +--replace_regex /Distrib [0-9.]+/Distrib XX.XX.XX/ +--exec $MYSQL_PLUGIN --help + +# +# Restart the server +# +--append_file $expect_file +restart +EOF +--enable_reconnect +--source include/wait_until_connected_again.inc + +# +# Cleanup +# MTR will remove this file later, but this might be too late. +--error 0,1 +--remove_file $expect_file + -- cgit v1.2.1 From 9e112497785d5e7ce627c825aa39e2b17a5aa73e Mon Sep 17 00:00:00 2001 From: Chuck Bell Date: Tue, 19 Jul 2011 10:27:15 -0400 Subject: BUG#12707948 : mysql_plugin cannot run on Windows Patch fixes an issue with reading basedir on Windows. It fixes how the code interprets opt_basedir on Windows by adding the correct path separators and quotes for paths with spaces. BUG#12664302 : mysql_plugin cannot recognize the plugin config file Patch fixes an issue with reading a plugin config file. It adds more information to the error messages to ensure the user is using the options correctly. Also deals with paths with spacs on Windows. --- mysql-test/t/mysql_plugin.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test/t/mysql_plugin.test') diff --git a/mysql-test/t/mysql_plugin.test b/mysql-test/t/mysql_plugin.test index 3257adfeb61..c2c0a403ab3 100644 --- a/mysql-test/t/mysql_plugin.test +++ b/mysql-test/t/mysql_plugin.test @@ -149,7 +149,7 @@ let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir= --echo # --echo # Missing library --echo # -let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR/sql --plugin-dir=$MYSQL_TEST_DIR/include/; +let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR/sql --plugin-dir=$DAEMONEXAMPLE_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_soname.ini; --error 1,2,256 --exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 -- cgit v1.2.1 From e73ee41c6cb0fa13c6225c06d072f1d484085827 Mon Sep 17 00:00:00 2001 From: Chuck Bell Date: Tue, 19 Jul 2011 10:35:03 -0400 Subject: WL#5710 : Enable and disable plugins (mysql_plugin) This patch adds additional QA tests and enhances the mysql_plugin test to include more test cases. --- mysql-test/t/mysql_plugin.test | 69 +++++++++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 17 deletions(-) (limited to 'mysql-test/t/mysql_plugin.test') diff --git a/mysql-test/t/mysql_plugin.test b/mysql-test/t/mysql_plugin.test index c2c0a403ab3..b90619774df 100644 --- a/mysql-test/t/mysql_plugin.test +++ b/mysql-test/t/mysql_plugin.test @@ -2,18 +2,34 @@ # Test mysql_plugin tool # -# -# Test currently does not run on Windows because in Windows build trees, -# mysqld.exe is not placed in the ./sql folder - it is placed either -# in ./sql/Debug or ./sql/release. If this behaviour is changed, this test -# can run on Windows. -# ---source include/not_windows.inc +--source include/not_embedded.inc # Add the datadir, basedir, plugin_dir to the bootstrap command let $MYSQLD_DATADIR= `select @@datadir`; -let $MYSQLD_BASEDIR= `select @@basedir`; -let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR/sql --plugin-dir=$DAEMONEXAMPLE_DIR; +let $MYSQL_BASEDIR= `select @@basedir`; + +# The mysql_plugin tool expects all executables in "basedir", so they will be copied to it. +# It also expects a directory structure like in the installed mysql version, so errmsg.sys +# will be copied to "basedir/share". The directories differ between Windows and Unix. +--disable_abort_on_error +if(`SELECT CONVERT(@@version_compile_os USING latin1) + IN ('Win32','Win64','Windows')`) +{ + let $MYSQLD_BASEDIR= $MYSQL_BASEDIR/sql/Debug; + --copy_file $MYSQL_BASEDIR/extra/Debug/my_print_defaults.exe $MYSQLD_BASEDIR/my_print_defaults.exe + --mkdir $MYSQLD_BASEDIR/share + --copy_file $MYSQL_BASEDIR/sql/share/english/errmsg.sys $MYSQLD_BASEDIR/share/errmsg.sys + --copy_file $MYSQL_BASEDIR/plugin/daemon_example/daemon_example.ini $DAEMONEXAMPLE_DIR/daemon_example.ini +} +if (`SELECT CONVERT(@@version_compile_os USING latin1) + NOT IN ('Win32','Win64','Windows')`) +{ + let $MYSQLD_BASEDIR= $MYSQL_BASEDIR/sql; + --copy_file $MYSQL_BASEDIR/extra/my_print_defaults $MYSQLD_BASEDIR/my_print_defaults + --copy_file $MYSQL_BASEDIR/sql/share/english/errmsg.sys $MYSQLD_BASEDIR/share/errmsg.sys +} + +let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR --plugin-dir=$DAEMONEXAMPLE_DIR; --echo # --echo # Ensure the plugin isn't loaded. @@ -110,7 +126,7 @@ EOF --echo # --echo # Attempt to use non-existant plugin.ini file --echo # ---error 1,2,256 +--error 1,2,7,256 --exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example --plugin-ini=/NOT/THERE/pi.ini 2>&1 --echo # @@ -128,7 +144,7 @@ EOF --echo # --echo # Attempt to use bad paths - datadir --echo # -let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=/data_not_there/ --basedir=$MYSQLD_BASEDIR/sql --plugin-dir=$DAEMONEXAMPLE_DIR; +let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=/data_not_there/ --basedir=$MYSQLD_BASEDIR --plugin-dir=$DAEMONEXAMPLE_DIR; --error 1,2,256 --exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 @@ -142,21 +158,21 @@ let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir= --echo # --echo # Attempt to use bad paths - plugin_dir --echo # -let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR/sql --plugin-dir=/plugin_not_there/; +let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR --plugin-dir=/plugin_not_there/; --error 1,2,256 --exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 --echo # --echo # Missing library --echo # -let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR/sql --plugin-dir=$DAEMONEXAMPLE_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_soname.ini; +let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR --plugin-dir=$DAEMONEXAMPLE_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_soname.ini; --error 1,2,256 --exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 --echo # --echo # Bad format for config file --echo # -let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR/sql --plugin-dir=$DAEMONEXAMPLE_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_format.ini; +let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR --plugin-dir=$DAEMONEXAMPLE_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_format.ini; --error 1,2,256 --exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 @@ -170,14 +186,14 @@ let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --plugin-d --echo # --echo # Missing data_dir option --echo # -let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --basedir=$MYSQLD_BASEDIR/sql --plugin-dir=$DAEMONEXAMPLE_DIR; +let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --basedir=$MYSQLD_BASEDIR --plugin-dir=$DAEMONEXAMPLE_DIR; --error 1,2,139,256 --exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 --echo # --echo # Missing plugin_dir option --echo # -let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR/sql; +let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR; --error 1,2,139,256 --exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 @@ -185,9 +201,13 @@ let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir= --echo # Show the help. --echo # replace_result $MYSQL_PLUGIN mysql_plugin; ---replace_regex /Distrib [0-9.]+/Distrib XX.XX.XX/ +--replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ --exec $MYSQL_PLUGIN --help +replace_result $MYSQL_PLUGIN mysql_plugin; +--replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ +--exec $MYSQL_PLUGIN --version + # # Restart the server # @@ -203,3 +223,18 @@ EOF --error 0,1 --remove_file $expect_file +if(`SELECT CONVERT(@@version_compile_os USING latin1) + IN ('Win32','Win64','Windows')`) +{ + --remove_file $DAEMONEXAMPLE_DIR/daemon_example.ini + --remove_file $MYSQLD_BASEDIR/my_print_defaults.exe + --remove_file $MYSQLD_BASEDIR/share/errmsg.sys + --rmdir $MYSQLD_BASEDIR/share +} +if(`SELECT CONVERT(@@version_compile_os USING latin1) + NOT IN ('Win32','Win64','Windows')`) +{ + --remove_file $MYSQLD_BASEDIR/my_print_defaults + --remove_file $MYSQLD_BASEDIR/share/errmsg.sys +} +--enable_abort_on_error -- cgit v1.2.1 From 99f2e85b6cefa8e864a5099324301d110aa3048b Mon Sep 17 00:00:00 2001 From: Chuck Bell Date: Tue, 9 Aug 2011 08:58:18 -0400 Subject: WL#5710 : enable and disable plugins This patch corrects a problem found in PB. Some platforms have very different locations for the mysql installation. The client was not able to find either my_print_defaults or mysqld predictably. The patch adds two new command options --mysqld and --my-print-defaults which can be used to provide the location of mysqld and my_print_defaults by providing the paths. The patch also changes the concatenation of the soname extension to fix a problem found on some Ubuntu systems. The patch contains changes to the test to ensure it will run on all platforms. A trap is set in the test to skip testing if the location of mysqld, my_print_defaults, or the daemon_example.ini files cannot be determined. --- mysql-test/t/mysql_plugin.test | 184 +++++++++++++++++++++++++++++------------ 1 file changed, 131 insertions(+), 53 deletions(-) (limited to 'mysql-test/t/mysql_plugin.test') diff --git a/mysql-test/t/mysql_plugin.test b/mysql-test/t/mysql_plugin.test index b90619774df..cad89d9de7a 100644 --- a/mysql-test/t/mysql_plugin.test +++ b/mysql-test/t/mysql_plugin.test @@ -1,35 +1,107 @@ # # Test mysql_plugin tool # +# This test contains test cases for testing the mysql_plugin client with +# the daemon_example plugin. Test cases include tests for: +# +# - successful enable/disable +# - incorrect paths +# - missing paths/options +# +# Implementation Notes +# +# The mysql_plugin tool now accepts --mysqld the path to mysqld server. The +# mysqld path is extracted from MYSQLD_BOOTSTRAP_CMD line. We also extract +# the path of MYSQLD_BASEDIR (where mysql exists) and use it for the errmsg +# file. The directories differ between Windows and Unix but the Perl script +# included below will pick as per platform. +# +# The test is also designed to issue the --skip directive if the location of +# the mysqld, my_print_defaults, or daemon_example.ini files cannot be found. +# --source include/not_embedded.inc # Add the datadir, basedir, plugin_dir to the bootstrap command let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQL_BASEDIR= `select @@basedir`; +let $MYSQL_ERRMSG_BASEDIR=`select @@lc_messages_dir`; +let $PLUGIN_DIR=`select @@plugin_dir`; -# The mysql_plugin tool expects all executables in "basedir", so they will be copied to it. -# It also expects a directory structure like in the installed mysql version, so errmsg.sys -# will be copied to "basedir/share". The directories differ between Windows and Unix. --disable_abort_on_error -if(`SELECT CONVERT(@@version_compile_os USING latin1) - IN ('Win32','Win64','Windows')`) + +# Perl script to extract the location of the basedir from environment +# variables. This is needed to ensure the test will run on the PB machines +# designed to test release as well as debug builds. It also checks for the +# location of the my_print_defaults and daemon_example.ini files. + +perl; +use File::Basename; + my ($mysqld)= split " ", $ENV{MYSQLD_BOOTSTRAP_CMD}; + my $mysqld_basedir=dirname($mysqld); + my $my_print_defaults= $ENV{MYSQL_MY_PRINT_DEFAULTS}; + my $my_print_defaults_basedir=dirname($my_print_defaults); + my $daemonexample_ini= "$ENV{DAEMONEXAMPLE_DIR}/daemon_example.ini"; + my $plugindir_ini= "$ENV{PLUGIN_DIR}/daemon_example.ini"; + my $notfound= ""; + open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/mysqld.inc") or die; + print FILE "let \$MYSQLD= $mysqld;\n"; + print FILE "let \$MYSQLD_BASEDIR= $mysqld_basedir;\n"; + print FILE "let \$MYSQL_MY_PRINT_DEFAULTS_BASEDIR= $my_print_defaults_basedir;\n"; + if ((!-e $daemonexample_ini) || (!-r $daemonexample_ini)) + { + print FILE "let \$DAEMONEXAMPLE_DIR= $not_found;\n"; + } + if ((!-e $plugindir_ini) || (!-r $plugindir_ini)) + { + print FILE "let \$PLUGIN_DIR= $not_found;\n"; + } + close FILE; +EOF + + +source $MYSQL_TMP_DIR/mysqld.inc; +remove_file $MYSQL_TMP_DIR/mysqld.inc; + +# The mysql_plugin tool expects a directory structure like in the installed +# 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 + +# 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 +# $MYSQL_MY_PRINT_DEFAULTS. + +# Check for my_print_defaults location. Skip if not found. +if ($MYSQL_MY_PRINT_DEFAULTS_BASEDIR == '') +{ + --skip Test requires known location of my_print_defaults executable. +} + +# Check for mysqld location. Skip if not found. +if ($MYSQLD == '') { - let $MYSQLD_BASEDIR= $MYSQL_BASEDIR/sql/Debug; - --copy_file $MYSQL_BASEDIR/extra/Debug/my_print_defaults.exe $MYSQLD_BASEDIR/my_print_defaults.exe - --mkdir $MYSQLD_BASEDIR/share - --copy_file $MYSQL_BASEDIR/sql/share/english/errmsg.sys $MYSQLD_BASEDIR/share/errmsg.sys - --copy_file $MYSQL_BASEDIR/plugin/daemon_example/daemon_example.ini $DAEMONEXAMPLE_DIR/daemon_example.ini + --skip Test requires known location of mysqld executable. } -if (`SELECT CONVERT(@@version_compile_os USING latin1) - NOT IN ('Win32','Win64','Windows')`) + +# Check for daemon_example.ini location. Skip if not found in either +# the plugin_dir path or the daemon_example_dir path. +if ($PLUGIN_DIR == '') { - let $MYSQLD_BASEDIR= $MYSQL_BASEDIR/sql; - --copy_file $MYSQL_BASEDIR/extra/my_print_defaults $MYSQLD_BASEDIR/my_print_defaults - --copy_file $MYSQL_BASEDIR/sql/share/english/errmsg.sys $MYSQLD_BASEDIR/share/errmsg.sys + if ($DAEMONEXAMPLE_DIR == '') + { + --skip Test requires known location of daemon_example.ini file. + } + let $PLUGIN_DIR = $DAEMONEXAMPLE_DIR; } -let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR --plugin-dir=$DAEMONEXAMPLE_DIR; +# Build client command for reuse. + +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; --echo # --echo # Ensure the plugin isn't loaded. @@ -52,11 +124,11 @@ EOF # # Enable the plugin # ---exec $MYSQLD_BOOTSTRAP_CMD ENABLE daemon_example +--exec $MYSQL_PLUGIN_CMD ENABLE daemon_example # # Ensure enabling an enabled plugin doesn't fail ---exec $MYSQLD_BOOTSTRAP_CMD ENABLE daemon_example +--exec $MYSQL_PLUGIN_CMD ENABLE daemon_example # # Restart the server @@ -88,7 +160,7 @@ EOF # # Disable the plugin # ---exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example # # Restart the server @@ -121,81 +193,96 @@ EOF --echo # Attempt to load non-existant plugin --echo # --error 1,2,256 ---exec $MYSQLD_BOOTSTRAP_CMD DISABLE NOT_THERE_AT_ALL 2>&1 +--exec $MYSQL_PLUGIN_CMD DISABLE NOT_THERE_AT_ALL 2>&1 --echo # --echo # Attempt to use non-existant plugin.ini file --echo # --error 1,2,7,256 ---exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example --plugin-ini=/NOT/THERE/pi.ini 2>&1 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example --plugin-ini=/NOT/THERE/pi.ini 2>&1 --echo # --echo # Attempt to omit the plugin --echo # --error 1,2,256 ---exec $MYSQLD_BOOTSTRAP_CMD DISABLE 2>&1 +--exec $MYSQL_PLUGIN_CMD DISABLE 2>&1 --echo # --echo # Attempt to omit DISABLE|ENABLE --echo # --error 1,2,256 ---exec $MYSQLD_BOOTSTRAP_CMD daemon_example 2>&1 +--exec $MYSQL_PLUGIN_CMD daemon_example 2>&1 --echo # --echo # Attempt to use bad paths - datadir --echo # -let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=/data_not_there/ --basedir=$MYSQLD_BASEDIR --plugin-dir=$DAEMONEXAMPLE_DIR; +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=/data_not_there/ --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; --error 1,2,256 ---exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 --echo # --echo # Attempt to use bad paths - basedir --echo # -let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=/basedir_not_there/ --plugin-dir=$DAEMONEXAMPLE_DIR; +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=/basedir_not_there/ --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; --error 1,2,256 ---exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 --echo # --echo # Attempt to use bad paths - plugin_dir --echo # -let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR --plugin-dir=/plugin_not_there/; +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=/plugin_not_there/ --mysqld=$MYSQLD --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +--error 1,2,256 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Attempt to use bad paths - mysqld +--echo # +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=/mysqld_not_there/ --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +--error 1,2,256 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Attempt to use bad paths - my_print_defaults +--echo # +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD --my-print-defaults=/my_print_defaults_not_there/; --error 1,2,256 ---exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 + --echo # --echo # Missing library --echo # -let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR --plugin-dir=$DAEMONEXAMPLE_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_soname.ini; +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_soname.ini --mysqld=$MYSQLD --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; --error 1,2,256 ---exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 --echo # --echo # Bad format for config file --echo # -let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR --plugin-dir=$DAEMONEXAMPLE_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_format.ini; +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_format.ini --mysqld=$MYSQLD --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; --error 1,2,256 ---exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 --echo # --echo # Missing base_dir option --echo # -let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --plugin-dir=$DAEMONEXAMPLE_DIR; +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; --error 1,2,139,256 ---exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 --echo # --echo # Missing data_dir option --echo # -let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --basedir=$MYSQLD_BASEDIR --plugin-dir=$DAEMONEXAMPLE_DIR; +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; --error 1,2,139,256 ---exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 --echo # --echo # Missing plugin_dir option --echo # -let $MYSQLD_BOOTSTRAP_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR; +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQL_DATADIR --basedir=$MYSQL_BASEDIR --mysqld=$MYSQLD --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; --error 1,2,139,256 ---exec $MYSQLD_BOOTSTRAP_CMD DISABLE daemon_example 2>&1 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 --echo # --echo # Show the help. @@ -223,18 +310,9 @@ EOF --error 0,1 --remove_file $expect_file -if(`SELECT CONVERT(@@version_compile_os USING latin1) - IN ('Win32','Win64','Windows')`) -{ - --remove_file $DAEMONEXAMPLE_DIR/daemon_example.ini - --remove_file $MYSQLD_BASEDIR/my_print_defaults.exe - --remove_file $MYSQLD_BASEDIR/share/errmsg.sys - --rmdir $MYSQLD_BASEDIR/share -} -if(`SELECT CONVERT(@@version_compile_os USING latin1) - NOT IN ('Win32','Win64','Windows')`) -{ - --remove_file $MYSQLD_BASEDIR/my_print_defaults - --remove_file $MYSQLD_BASEDIR/share/errmsg.sys -} +# Cleanup the share folder in the binary path. +--remove_file $MYSQLD_BASEDIR/share/errmsg.sys +--rmdir $MYSQLD_BASEDIR/share/mysql +--rmdir $MYSQLD_BASEDIR/share + --enable_abort_on_error -- cgit v1.2.1 From 1b730666d4a1e3874741a472b7c125bc5d704dd8 Mon Sep 17 00:00:00 2001 From: Chuck Bell Date: Tue, 9 Aug 2011 15:09:28 -0400 Subject: WL#5710 : enable and disable plugins This patch corrects an error in the test to ensure the proper path is used for the --mysqld option. --- mysql-test/t/mysql_plugin.test | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'mysql-test/t/mysql_plugin.test') diff --git a/mysql-test/t/mysql_plugin.test b/mysql-test/t/mysql_plugin.test index cad89d9de7a..9e71db1a451 100644 --- a/mysql-test/t/mysql_plugin.test +++ b/mysql-test/t/mysql_plugin.test @@ -101,7 +101,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 --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +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; --echo # --echo # Ensure the plugin isn't loaded. @@ -216,21 +216,21 @@ EOF --echo # --echo # Attempt to use bad paths - datadir --echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=/data_not_there/ --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=/data_not_there/ --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; --error 1,2,256 --exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 --echo # --echo # Attempt to use bad paths - basedir --echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=/basedir_not_there/ --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=/basedir_not_there/ --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; --error 1,2,256 --exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 --echo # --echo # Attempt to use bad paths - plugin_dir --echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=/plugin_not_there/ --mysqld=$MYSQLD --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=/plugin_not_there/ --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; --error 1,2,256 --exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 @@ -244,7 +244,7 @@ let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYS --echo # --echo # Attempt to use bad paths - my_print_defaults --echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD --my-print-defaults=/my_print_defaults_not_there/; +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=/my_print_defaults_not_there/; --error 1,2,256 --exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 @@ -252,35 +252,35 @@ let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYS --echo # --echo # Missing library --echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_soname.ini --mysqld=$MYSQLD --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_soname.ini --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; --error 1,2,256 --exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 --echo # --echo # Bad format for config file --echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_format.ini --mysqld=$MYSQLD --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_format.ini --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; --error 1,2,256 --exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 --echo # --echo # Missing base_dir option --echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; --error 1,2,139,256 --exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 --echo # --echo # Missing data_dir option --echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; --error 1,2,139,256 --exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 --echo # --echo # Missing plugin_dir option --echo # -let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQL_DATADIR --basedir=$MYSQL_BASEDIR --mysqld=$MYSQLD --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQL_DATADIR --basedir=$MYSQL_BASEDIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; --error 1,2,139,256 --exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 -- cgit v1.2.1 From dfbe4b3367567e1e02b02bba9e57613a072850b6 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Fri, 12 Aug 2011 12:49:38 +0200 Subject: Small followup fix to WL 5710: Test mysql_plugin failed if version string ended in -mN --- mysql-test/t/mysql_plugin.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mysql-test/t/mysql_plugin.test') diff --git a/mysql-test/t/mysql_plugin.test b/mysql-test/t/mysql_plugin.test index 9e71db1a451..b07ce40e43a 100644 --- a/mysql-test/t/mysql_plugin.test +++ b/mysql-test/t/mysql_plugin.test @@ -288,11 +288,11 @@ let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQL_DATADIR --basedir=$MYSQ --echo # Show the help. --echo # replace_result $MYSQL_PLUGIN mysql_plugin; ---replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ +--replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ /XX-m[0-9]+/XX/ --exec $MYSQL_PLUGIN --help replace_result $MYSQL_PLUGIN mysql_plugin; ---replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ +--replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ /XX-m[0-9]+/XX/ --exec $MYSQL_PLUGIN --version # -- cgit v1.2.1 From 6e5bbf513810448e84872069065a0561e0d70a93 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Mon, 15 Aug 2011 18:29:38 +0400 Subject: Cherry-picking WL#5710 from mysql-5.5 to mysql-5.5.16-release. Original revision id: # revno: 3489 [merge] # revision-id: tatjana.nuernberg@oracle.com-20110811120945-c6x9a5d2du8s9oj2 # parent: tatjana.nuernberg@oracle.com-20110811112736-so8r813hs8dmf7nr # parent: chuck.bell@oracle.com-20110810183949-2s9uxcuoux2p668e # committer: Tatjana Azundris Nuernberg # branch nick: 55-9 # timestamp: Thu 2011-08-11 13:09:45 +0100 # message: # auto-merge This merge revision also has a patch for Bug 12664445, which has been also taken to 5.5.16. --- mysql-test/t/mysql_plugin.test | 318 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 318 insertions(+) create mode 100644 mysql-test/t/mysql_plugin.test (limited to 'mysql-test/t/mysql_plugin.test') diff --git a/mysql-test/t/mysql_plugin.test b/mysql-test/t/mysql_plugin.test new file mode 100644 index 00000000000..9e71db1a451 --- /dev/null +++ b/mysql-test/t/mysql_plugin.test @@ -0,0 +1,318 @@ +# +# Test mysql_plugin tool +# +# This test contains test cases for testing the mysql_plugin client with +# the daemon_example plugin. Test cases include tests for: +# +# - successful enable/disable +# - incorrect paths +# - missing paths/options +# +# Implementation Notes +# +# The mysql_plugin tool now accepts --mysqld the path to mysqld server. The +# mysqld path is extracted from MYSQLD_BOOTSTRAP_CMD line. We also extract +# the path of MYSQLD_BASEDIR (where mysql exists) and use it for the errmsg +# file. The directories differ between Windows and Unix but the Perl script +# included below will pick as per platform. +# +# The test is also designed to issue the --skip directive if the location of +# the mysqld, my_print_defaults, or daemon_example.ini files cannot be found. +# + +--source include/not_embedded.inc + +# Add the datadir, basedir, plugin_dir to the bootstrap command +let $MYSQLD_DATADIR= `select @@datadir`; +let $MYSQL_BASEDIR= `select @@basedir`; +let $MYSQL_ERRMSG_BASEDIR=`select @@lc_messages_dir`; +let $PLUGIN_DIR=`select @@plugin_dir`; + +--disable_abort_on_error + +# Perl script to extract the location of the basedir from environment +# variables. This is needed to ensure the test will run on the PB machines +# designed to test release as well as debug builds. It also checks for the +# location of the my_print_defaults and daemon_example.ini files. + +perl; +use File::Basename; + my ($mysqld)= split " ", $ENV{MYSQLD_BOOTSTRAP_CMD}; + my $mysqld_basedir=dirname($mysqld); + my $my_print_defaults= $ENV{MYSQL_MY_PRINT_DEFAULTS}; + my $my_print_defaults_basedir=dirname($my_print_defaults); + my $daemonexample_ini= "$ENV{DAEMONEXAMPLE_DIR}/daemon_example.ini"; + my $plugindir_ini= "$ENV{PLUGIN_DIR}/daemon_example.ini"; + my $notfound= ""; + open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/mysqld.inc") or die; + print FILE "let \$MYSQLD= $mysqld;\n"; + print FILE "let \$MYSQLD_BASEDIR= $mysqld_basedir;\n"; + print FILE "let \$MYSQL_MY_PRINT_DEFAULTS_BASEDIR= $my_print_defaults_basedir;\n"; + if ((!-e $daemonexample_ini) || (!-r $daemonexample_ini)) + { + print FILE "let \$DAEMONEXAMPLE_DIR= $not_found;\n"; + } + if ((!-e $plugindir_ini) || (!-r $plugindir_ini)) + { + print FILE "let \$PLUGIN_DIR= $not_found;\n"; + } + close FILE; +EOF + + +source $MYSQL_TMP_DIR/mysqld.inc; +remove_file $MYSQL_TMP_DIR/mysqld.inc; + +# The mysql_plugin tool expects a directory structure like in the installed +# 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 + +# 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 +# $MYSQL_MY_PRINT_DEFAULTS. + +# Check for my_print_defaults location. Skip if not found. +if ($MYSQL_MY_PRINT_DEFAULTS_BASEDIR == '') +{ + --skip Test requires known location of my_print_defaults executable. +} + +# Check for mysqld location. Skip if not found. +if ($MYSQLD == '') +{ + --skip Test requires known location of mysqld executable. +} + +# Check for daemon_example.ini location. Skip if not found in either +# the plugin_dir path or the daemon_example_dir path. +if ($PLUGIN_DIR == '') +{ + if ($DAEMONEXAMPLE_DIR == '') + { + --skip Test requires known location of daemon_example.ini file. + } + let $PLUGIN_DIR = $DAEMONEXAMPLE_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; + +--echo # +--echo # Ensure the plugin isn't loaded. +--echo # +SELECT * FROM mysql.plugin WHERE name = 'daemon_example' ORDER BY name; + +--echo # +--echo # Enable the plugin... +--echo # +let $expect_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; +# MTR will remove this file later, but this might be too late. +--error 0,1 +--remove_file $expect_file +--write_file $expect_file +wait +EOF +--shutdown_server 10 +--source include/wait_until_disconnected.inc + +# +# Enable the plugin +# +--exec $MYSQL_PLUGIN_CMD ENABLE daemon_example + +# +# Ensure enabling an enabled plugin doesn't fail +--exec $MYSQL_PLUGIN_CMD ENABLE daemon_example + +# +# Restart the server +# +--append_file $expect_file +restart +EOF +--enable_reconnect +--source include/wait_until_connected_again.inc + +--echo # +--echo # Ensure the plugin is now loaded. +--echo # +--replace_regex /\.dll/.so/ +SELECT * FROM mysql.plugin WHERE name = 'daemon_example' ORDER BY name; + +--echo # +--echo # Disable the plugin... +--echo # +# MTR will remove this file later, but this might be too late. +--error 0,1 +--remove_file $expect_file +--write_file $expect_file +wait +EOF +--shutdown_server 10 +--source include/wait_until_disconnected.inc + +# +# Disable the plugin +# +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example + +# +# Restart the server +# +--append_file $expect_file +restart +EOF +--enable_reconnect +--source include/wait_until_connected_again.inc + +--echo # +--echo # Ensure the plugin isn't loaded. +--echo # +SELECT * FROM mysql.plugin WHERE name = 'daemon_example' ORDER BY name; + +# +# Stop the server for error conditions +# +let $expect_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; +# MTR will remove this file later, but this might be too late. +--error 0,1 +--remove_file $expect_file +--write_file $expect_file +wait +EOF +--shutdown_server 10 +--source include/wait_until_disconnected.inc + +--echo # +--echo # Attempt to load non-existant plugin +--echo # +--error 1,2,256 +--exec $MYSQL_PLUGIN_CMD DISABLE NOT_THERE_AT_ALL 2>&1 + +--echo # +--echo # Attempt to use non-existant plugin.ini file +--echo # +--error 1,2,7,256 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example --plugin-ini=/NOT/THERE/pi.ini 2>&1 + +--echo # +--echo # Attempt to omit the plugin +--echo # +--error 1,2,256 +--exec $MYSQL_PLUGIN_CMD DISABLE 2>&1 + +--echo # +--echo # Attempt to omit DISABLE|ENABLE +--echo # +--error 1,2,256 +--exec $MYSQL_PLUGIN_CMD daemon_example 2>&1 + +--echo # +--echo # Attempt to use bad paths - datadir +--echo # +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=/data_not_there/ --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +--error 1,2,256 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Attempt to use bad paths - basedir +--echo # +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=/basedir_not_there/ --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +--error 1,2,256 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Attempt to use bad paths - plugin_dir +--echo # +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=/plugin_not_there/ --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +--error 1,2,256 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Attempt to use bad paths - mysqld +--echo # +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=/mysqld_not_there/ --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +--error 1,2,256 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Attempt to use bad paths - my_print_defaults +--echo # +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=/my_print_defaults_not_there/; +--error 1,2,256 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 + + +--echo # +--echo # Missing library +--echo # +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_soname.ini --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +--error 1,2,256 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Bad format for config file +--echo # +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --plugin-ini=$MYSQL_TEST_DIR/include/daemon_example_bad_format.ini --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +--error 1,2,256 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Missing base_dir option +--echo # +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +--error 1,2,139,256 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Missing data_dir option +--echo # +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --basedir=$MYSQL_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +--error 1,2,139,256 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Missing plugin_dir option +--echo # +let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQL_DATADIR --basedir=$MYSQL_BASEDIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +--error 1,2,139,256 +--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 + +--echo # +--echo # Show the help. +--echo # +replace_result $MYSQL_PLUGIN mysql_plugin; +--replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ +--exec $MYSQL_PLUGIN --help + +replace_result $MYSQL_PLUGIN mysql_plugin; +--replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ +--exec $MYSQL_PLUGIN --version + +# +# Restart the server +# +--append_file $expect_file +restart +EOF +--enable_reconnect +--source include/wait_until_connected_again.inc + +# +# Cleanup +# MTR will remove this file later, but this might be too late. +--error 0,1 +--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 + +--enable_abort_on_error -- cgit v1.2.1 From 4a6602223c79e25c7e07f70301de4f1b7975ec82 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Mon, 15 Aug 2011 18:33:03 +0400 Subject: Cherry-picking follow-up patch for WL 5710 from mysql-5.5 to mysql-5.5.16-release. Original revision: # revision-id: bjorn.munch@oracle.com-20110812104938-peswzao46f4lvm9p # parent: dmitry.lenev@oracle.com-20110811155849-feyt3h7tj48padiu # committer: Bjorn Munch # branch nick: main-55 # timestamp: Fri 2011-08-12 12:49:38 +0200 # message: # Small followup fix to WL 5710: # Test mysql_plugin failed if version string ended in -mN --- mysql-test/t/mysql_plugin.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mysql-test/t/mysql_plugin.test') diff --git a/mysql-test/t/mysql_plugin.test b/mysql-test/t/mysql_plugin.test index 9e71db1a451..b07ce40e43a 100644 --- a/mysql-test/t/mysql_plugin.test +++ b/mysql-test/t/mysql_plugin.test @@ -288,11 +288,11 @@ let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQL_DATADIR --basedir=$MYSQ --echo # Show the help. --echo # replace_result $MYSQL_PLUGIN mysql_plugin; ---replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ +--replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ /XX-m[0-9]+/XX/ --exec $MYSQL_PLUGIN --help replace_result $MYSQL_PLUGIN mysql_plugin; ---replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ +--replace_regex /Ver [0-9.]+ Distrib [0-9.]+/Ver V.V.VV Distrib XX.XX.XX/ /XX-m[0-9]+/XX/ --exec $MYSQL_PLUGIN --version # -- cgit v1.2.1 From 8433c8ce61956fdeea45a55c7262bf509aaefb0d Mon Sep 17 00:00:00 2001 From: Chuck Bell Date: Fri, 9 Sep 2011 10:39:44 -0400 Subject: BUG#12929631 : Execute crashes with --verbose output (Windows) This patch corrects an error encountered in PB where Windows machines are built in release mode have an extraneous parameter added in place of the --console option. This is caused by the insert of '(null' instead of an empty string. In non-debug mode, the string is explicitly set to an empty string. Patch also fixes a result mismatch on Windows machines. --- mysql-test/t/mysql_plugin.test | 1 + 1 file changed, 1 insertion(+) (limited to 'mysql-test/t/mysql_plugin.test') diff --git a/mysql-test/t/mysql_plugin.test b/mysql-test/t/mysql_plugin.test index b07ce40e43a..09615ec8f00 100644 --- a/mysql-test/t/mysql_plugin.test +++ b/mysql-test/t/mysql_plugin.test @@ -224,6 +224,7 @@ let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=/data_not_there/ --basedir=$MY --echo # Attempt to use bad paths - basedir --echo # let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=/basedir_not_there/ --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR; +replace_result "/basedir_not_there//" "/basedir_not_there/"; --error 1,2,256 --exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1 -- cgit v1.2.1 From 4f7a290e70eaf1bdb7bb4c017dfb1cd490f2e917 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 15 Sep 2011 13:18:12 +0200 Subject: Some tests simplified after 12912120 --- mysql-test/t/mysql_plugin.test | 1 - 1 file changed, 1 deletion(-) (limited to 'mysql-test/t/mysql_plugin.test') diff --git a/mysql-test/t/mysql_plugin.test b/mysql-test/t/mysql_plugin.test index b07ce40e43a..2ad9a8de186 100644 --- a/mysql-test/t/mysql_plugin.test +++ b/mysql-test/t/mysql_plugin.test @@ -45,7 +45,6 @@ use File::Basename; my $plugindir_ini= "$ENV{PLUGIN_DIR}/daemon_example.ini"; my $notfound= ""; open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/mysqld.inc") or die; - print FILE "let \$MYSQLD= $mysqld;\n"; print FILE "let \$MYSQLD_BASEDIR= $mysqld_basedir;\n"; print FILE "let \$MYSQL_MY_PRINT_DEFAULTS_BASEDIR= $my_print_defaults_basedir;\n"; if ((!-e $daemonexample_ini) || (!-r $daemonexample_ini)) -- cgit v1.2.1