diff options
author | unknown <msvensson@shellback.(none)> | 2006-04-27 16:32:40 +0200 |
---|---|---|
committer | unknown <msvensson@shellback.(none)> | 2006-04-27 16:32:40 +0200 |
commit | 1bdc15e10023f4d46c45517c61138fa721ee9ded (patch) | |
tree | 82ce0e2ddc929afcb7f738cf15f1720d5aad8250 /mysql-test | |
parent | 2f4f68be5318117f468644c612c022ceb657d9d3 (diff) | |
download | mariadb-git-1bdc15e10023f4d46c45517c61138fa721ee9ded.tar.gz |
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''
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/include/have_udf.inc | 8 | ||||
-rw-r--r-- | mysql-test/lib/mtr_misc.pl | 16 | ||||
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 4 | ||||
-rw-r--r-- | mysql-test/r/have_udf_example.require | 2 | ||||
-rw-r--r-- | mysql-test/r/udf.result | 16 | ||||
-rw-r--r-- | mysql-test/t/disabled.def | 1 | ||||
-rw-r--r-- | mysql-test/t/udf.test | 28 |
7 files changed, 56 insertions, 19 deletions
diff --git a/mysql-test/include/have_udf.inc b/mysql-test/include/have_udf.inc index b6e6f0f2516..42b9942f74d 100644 --- a/mysql-test/include/have_udf.inc +++ b/mysql-test/include/have_udf.inc @@ -6,3 +6,11 @@ disable_query_log; show variables like "have_dynamic_loading"; 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; diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl index 90617194897..7676401f08e 100644 --- a/mysql-test/lib/mtr_misc.pl +++ b/mysql-test/lib/mtr_misc.pl @@ -12,6 +12,7 @@ sub mtr_init_args ($); sub mtr_add_arg ($$@); sub mtr_path_exists(@); sub mtr_script_exists(@); +sub mtr_file_exists(@); sub mtr_exe_exists(@); sub mtr_copy_dir($$); 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 (@) { my @path= @_; map {$_.= ".exe"} @path if $::glob_win32; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index e4bfc73dbdd..b7a19bc8a74 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -188,6 +188,7 @@ our $exe_mysqltest; our $exe_slave_mysqld; our $exe_im; our $exe_my_print_defaults; +our $lib_udf_example; our $opt_bench= 0; our $opt_small_bench= 0; @@ -1057,6 +1058,8 @@ sub executable_setup () { mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables"); $path_ndb_tools_dir= mtr_path_exists("$glob_basedir/ndb/tools"); $exe_ndb_mgm= "$glob_basedir/ndb/src/mgmclient/ndb_mgm"; + $lib_udf_example= + mtr_file_exists("$glob_basedir/sql/.libs/udf_example.so"); } else { @@ -2936,6 +2939,7 @@ sub run_mysqltest ($) { $ENV{'MYSQL_CLIENT_TEST'}= $cmdline_mysql_client_test; $ENV{'CHARSETSDIR'}= $path_charsetsdir; $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_BACKUP_DIR'}= $path_ndb_data_dir; diff --git a/mysql-test/r/have_udf_example.require b/mysql-test/r/have_udf_example.require new file mode 100644 index 00000000000..e60fab1dbe0 --- /dev/null +++ b/mysql-test/r/have_udf_example.require @@ -0,0 +1,2 @@ +have_udf_example_lib +1 diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result index ce9271224dc..be52fd7f87c 100644 --- a/mysql-test/r/udf.result +++ b/mysql-test/r/udf.result @@ -1,15 +1,15 @@ drop table if exists t1; -CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so'; -CREATE FUNCTION myfunc_double RETURNS REAL SONAME 'udf_example.so'; -CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME 'udf_example.so'; +CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; +CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB"; +CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; ERROR HY000: Can't find function 'myfunc_nonexist' in library -CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME 'udf_example.so'; -CREATE FUNCTION sequence RETURNS INTEGER SONAME "udf_example.so"; -CREATE FUNCTION lookup RETURNS STRING SONAME 'udf_example.so'; +CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +CREATE FUNCTION sequence RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +CREATE FUNCTION lookup RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; CREATE FUNCTION reverse_lookup -RETURNS STRING SONAME 'udf_example.so'; +RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; CREATE AGGREGATE FUNCTION avgcost -RETURNS REAL SONAME 'udf_example.so'; +RETURNS REAL SONAME "UDF_EXAMPLE_LIB"; select myfunc_double(); ERROR HY000: myfunc_double must have at least one argument select myfunc_double(1); diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index dee6146017d..f71e24ff3ed 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -12,4 +12,3 @@ sp-goto : GOTO is currently is disabled - will be fixed in the future ndb_load : Bug#17233 -udf : Bug#18564 diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test index c9f22cf410b..e2556692612 100644 --- a/mysql-test/t/udf.test +++ b/mysql-test/t/udf.test @@ -14,18 +14,26 @@ drop table if exists t1; # Create the example functions from udf_example # -CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so'; -CREATE FUNCTION myfunc_double RETURNS REAL SONAME 'udf_example.so'; +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +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 -CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME 'udf_example.so'; -CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME 'udf_example.so'; -CREATE FUNCTION sequence RETURNS INTEGER SONAME "udf_example.so"; -CREATE FUNCTION lookup RETURNS STRING SONAME 'udf_example.so'; -CREATE FUNCTION reverse_lookup - RETURNS STRING SONAME 'udf_example.so'; -CREATE AGGREGATE FUNCTION avgcost - RETURNS REAL SONAME 'udf_example.so'; +eval CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB"; +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB"; +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +eval CREATE FUNCTION sequence RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB"; +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +eval CREATE FUNCTION lookup RETURNS STRING SONAME "$UDF_EXAMPLE_LIB"; +--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 select myfunc_double(); |