diff options
Diffstat (limited to 'mysql-test')
31 files changed, 272 insertions, 128 deletions
diff --git a/mysql-test/include/have_ndb.inc b/mysql-test/include/have_ndb.inc index 28fcf18cb16..721d79392b7 100644 --- a/mysql-test/include/have_ndb.inc +++ b/mysql-test/include/have_ndb.inc @@ -1,6 +1,13 @@ ---exec test x$NDB_STATUS_OK = x1 +# Check that server is compiled and started with support for NDB -- require r/have_ndb.require disable_query_log; show variables like "have_ndbcluster"; enable_query_log; +# Check that NDB is installed and known to be working +-- require r/have_ndb_status_ok.require +disable_query_log; +eval select "$NDB_STATUS_OK" as ndb_status_ok; +enable_query_log; + + diff --git a/mysql-test/include/have_udf.inc b/mysql-test/include/have_udf.inc index 5ed1c587385..42b9942f74d 100644 --- a/mysql-test/include/have_udf.inc +++ b/mysql-test/include/have_udf.inc @@ -4,11 +4,13 @@ # --require r/have_udf.require disable_query_log; -show variables like "have_dlopen"; +show variables like "have_dynamic_loading"; enable_query_log; # -# Check that the "udf_example.so" file has been created +# Check if the variable UDF_EXAMPLE_LIB is set # - -# TODO +--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/include/not_as_root.inc b/mysql-test/include/not_as_root.inc new file mode 100644 index 00000000000..e0277ea593e --- /dev/null +++ b/mysql-test/include/not_as_root.inc @@ -0,0 +1,4 @@ +-- require r/not_as_root.require +disable_query_log; +eval select "$MYSQL_TEST_ROOT" as running_as_root; +enable_query_log; diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl index 5b2fd5c6df6..b5a2e5a4a68 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,14 @@ sub mtr_script_exists (@) { } } +sub mtr_file_exists (@) { + foreach my $path ( @_ ) + { + return $path if -e $path; + } + return ""; +} + sub mtr_exe_exists (@) { my @path= @_; map {$_.= ".exe"} @path if $::glob_win32; @@ -111,18 +120,27 @@ sub mtr_exe_exists (@) { } } + sub mtr_copy_dir($$) { - my $srcdir= shift; - my $dstdir= shift; + my $from_dir= shift; + my $to_dir= shift; + + mkpath("$to_dir"); + opendir(DIR, "$from_dir") + or mtr_error("Can't find $from_dir$!"); + for(readdir(DIR)) { + next if "$_" eq "." or "$_" eq ".."; + if ( -d "$from_dir/$_" ) + { + mtr_copy_dir("$from_dir/$_", "$to_dir/$_"); + next; + } + copy("$from_dir/$_", "$to_dir/$_"); + } + closedir(DIR); - # Create destination directory - mkpath($dstdir); - find(\&mtr_copy_one_file, $dstdir); } -sub mtr_copy_one_file { - print $File::Find::name, "\n"; -} sub mtr_same_opts ($$) { my $l1= shift; diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index 779be3d7081..d1d74ec9a61 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -674,10 +674,12 @@ sub mtr_mysqladmin_shutdown { mtr_add_arg($args, "shutdown"); # Start mysqladmin in paralell and wait for termination later my $pid= mtr_spawn($::exe_mysqladmin, $args, - "", $::path_manager_log, $::path_manager_log, "", + "", $path_mysqladmin_log, $path_mysqladmin_log, "", { append_log_file => 1 }); # Save the pid of the mysqladmin process $mysql_admin_pids{$pid}= 1; + + # We don't wait for termination of mysqladmin } # Wait for all the started mysqladmin to exit @@ -720,8 +722,6 @@ sub mtr_mysqladmin_shutdown { $timeout or mtr_debug("At least one server is still listening to its port"); - sleep(5) if $::glob_win32; # FIXME next startup fails if no sleep - return $res; } @@ -821,8 +821,10 @@ sub sleep_until_file_created ($$$) { my $pidfile= shift; my $timeout= shift; my $pid= shift; + my $sleeptime= 100; # Milliseconds + my $loops= ($timeout * 1000) / $sleeptime; - for ( my $loop= 1; $loop <= $timeout; $loop++ ) + for ( my $loop= 1; $loop <= $loops; $loop++ ) { if ( -r $pidfile ) { @@ -835,16 +837,20 @@ sub sleep_until_file_created ($$$) { return 0; } - mtr_debug("Sleep 1 second waiting for creation of $pidfile"); + mtr_debug("Sleep $sleeptime milliseconds waiting for ". + "creation of $pidfile"); - if ( $loop % 60 == 0 ) + # Print extra message every 60 seconds + my $seconds= ($loop * $sleeptime) / 1000; + if ( $seconds > 1 and $seconds % 60 == 0 ) { - my $left= $timeout - $loop; - mtr_warning("Waited $loop seconds for $pidfile to be created, " . + my $left= $timeout - $seconds; + mtr_warning("Waited $seconds seconds for $pidfile to be created, " . "still waiting for $left seconds..."); } - sleep(1); + # Millisceond sleep emulated with select + select(undef, undef, undef, ($sleeptime/1000)); } return 0; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 4945b87408d..fc8495e6acc 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -158,9 +158,9 @@ our $path_client_bindir; our $path_language; our $path_timefile; our $path_snapshot; -our $path_manager_log; # Used by mysqldadmin our $path_slave_load_tmpdir; # What is this?! our $path_mysqltest_log; +our $path_current_test_log; our $path_my_basedir; our $opt_vardir; # A path but set directly on cmd line our $opt_vardir_trace; # unix formatted opt_vardir for trace files @@ -191,6 +191,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; @@ -207,7 +208,6 @@ our $opt_sp_protocol; our $opt_cursor_protocol; our $opt_view_protocol; -our $opt_current_test; our $opt_debug; our $opt_do_test; our @opt_cases; # The test cases names in argv @@ -250,9 +250,6 @@ our $opt_ndbconnectstring; our $opt_ndbcluster_port_slave; our $opt_ndbconnectstring_slave; -our $opt_no_manager; # Does nothing now, we never use manager -our $opt_manager_port; # Does nothing now, we never use manager - our $opt_old_master; our $opt_record; @@ -262,6 +259,7 @@ our $opt_result_ext; our $opt_skip; our $opt_skip_rpl; +our $use_slaves; our $opt_skip_test; our $opt_skip_im; @@ -349,6 +347,7 @@ sub environment_setup (); sub kill_running_server (); sub kill_and_cleanup (); sub check_ssl_support (); +sub check_running_as_root(); sub check_ndbcluster_support (); sub rm_ndbcluster_tables ($); sub ndbcluster_install (); @@ -391,6 +390,7 @@ sub main () { check_ndbcluster_support(); # We check whether to actually use it later check_ssl_support(); + check_running_as_root(); environment_setup(); signal_setup(); @@ -421,16 +421,15 @@ sub main () { my $tests= collect_test_cases($opt_suite); # Turn off NDB and other similar options if no tests use it - my ($need_ndbcluster,$need_im,$need_slave); + my ($need_ndbcluster,$need_im); foreach my $test (@$tests) { $need_ndbcluster||= $test->{ndb_test}; $need_im||= $test->{component_id} eq 'im'; - $need_slave||= $test->{slave_num}; + $use_slaves||= $test->{slave_num}; } $opt_with_ndbcluster= 0 unless $need_ndbcluster; $opt_skip_im= 1 unless $need_im; - $opt_skip_rpl= 1 unless $need_slave; snapshot_setup(); initialize_servers(); @@ -578,7 +577,6 @@ sub command_line_setup () { 'compress' => \$opt_compress, 'bench' => \$opt_bench, 'small-bench' => \$opt_small_bench, - 'no-manager' => \$opt_no_manager, # Currently not used # Control what test suites or cases to run 'force' => \$opt_force, @@ -605,7 +603,6 @@ sub command_line_setup () { 'slave_port=i' => \$opt_slave_myport, 'ndbcluster-port|ndbcluster_port=i' => \$opt_ndbcluster_port, 'ndbcluster-port-slave=i' => \$opt_ndbcluster_port_slave, - 'manager-port=i' => \$opt_manager_port, # Currently not used 'im-port=i' => \$im_port, # Instance Manager port. 'im-mysqld1-port=i' => \$im_mysqld1_port, # Port of mysqld, controlled by IM 'im-mysqld2-port=i' => \$im_mysqld2_port, # Port of mysqld, controlled by IM @@ -739,11 +736,6 @@ sub command_line_setup () { $opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir; $opt_tmpdir =~ s,/+$,,; # Remove ending slash if any - # FIXME maybe not needed? - $path_manager_log= "$opt_vardir/log/manager.log" - unless $path_manager_log; - $opt_current_test= "$opt_vardir/log/current_test" - unless $opt_current_test; # -------------------------------------------------------------------------- # Do sanity checks of command line arguments @@ -983,6 +975,7 @@ sub command_line_setup () { $path_timefile= "$opt_vardir/log/mysqltest-time"; $path_mysqltest_log= "$opt_vardir/log/mysqltest.log"; + $path_current_test_log= "$opt_vardir/log/current_test"; $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/"; } @@ -994,7 +987,7 @@ sub snapshot_setup () { $master->[0]->{'path_myddir'}, $master->[1]->{'path_myddir'}); - unless ($opt_skip_rpl) + if ($use_slaves) { push @data_dir_lst, ($slave->[0]->{'path_myddir'}, $slave->[1]->{'path_myddir'}, @@ -1089,6 +1082,8 @@ sub executable_setup () { "/usr/bin/false"); $path_ndb_tools_dir= mtr_path_exists("$glob_basedir/storage/ndb/tools"); $exe_ndb_mgm= "$glob_basedir/storage/ndb/src/mgmclient/ndb_mgm"; + $lib_udf_example= + mtr_file_exists("$glob_basedir/sql/.libs/udf_example.so"); } else { @@ -1186,7 +1181,7 @@ sub environment_setup () { # Add the path where mysqld will find udf_example.so # -------------------------------------------------------------------------- $ENV{'LD_LIBRARY_PATH'}= - "$glob_basedir/sql/.libs" . + ($lib_udf_example ? dirname($lib_udf_example) : "") . ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : ""); @@ -1213,6 +1208,7 @@ sub environment_setup () { $ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port; $ENV{'NDBCLUSTER_PORT_SLAVE'}=$opt_ndbcluster_port_slave; + $ENV{'NDB_STATUS_OK'}= "YES"; $ENV{'IM_PATH_PID'}= $instance_manager->{path_pid}; $ENV{'IM_PORT'}= $instance_manager->{port}; @@ -1252,6 +1248,7 @@ sub signal_setup () { $SIG{INT}= \&handle_int_signal; } + sub handle_int_signal () { $SIG{INT}= 'DEFAULT'; # If we get a ^C again, we die... mtr_warning("got INT signal, cleaning up....."); @@ -1371,6 +1368,33 @@ sub kill_and_cleanup () { } +sub check_running_as_root () { + # Check if running as root + # i.e a file can be read regardless what mode we set it to + my $test_file= "test_running_as_root.txt"; + mtr_tofile($test_file, "MySQL"); + chmod(oct("0000"), $test_file); + + my $result=""; + if (open(FILE,"<",$test_file)) + { + $result= join('', <FILE>); + close FILE; + } + + chmod(oct("0755"), $test_file); + unlink($test_file); + + $ENV{'MYSQL_TEST_ROOT'}= "NO"; + if ($result eq "MySQL") + { + mtr_warning("running this script as _root_ will cause some " . + "tests to be skipped"); + $ENV{'MYSQL_TEST_ROOT'}= "YES"; + } +} + + sub check_ssl_support () { @@ -1469,7 +1493,6 @@ sub check_ndbcluster_support () { return; } -# FIXME why is there a different start below?! sub ndbcluster_install () { @@ -1499,6 +1522,7 @@ sub ndbcluster_install () { return 0; } + sub ndbcluster_start ($) { my $use_ndbcluster= shift; @@ -1802,7 +1826,7 @@ sub mysql_install_db () { install_db('master', $master->[0]->{'path_myddir'}); install_db('master', $master->[1]->{'path_myddir'}); - if ( ! $opt_skip_rpl ) + if ( $use_slaves ) { install_db('slave', $slave->[0]->{'path_myddir'}); install_db('slave', $slave->[1]->{'path_myddir'}); @@ -1822,6 +1846,7 @@ sub mysql_install_db () { mtr_report("ndbcluster_install failed, continuing without cluster"); $opt_with_ndbcluster= 0; $flag_ndb_status_ok= 0; + $ENV{'NDB_STATUS_OK'}= "NO"; } else { @@ -1861,7 +1886,7 @@ sub install_db ($$) { my $init_db_sql_tmp= "/tmp/init_db.sql$$"; my $args; - mtr_report("Installing \u$type Databases"); + mtr_report("Installing \u$type Database"); open(IN, $init_db_sql) or mtr_error("Can't open $init_db_sql: $!"); @@ -1905,8 +1930,15 @@ sub install_db ($$) { mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); } + # Log bootstrap command + my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log"; + mtr_tofile($path_bootstrap_log, + "$exe_mysqld " . join(" ", @$args) . "\n"); + if ( mtr_run($exe_mysqld, $args, $init_db_sql_tmp, - $path_manager_log, $path_manager_log, "") != 0 ) + $path_bootstrap_log, $path_bootstrap_log, + "", { append_log_file => 1 }) != 0 ) + { unlink($init_db_sql_tmp); mtr_error("Error executing mysqld --bootstrap\n" . @@ -1928,15 +1960,15 @@ sub im_create_passwd_file($) { my $instance_manager = shift; my $pwd_file_path = $instance_manager->{'password_file'}; - + mtr_report("Creating IM password file ($pwd_file_path)"); - + open(OUT, ">", $pwd_file_path) or mtr_error("Can't write to $pwd_file_path: $!"); - + print OUT $instance_manager->{'admin_login'}, ":", $instance_manager->{'admin_sha1'}, "\n"; - + close(OUT); } @@ -1948,7 +1980,7 @@ sub im_create_defaults_file($) { open(OUT, ">", $defaults_file) or mtr_error("Can't write to $defaults_file: $!"); - + print OUT <<EOF [mysql] @@ -2030,7 +2062,7 @@ sub run_testcase ($) { my $ndbcluster_opt; - mtr_tonewfile($opt_current_test,"$tname\n"); # Always tell where we are + mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are # output current test to ndbcluster log file to enable diagnostics mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n"); @@ -2109,7 +2141,7 @@ sub run_testcase ($) { # ---------------------------------------------------------------------- stop_slaves(); - } + } # ---------------------------------------------------------------------- # Prepare to start masters. Even if we use embedded, we want to run @@ -2126,9 +2158,9 @@ sub run_testcase ($) { mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n"); } -# FIXME test cases that depend on each other, prevent this from -# being at this location. -# do_before_start_master($tname,$tinfo->{'master_sh'}); + # FIXME test cases that depend on each other, prevent this from + # being at this location. + # do_before_start_master($tname,$tinfo->{'master_sh'}); # ---------------------------------------------------------------------- # If any mysqld servers running died, we have to know @@ -2329,25 +2361,6 @@ sub run_testcase ($) { } } -sub copy_dir($$) { - my $from_dir= shift; - my $to_dir= shift; - - mkpath("$to_dir"); - opendir(DIR, "$from_dir") - or mtr_error("Can't find $from_dir$!"); - for(readdir(DIR)) { - next if "$_" eq "." or "$_" eq ".."; - if ( -d "$from_dir/$_" ) - { - copy_dir("$from_dir/$_", "$to_dir/$_"); - next; - } - copy("$from_dir/$_", "$to_dir/$_"); - } - closedir(DIR); - -} # # Save a snapshot of the installed test db(s) @@ -2361,7 +2374,7 @@ sub save_installed_db () { foreach my $data_dir (@data_dir_lst) { my $name= basename($data_dir); - copy_dir("$data_dir", "$path_snapshot/$name"); + mtr_copy_dir("$data_dir", "$path_snapshot/$name"); } } @@ -2385,6 +2398,7 @@ sub save_files_before_restore($$) { } } + # # Restore snapshot of the installed test db(s) # if the snapshot exists @@ -2403,7 +2417,7 @@ sub restore_installed_db ($) { my $name= basename($data_dir); save_files_before_restore($test_name, $data_dir); rmtree("$data_dir"); - copy_dir("$path_snapshot/$name", "$data_dir"); + mtr_copy_dir("$path_snapshot/$name", "$data_dir"); } if ($opt_with_ndbcluster) { @@ -2460,9 +2474,9 @@ sub report_failure_and_restart ($) { # ############################################################################## + # The embedded server needs the cleanup so we do some of the start work # but stop before actually running mysqld or anything. - sub do_before_start_master ($$) { my $tname= shift; my $init_script= shift; @@ -2495,13 +2509,14 @@ sub do_before_start_master ($$) { if ( $ret != 0 ) { # FIXME rewrite those scripts to return 0 if successful -# mtr_warning("$init_script exited with code $ret"); + # mtr_warning("$init_script exited with code $ret"); } } # for gcov FIXME needed? If so we need more absolute paths -# chdir($glob_basedir); + # chdir($glob_basedir); } + sub do_before_start_slave ($$) { my $tname= shift; my $init_script= shift; @@ -2529,7 +2544,7 @@ sub do_before_start_slave ($$) { if ( $ret != 0 ) { # FIXME rewrite those scripts to return 0 if successful -# mtr_warning("$init_script exited with code $ret"); + # mtr_warning("$init_script exited with code $ret"); } } @@ -2539,6 +2554,7 @@ sub do_before_start_slave ($$) { } } + sub mysqld_arguments ($$$$$$) { my $args= shift; my $type= shift; # master/slave/bootstrap @@ -2783,14 +2799,6 @@ sub mysqld_arguments ($$$$$$) { return $args; } -# FIXME -# if ( $type eq 'master' and $glob_use_embedded_server ) -# { -# # Add a -A to each argument to pass it to embedded server -# my @mysqltest_opt= map {("-A",$_)} @args; -# $opt_extra_mysqltest_opt= \@mysqltest_opt; -# return; -# } ############################################################################## # @@ -2890,6 +2898,7 @@ sub mysqld_start ($$$$$) { return 0; } + sub stop_masters_slaves () { print "Ending Tests\n"; @@ -2899,7 +2908,7 @@ sub stop_masters_slaves () { print "Shutting-down Instance Manager\n"; im_stop($instance_manager); } - + print "Shutting-down MySQL daemon\n\n"; stop_masters(); print "Master(s) shutdown finished\n"; @@ -2907,6 +2916,7 @@ sub stop_masters_slaves () { print "Slave(s) shutdown finished\n"; } + sub stop_masters () { my @args; @@ -2936,6 +2946,7 @@ sub stop_masters () { mtr_stop_mysqld_servers(\@args); } + sub stop_slaves () { my $force= shift; @@ -2990,7 +3001,7 @@ sub im_start($$) { mtr_add_arg($args, $opt); } - $instance_manager->{'pid'} = + $instance_manager->{'pid'} = mtr_spawn( $exe_im, # path to the executable $args, # cmd-line args @@ -3006,7 +3017,7 @@ sub im_start($$) { mtr_report('Could not start Instance Manager'); return; } - + # Instance Manager can be run in daemon mode. In this case, it creates # several processes and the parent process, created by mtr_spawn(), exits just # after start. So, we have to obtain Instance Manager PID from the PID file. @@ -3024,6 +3035,7 @@ sub im_start($$) { mtr_get_pid_from_file($instance_manager->{'path_pid'}); } + sub im_stop($) { my $instance_manager = shift; @@ -3058,12 +3070,13 @@ sub im_stop($) { # Kill processes. mtr_kill_processes(\@pids); - + stop_reap_all(); $instance_manager->{'pid'} = undef; } + # # Run include/check-testcase.test # Before a testcase, run in record mode, save result file to var @@ -3112,6 +3125,7 @@ sub run_check_testcase ($) { } } + sub run_mysqltest ($) { my $tinfo= shift; @@ -3205,11 +3219,6 @@ sub run_mysqltest ($) { "--port=$master->[0]->{'path_myport'} " . "--socket=$master->[0]->{'path_mysock'}"; - - - # FIXME really needing a PATH??? - # $ENV{'PATH'}= "/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$ENV{'PATH'}"; - $ENV{'MYSQL'}= $cmdline_mysql; $ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck; $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump; @@ -3222,6 +3231,8 @@ 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'}= + ($lib_udf_example ? basename($lib_udf_example) : ""); $ENV{'NDB_STATUS_OK'}= $flag_ndb_status_ok; $ENV{'NDB_SLAVE_STATUS_OK'}= $flag_ndb_slave_status_ok; @@ -3477,6 +3488,7 @@ sub gdb_arguments { $$exe= "xterm"; } + # # Modify the exe and args so that program is run in ddd # @@ -3508,8 +3520,7 @@ sub ddd_arguments { "break mysql_parse\n" . "commands 1\n" . "disable 1\n" . - "end\n" . - "run"); + "end"); } if ( $opt_manual_ddd ) diff --git a/mysql-test/r/ctype_latin2_ch.result b/mysql-test/r/ctype_latin2_ch.result index 2b3765c07c4..5b607872737 100644 --- a/mysql-test/r/ctype_latin2_ch.result +++ b/mysql-test/r/ctype_latin2_ch.result @@ -28,3 +28,4 @@ select * from t1 ignore index (primary) where tt like 'AA%'; id tt select * from t1 where tt like '%AA%'; id tt +drop table t1; diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index 6c6e0f19e08..12d20978cf9 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -355,3 +355,17 @@ insert into mysql.user select * from t1; drop table t1, t2; drop database TESTDB; flush privileges; +grant all privileges on test.* to `a@`@localhost; +grant execute on * to `a@`@localhost; +create table t2 (s1 int); +insert into t2 values (1); +drop function if exists f2; +create function f2 () returns int begin declare v int; select s1 from t2 +into v; return v; end// +select f2(); +f2() +1 +drop function f2; +drop table t2; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost; +drop user `a@`@localhost; diff --git a/mysql-test/r/have_ndb_status_ok.require b/mysql-test/r/have_ndb_status_ok.require new file mode 100644 index 00000000000..8a82871234b --- /dev/null +++ b/mysql-test/r/have_ndb_status_ok.require @@ -0,0 +1,2 @@ +ndb_status_ok +YES diff --git a/mysql-test/r/have_udf.require b/mysql-test/r/have_udf.require index 6204435c17a..2d21f65e4ac 100644 --- a/mysql-test/r/have_udf.require +++ b/mysql-test/r/have_udf.require @@ -1,2 +1,2 @@ Variable_name Value -have_dlopen YES +have_dynamic_loading YES 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/not_as_root.require b/mysql-test/r/not_as_root.require new file mode 100644 index 00000000000..d9ea5244efc --- /dev/null +++ b/mysql-test/r/not_as_root.require @@ -0,0 +1,2 @@ +running_as_root +NO diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result index 77f2d5495a9..91382619b6c 100644 --- a/mysql-test/r/openssl_1.result +++ b/mysql-test/r/openssl_1.result @@ -38,7 +38,6 @@ f1 5 delete from t1; ERROR 42000: DELETE command denied to user 'ssl_user4'@'localhost' for table 't1' -delete from mysql.user where user='ssl_user%'; -delete from mysql.db where user='ssl_user%'; -flush privileges; +drop user ssl_user1@localhost, ssl_user2@localhost, +ssl_user3@localhost, ssl_user4@localhost; drop table t1; diff --git a/mysql-test/r/ps_11bugs.result b/mysql-test/r/ps_11bugs.result index c0d7fe502af..c849c25d646 100644 --- a/mysql-test/r/ps_11bugs.result +++ b/mysql-test/r/ps_11bugs.result @@ -116,3 +116,17 @@ execute st_1676 using @arg0, @arg1, @arg2; cola colb cold aaaa yyyy R drop table t1, t2; +create table t1 (a int primary key); +insert into t1 values (1); +explain select * from t1 where 3 in (select (1+1) union select 1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +select * from t1 where 3 in (select (1+1) union select 1); +a +prepare st_18492 from 'select * from t1 where 3 in (select (1+1) union select 1)'; +execute st_18492; +a +drop table t1; diff --git a/mysql-test/r/rpl_openssl.result b/mysql-test/r/rpl_openssl.result index be9ab29d8b7..1bd28415434 100644 --- a/mysql-test/r/rpl_openssl.result +++ b/mysql-test/r/rpl_openssl.result @@ -24,7 +24,8 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File stop slave; change master to master_user='root',master_password='', master_ssl=0; start slave; +drop user replssl@localhost; drop table t1; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 # # # # # # Yes # 0 0 # # None 0 No MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem # +# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 564 # # master-bin.000001 Yes Yes 0 0 564 # None 0 No MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem # diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index a1e78cd9d7e..af4f1c16c56 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -322,6 +322,7 @@ Warnings: Warning 1541 The syntax 'SHOW INNODB STATUS' is deprecated and will be removed in MySQL 5.2. Please use 'SHOW ENGINE INNODB STATUS' instead. GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost; DROP DATABASE db_bug7787; +drop user user_bug7787@localhost; use test; ---> connection: root diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result index d434f5c32ce..e39ddd1d79d 100644 --- a/mysql-test/r/sp_notembedded.result +++ b/mysql-test/r/sp_notembedded.result @@ -204,3 +204,4 @@ drop procedure bug10100pv| drop procedure bug10100pd| drop procedure bug10100pc| drop view v1| +drop table t3| diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 37823c66de9..e4850a19b4c 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -744,7 +744,7 @@ id select_type table type possible_keys key key_len ref rows Extra 3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL Warnings: -Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 AS `Not_used` having (<cache>(`test`.`t2`.`id`) = <null_helper>(1)) union select 1 AS `Not_used` having (<cache>(`test`.`t2`.`id`) = <null_helper>(3)))) +Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 AS `1` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 AS `3` having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3)))) SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3); id SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2); diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index a0c4e212d58..5d5ea9511ba 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -949,7 +949,7 @@ insert into t1 values create function f2() returns int return (select max(b) from t2); insert into t2 select a, f2() from t1; load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1(); -drop tables t1, t2; +drop table t1, t2; drop function f1; drop function f2; create table t1(i int not null, j int not null, n numeric(15,2), primary key(i,j)); diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result index 1b5f59c038a..01aa8539262 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 symbol '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/ctype_latin2_ch.test b/mysql-test/t/ctype_latin2_ch.test index 626d83fa17d..3925d02659d 100644 --- a/mysql-test/t/ctype_latin2_ch.test +++ b/mysql-test/t/ctype_latin2_ch.test @@ -28,3 +28,5 @@ select * from t1 ignore index (primary) where tt like 'AA%'; select * from t1 where tt like '%AA%'; # End of 4.1 tests + +drop table t1; diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test index ce1d0fb2271..b3e2d2f7998 100644 --- a/mysql-test/t/grant2.test +++ b/mysql-test/t/grant2.test @@ -462,3 +462,29 @@ drop table t1, t2; drop database TESTDB; flush privileges; +# +# BUG#13310 incorrect user parsing by SP +# + +grant all privileges on test.* to `a@`@localhost; +grant execute on * to `a@`@localhost; +connect (bug13310,localhost,'a@',,test); +connection bug13310; +create table t2 (s1 int); +insert into t2 values (1); +--disable_warnings +drop function if exists f2; +--enable_warnings +delimiter //; +create function f2 () returns int begin declare v int; select s1 from t2 +into v; return v; end// +delimiter ;// +select f2(); + +drop function f2; +drop table t2; +disconnect bug13310; + +connection default; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost; +drop user `a@`@localhost; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index c6dd9c7226d..b7151b03ae1 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -1,10 +1,13 @@ # This test uses grants, which can't get tested for embedded server -- source include/not_embedded.inc -# check that CSV engine was compiled in, as the result of the test -# depends on the presence of the log tables (which are CSV-based). +# check that CSV engine was compiled in, as the result of the test depends +# on the presence of the log tables (which are CSV-based). --source include/have_csv.inc +# This test uses chmod, can't be run with root permissions +-- source include/not_as_root.inc + # Test for information_schema.schemata & # show databases diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test index 359b8b69a4d..4cc9113048f 100644 --- a/mysql-test/t/openssl_1.test +++ b/mysql-test/t/openssl_1.test @@ -48,9 +48,9 @@ select * from t1; delete from t1; connection default; -delete from mysql.user where user='ssl_user%'; -delete from mysql.db where user='ssl_user%'; -flush privileges; +drop user ssl_user1@localhost, ssl_user2@localhost, +ssl_user3@localhost, ssl_user4@localhost; + drop table t1; # End of 4.1 tests diff --git a/mysql-test/t/ps_11bugs.test b/mysql-test/t/ps_11bugs.test index e214afeaaf3..ff1c87f3bd8 100644 --- a/mysql-test/t/ps_11bugs.test +++ b/mysql-test/t/ps_11bugs.test @@ -130,3 +130,17 @@ drop table t1, t2; # end of bug#1676 # End of 4.1 tests + +# bug#18492: mysqld reports ER_ILLEGAL_REFERENCE in --ps-protocol + +create table t1 (a int primary key); +insert into t1 values (1); + +explain select * from t1 where 3 in (select (1+1) union select 1); + +select * from t1 where 3 in (select (1+1) union select 1); + +prepare st_18492 from 'select * from t1 where 3 in (select (1+1) union select 1)'; +execute st_18492; + +drop table t1; diff --git a/mysql-test/t/rpl_openssl.test b/mysql-test/t/rpl_openssl.test index 8a85443e71f..00ae5c935bf 100644 --- a/mysql-test/t/rpl_openssl.test +++ b/mysql-test/t/rpl_openssl.test @@ -53,6 +53,7 @@ stop slave; change master to master_user='root',master_password='', master_ssl=0; start slave; connection master; +drop user replssl@localhost; drop table t1; save_master_pos; connection slave; diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test index 7f76aaf3355..a5c8a87c74d 100644 --- a/mysql-test/t/rpl_rotate_logs.test +++ b/mysql-test/t/rpl_rotate_logs.test @@ -1,3 +1,6 @@ +# This test uses chmod, can't be run with root permissions +-- source include/not_as_root.inc + # # Test is run with max_binlog_size=2048 to force automatic rotation of the # binary log diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test index f369dc64b0e..a8c3c0a22eb 100644 --- a/mysql-test/t/sp-security.test +++ b/mysql-test/t/sp-security.test @@ -545,6 +545,7 @@ GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost; # Cleanup. DROP DATABASE db_bug7787; +drop user user_bug7787@localhost; use test; diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test index 3854297ec0c..4eb429156b2 100644 --- a/mysql-test/t/sp_notembedded.test +++ b/mysql-test/t/sp_notembedded.test @@ -258,5 +258,6 @@ drop procedure bug10100pv| drop procedure bug10100pd| drop procedure bug10100pc| drop view v1| +drop table t3| delimiter ;| diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index ae05d70bf67..00c85a650d1 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -1111,7 +1111,7 @@ insert into t1 values create function f2() returns int return (select max(b) from t2); insert into t2 select a, f2() from t1; load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1(); -drop tables t1, t2; +drop table t1, t2; drop function f1; drop function f2; 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(); |