mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Add support for loading example plugin and add plugin.test
mysql-test/r/have_dynamic_loading.require: Rename: mysql-test/r/have_udf.require -> mysql-test/r/have_dynamic_loading.require mysql-test/include/have_udf.inc: Rename have_udf.require to hqave_dynamic_loading.require mysql-test/mysql-test-run.pl: Add support for ha_example plugin mysql-test/include/have_example_plugin.inc: New BitKeeper file ``mysql-test/include/have_example_plugin.inc'' mysql-test/r/have_example_plugin.require: New BitKeeper file ``mysql-test/r/have_example_plugin.require'' mysql-test/r/plugin.result: New BitKeeper file ``mysql-test/r/plugin.result'' mysql-test/t/plugin.test: New BitKeeper file ``mysql-test/t/plugin.test''
This commit is contained in:
16
mysql-test/include/have_example_plugin.inc
Normal file
16
mysql-test/include/have_example_plugin.inc
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#
|
||||||
|
# Check if server has support for loading udf's
|
||||||
|
# i.e it will support dlopen
|
||||||
|
#
|
||||||
|
--require r/have_dynamic_loading.require
|
||||||
|
disable_query_log;
|
||||||
|
show variables like "have_dynamic_loading";
|
||||||
|
enable_query_log;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check if the variable EXAMPLE_PLUGIN is set
|
||||||
|
#
|
||||||
|
--require r/have_example_plugin.require
|
||||||
|
disable_query_log;
|
||||||
|
eval select LENGTH("$EXAMPLE_PLUGIN") > 0 as "have_example_plugin";
|
||||||
|
enable_query_log;
|
@ -2,7 +2,7 @@
|
|||||||
# Check if server has support for loading udf's
|
# Check if server has support for loading udf's
|
||||||
# i.e it will support dlopen
|
# i.e it will support dlopen
|
||||||
#
|
#
|
||||||
--require r/have_udf.require
|
--require r/have_dynamic_loading.require
|
||||||
disable_query_log;
|
disable_query_log;
|
||||||
show variables like "have_dynamic_loading";
|
show variables like "have_dynamic_loading";
|
||||||
enable_query_log;
|
enable_query_log;
|
||||||
|
@ -159,6 +159,7 @@ our $exe_im;
|
|||||||
our $exe_my_print_defaults;
|
our $exe_my_print_defaults;
|
||||||
our $exe_perror;
|
our $exe_perror;
|
||||||
our $lib_udf_example;
|
our $lib_udf_example;
|
||||||
|
our $lib_example_plugin;
|
||||||
our $exe_libtool;
|
our $exe_libtool;
|
||||||
|
|
||||||
our $opt_bench= 0;
|
our $opt_bench= 0;
|
||||||
@ -1493,6 +1494,11 @@ sub executable_setup () {
|
|||||||
mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
|
mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
|
||||||
"$glob_basedir/sql/.libs/udf_example.so",);
|
"$glob_basedir/sql/.libs/udf_example.so",);
|
||||||
|
|
||||||
|
# Look for the ha_example library
|
||||||
|
$lib_example_plugin=
|
||||||
|
mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
|
||||||
|
"$glob_basedir/storage/example/.libs/ha_example.so",);
|
||||||
|
|
||||||
# Look for mysqltest executable
|
# Look for mysqltest executable
|
||||||
if ( $glob_use_embedded_server )
|
if ( $glob_use_embedded_server )
|
||||||
{
|
{
|
||||||
@ -1648,6 +1654,14 @@ sub environment_setup () {
|
|||||||
push(@ld_library_paths, dirname($lib_udf_example));
|
push(@ld_library_paths, dirname($lib_udf_example));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# Add the path where mysqld will find ha_example.so
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
if ( $lib_example_plugin )
|
||||||
|
{
|
||||||
|
push(@ld_library_paths, dirname($lib_example_plugin));
|
||||||
|
}
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Valgrind need to be run with debug libraries otherwise it's almost
|
# Valgrind need to be run with debug libraries otherwise it's almost
|
||||||
# impossible to add correct supressions, that means if "/usr/lib/debug"
|
# impossible to add correct supressions, that means if "/usr/lib/debug"
|
||||||
@ -1922,10 +1936,11 @@ sub environment_setup () {
|
|||||||
$ENV{'UDF_EXAMPLE_LIB'}=
|
$ENV{'UDF_EXAMPLE_LIB'}=
|
||||||
($lib_udf_example ? basename($lib_udf_example) : "");
|
($lib_udf_example ? basename($lib_udf_example) : "");
|
||||||
|
|
||||||
$ENV{'LD_LIBRARY_PATH'}=
|
# ----------------------------------------------------
|
||||||
($lib_udf_example ? dirname($lib_udf_example) : "") .
|
# Add the path where mysqld will find ha_example.so
|
||||||
($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
|
# ----------------------------------------------------
|
||||||
|
$ENV{'EXAMPLE_PLUGIN'}=
|
||||||
|
($lib_example_plugin ? basename($lib_example_plugin) : "");
|
||||||
|
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
# We are nice and report a bit about our settings
|
# We are nice and report a bit about our settings
|
||||||
@ -3609,6 +3624,9 @@ sub mysqld_arguments ($$$$$) {
|
|||||||
# Turn on logging, will be sent to tables
|
# Turn on logging, will be sent to tables
|
||||||
mtr_add_arg($args, "%s--log=", $prefix);
|
mtr_add_arg($args, "%s--log=", $prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mtr_add_arg($args, "%s--plugin_dir=%s", $prefix,
|
||||||
|
dirname($lib_example_plugin));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $type eq 'slave' )
|
if ( $type eq 'slave' )
|
||||||
@ -4480,7 +4498,9 @@ sub run_mysqltest ($) {
|
|||||||
}
|
}
|
||||||
else # component_id == mysqld
|
else # component_id == mysqld
|
||||||
{
|
{
|
||||||
mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'});
|
# mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'});
|
||||||
|
mtr_add_arg($args, "--host=127.0.0.1");
|
||||||
|
|
||||||
mtr_add_arg($args, "--port=%d", $master->[0]->{'port'});
|
mtr_add_arg($args, "--port=%d", $master->[0]->{'port'});
|
||||||
mtr_add_arg($args, "--database=test");
|
mtr_add_arg($args, "--database=test");
|
||||||
mtr_add_arg($args, "--user=%s", $opt_user);
|
mtr_add_arg($args, "--user=%s", $opt_user);
|
||||||
|
2
mysql-test/r/have_example_plugin.require
Normal file
2
mysql-test/r/have_example_plugin.require
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
have_example_plugin
|
||||||
|
1
|
15
mysql-test/r/plugin.result
Normal file
15
mysql-test/r/plugin.result
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
CREATE TABLE t1(a int) ENGINE=EXAMPLE;
|
||||||
|
Warnings:
|
||||||
|
Error 1286 Unknown table engine 'EXAMPLE'
|
||||||
|
DROP TABLE t1;
|
||||||
|
INSTALL PLUGIN example SONAME 'ha_example.so';
|
||||||
|
INSTALL PLUGIN EXAMPLE SONAME 'ha_example.so';
|
||||||
|
ERROR HY000: Function 'EXAMPLE' already exists
|
||||||
|
UNINSTALL PLUGIN example;
|
||||||
|
INSTALL PLUGIN example SONAME 'ha_example.so';
|
||||||
|
CREATE TABLE t1(a int) ENGINE=EXAMPLE;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
a
|
||||||
|
DROP TABLE t1;
|
||||||
|
UNINSTALL PLUGIN non_exist;
|
||||||
|
ERROR 42000: PLUGIN non_exist does not exist
|
26
mysql-test/t/plugin.test
Normal file
26
mysql-test/t/plugin.test
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
--source include/have_example_plugin.inc
|
||||||
|
|
||||||
|
CREATE TABLE t1(a int) ENGINE=EXAMPLE;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
INSTALL PLUGIN example SONAME 'ha_example.so';
|
||||||
|
--error 1125
|
||||||
|
INSTALL PLUGIN EXAMPLE SONAME 'ha_example.so';
|
||||||
|
|
||||||
|
UNINSTALL PLUGIN example;
|
||||||
|
|
||||||
|
INSTALL PLUGIN example SONAME 'ha_example.so';
|
||||||
|
|
||||||
|
CREATE TABLE t1(a int) ENGINE=EXAMPLE;
|
||||||
|
|
||||||
|
# Let's do some advanced ops with the example engine :)
|
||||||
|
SELECT * FROM t1;
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
# Waiting for fix to BUG#22694
|
||||||
|
#UNINSTALL PLUGIN example;
|
||||||
|
#UNINSTALL PLUGIN EXAMPLE;
|
||||||
|
|
||||||
|
--error 1305
|
||||||
|
UNINSTALL PLUGIN non_exist;
|
Reference in New Issue
Block a user