Commit 1bdc15e1 authored by unknown's avatar unknown

Add test to mysql-test-run.pl to see if the udf_example.so is availble. Set...

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. 


mysql-test/include/have_udf.inc:
  Add check if udf_example.so(or similar) is available
mysql-test/lib/mtr_misc.pl:
  Add funcion "mtr_file_exist" to search for files
mysql-test/mysql-test-run.pl:
  Add checks to find the udf_example.so library
mysql-test/r/udf.result:
  Update result
mysql-test/t/disabled.def:
  Remove udf.test from disabled tests
mysql-test/t/udf.test:
  Use variable UDF_EXAMPLE_LIB when looking for shared library to load
mysql-test/r/have_udf_example.require:
  New BitKeeper file ``mysql-test/r/have_udf_example.require''
parent 2f4f68be
...@@ -6,3 +6,11 @@ ...@@ -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 ($); ...@@ -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 (@) { ...@@ -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; ...@@ -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 () { ...@@ -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 ($) { ...@@ -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;
......
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 @@ ...@@ -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; ...@@ -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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment