Add test to mysql-test-run.pl to see if the udf_example.so is availble. Set envioronment variable UDF_EXAMPLE_LIB if it is.
Then check in have_udf if that variable is set. Finally use tahe variable when loading the shared library.
This commit is contained in:
parent
0e08e39763
commit
0e5113aead
@ -6,3 +6,11 @@
|
|||||||
disable_query_log;
|
disable_query_log;
|
||||||
show variables like "have_dynamic_loading";
|
show variables like "have_dynamic_loading";
|
||||||
enable_query_log;
|
enable_query_log;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check if the variable UDF_EXAMPLE_LIB is set
|
||||||
|
#
|
||||||
|
--require r/have_udf_example.require
|
||||||
|
disable_query_log;
|
||||||
|
eval select LENGTH("$UDF_EXAMPLE_LIB") > 0 as "have_udf_example_lib";
|
||||||
|
enable_query_log;
|
||||||
|
@ -12,6 +12,7 @@ sub mtr_init_args ($);
|
|||||||
sub mtr_add_arg ($$@);
|
sub mtr_add_arg ($$@);
|
||||||
sub mtr_path_exists(@);
|
sub mtr_path_exists(@);
|
||||||
sub mtr_script_exists(@);
|
sub mtr_script_exists(@);
|
||||||
|
sub mtr_file_exists(@);
|
||||||
sub mtr_exe_exists(@);
|
sub mtr_exe_exists(@);
|
||||||
sub mtr_copy_dir($$);
|
sub mtr_copy_dir($$);
|
||||||
sub mtr_same_opts($$);
|
sub mtr_same_opts($$);
|
||||||
@ -94,6 +95,21 @@ sub mtr_script_exists (@) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub mtr_file_exists (@) {
|
||||||
|
foreach my $path ( @_ )
|
||||||
|
{
|
||||||
|
return $path if -e $path;
|
||||||
|
}
|
||||||
|
if ( @_ == 1 )
|
||||||
|
{
|
||||||
|
mtr_error("Could not find $_[0]");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mtr_error("Could not find any of " . join(" ", @_));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sub mtr_exe_exists (@) {
|
sub mtr_exe_exists (@) {
|
||||||
my @path= @_;
|
my @path= @_;
|
||||||
map {$_.= ".exe"} @path if $::glob_win32;
|
map {$_.= ".exe"} @path if $::glob_win32;
|
||||||
|
@ -188,6 +188,7 @@ our $exe_mysqltest;
|
|||||||
our $exe_slave_mysqld;
|
our $exe_slave_mysqld;
|
||||||
our $exe_im;
|
our $exe_im;
|
||||||
our $exe_my_print_defaults;
|
our $exe_my_print_defaults;
|
||||||
|
our $lib_udf_example;
|
||||||
|
|
||||||
our $opt_bench= 0;
|
our $opt_bench= 0;
|
||||||
our $opt_small_bench= 0;
|
our $opt_small_bench= 0;
|
||||||
@ -1057,6 +1058,8 @@ sub executable_setup () {
|
|||||||
mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables");
|
mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables");
|
||||||
$path_ndb_tools_dir= mtr_path_exists("$glob_basedir/ndb/tools");
|
$path_ndb_tools_dir= mtr_path_exists("$glob_basedir/ndb/tools");
|
||||||
$exe_ndb_mgm= "$glob_basedir/ndb/src/mgmclient/ndb_mgm";
|
$exe_ndb_mgm= "$glob_basedir/ndb/src/mgmclient/ndb_mgm";
|
||||||
|
$lib_udf_example=
|
||||||
|
mtr_file_exists("$glob_basedir/sql/.libs/udf_example.so");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2936,6 +2939,7 @@ sub run_mysqltest ($) {
|
|||||||
$ENV{'MYSQL_CLIENT_TEST'}= $cmdline_mysql_client_test;
|
$ENV{'MYSQL_CLIENT_TEST'}= $cmdline_mysql_client_test;
|
||||||
$ENV{'CHARSETSDIR'}= $path_charsetsdir;
|
$ENV{'CHARSETSDIR'}= $path_charsetsdir;
|
||||||
$ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults;
|
$ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults;
|
||||||
|
$ENV{'UDF_EXAMPLE_LIB'}= basename($lib_udf_example);
|
||||||
|
|
||||||
$ENV{'NDB_MGM'}= $exe_ndb_mgm;
|
$ENV{'NDB_MGM'}= $exe_ndb_mgm;
|
||||||
$ENV{'NDB_BACKUP_DIR'}= $path_ndb_data_dir;
|
$ENV{'NDB_BACKUP_DIR'}= $path_ndb_data_dir;
|
||||||
|
2
mysql-test/r/have_udf_example.require
Normal file
2
mysql-test/r/have_udf_example.require
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
have_udf_example_lib
|
||||||
|
1
|
@ -1,15 +1,15 @@
|
|||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
|
CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
|
||||||
CREATE FUNCTION myfunc_double RETURNS REAL SONAME 'udf_example.so';
|
CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
|
||||||
CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME 'udf_example.so';
|
CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
|
||||||
ERROR HY000: Can't find function 'myfunc_nonexist' in library
|
ERROR HY000: Can't find function 'myfunc_nonexist' in library
|
||||||
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME 'udf_example.so';
|
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
|
||||||
CREATE FUNCTION sequence RETURNS INTEGER SONAME "udf_example.so";
|
CREATE FUNCTION sequence RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
|
||||||
CREATE FUNCTION lookup RETURNS STRING SONAME 'udf_example.so';
|
CREATE FUNCTION lookup RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
|
||||||
CREATE FUNCTION reverse_lookup
|
CREATE FUNCTION reverse_lookup
|
||||||
RETURNS STRING SONAME 'udf_example.so';
|
RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
|
||||||
CREATE AGGREGATE FUNCTION avgcost
|
CREATE AGGREGATE FUNCTION avgcost
|
||||||
RETURNS REAL SONAME 'udf_example.so';
|
RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
|
||||||
select myfunc_double();
|
select myfunc_double();
|
||||||
ERROR HY000: myfunc_double must have at least one argument
|
ERROR HY000: myfunc_double must have at least one argument
|
||||||
select myfunc_double(1);
|
select myfunc_double(1);
|
||||||
|
@ -12,4 +12,3 @@
|
|||||||
|
|
||||||
sp-goto : GOTO is currently is disabled - will be fixed in the future
|
sp-goto : GOTO is currently is disabled - will be fixed in the future
|
||||||
ndb_load : Bug#17233
|
ndb_load : Bug#17233
|
||||||
udf : Bug#18564
|
|
||||||
|
@ -14,18 +14,26 @@ drop table if exists t1;
|
|||||||
# Create the example functions from udf_example
|
# Create the example functions from udf_example
|
||||||
#
|
#
|
||||||
|
|
||||||
CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
|
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
|
||||||
CREATE FUNCTION myfunc_double RETURNS REAL SONAME 'udf_example.so';
|
eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
|
||||||
|
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
|
||||||
|
eval CREATE FUNCTION myfunc_double RETURNS REAL SONAME "$UDF_EXAMPLE_LIB";
|
||||||
|
|
||||||
|
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
|
||||||
--error ER_CANT_FIND_DL_ENTRY
|
--error ER_CANT_FIND_DL_ENTRY
|
||||||
CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME 'udf_example.so';
|
eval CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB";
|
||||||
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME 'udf_example.so';
|
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
|
||||||
CREATE FUNCTION sequence RETURNS INTEGER SONAME "udf_example.so";
|
eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB";
|
||||||
CREATE FUNCTION lookup RETURNS STRING SONAME 'udf_example.so';
|
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
|
||||||
CREATE FUNCTION reverse_lookup
|
eval CREATE FUNCTION sequence RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB";
|
||||||
RETURNS STRING SONAME 'udf_example.so';
|
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
|
||||||
CREATE AGGREGATE FUNCTION avgcost
|
eval CREATE FUNCTION lookup RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
|
||||||
RETURNS REAL SONAME 'udf_example.so';
|
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
|
||||||
|
eval CREATE FUNCTION reverse_lookup
|
||||||
|
RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
|
||||||
|
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
|
||||||
|
eval CREATE AGGREGATE FUNCTION avgcost
|
||||||
|
RETURNS REAL SONAME "$UDF_EXAMPLE_LIB";
|
||||||
|
|
||||||
--error 0
|
--error 0
|
||||||
select myfunc_double();
|
select myfunc_double();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user