summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authormsvensson@neptunus.(none) <>2006-04-28 08:30:49 +0200
committermsvensson@neptunus.(none) <>2006-04-28 08:30:49 +0200
commit44322185b5b6e28704b720a1277fda7ca32c3642 (patch)
tree3915490898de2f00cb0b486651cee21f0a820c8c /mysql-test
parent98a7bbe109a0b8391a097425591ec9968b86d866 (diff)
parent059e2f70057d1ce7d9adb31e620bd5bc7a8b638d (diff)
downloadmariadb-git-44322185b5b6e28704b720a1277fda7ca32c3642.tar.gz
Merge bk-internal:/home/bk/mysql-5.0
into neptunus.(none):/home/msvensson/mysql/mysql-5.0
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/have_ndb.inc9
-rw-r--r--mysql-test/include/have_udf.inc22
-rw-r--r--mysql-test/include/not_as_root.inc4
-rw-r--r--mysql-test/lib/mtr_misc.pl34
-rw-r--r--mysql-test/lib/mtr_process.pl33
-rwxr-xr-xmysql-test/mysql-test-run.pl184
-rw-r--r--mysql-test/r/have_ndb_status_ok.require2
-rw-r--r--mysql-test/r/have_udf.require3
-rw-r--r--mysql-test/r/have_udf_example.require2
-rw-r--r--mysql-test/r/not_as_root.require2
-rw-r--r--mysql-test/r/udf.result16
-rw-r--r--mysql-test/t/disabled.def2
-rw-r--r--mysql-test/t/information_schema.test3
-rw-r--r--mysql-test/t/rpl_rotate_logs.test3
-rw-r--r--mysql-test/t/udf.test28
15 files changed, 209 insertions, 138 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 a22b2a52e61..42b9942f74d 100644
--- a/mysql-test/include/have_udf.inc
+++ b/mysql-test/include/have_udf.inc
@@ -1,12 +1,16 @@
#
-# To check if the udf_example.so is available,
-# try to load one function from it.
-#
+# Check if server has support for loading udf's
+# i.e it will support dlopen
#
--require r/have_udf.require
---disable_abort_on_error
-CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
---disable_query_log
-DROP FUNCTION metaphon;
---enable_query_log
---enable_abort_on_error
+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/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 58652960e36..973655a3eb6 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -663,8 +663,6 @@ sub mtr_mysqladmin_shutdown {
foreach my $srv ( @to_kill_specs )
{
- # FIXME wrong log.....
- # FIXME, stderr.....
# Shutdown time must be high as slave may be in reconnect
my $args;
@@ -688,11 +686,14 @@ sub mtr_mysqladmin_shutdown {
mtr_add_arg($args, "--connect_timeout=5");
mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo");
mtr_add_arg($args, "shutdown");
- # We don't wait for termination of mysqladmin
+
+ my $path_mysqladmin_log= "$::opt_vardir/log/mysqladmin.log";
my $pid= mtr_spawn($::exe_mysqladmin, $args,
- "", $::path_manager_log, $::path_manager_log, "",
+ "", $path_mysqladmin_log, $path_mysqladmin_log, "",
{ append_log_file => 1 });
$mysql_admin_pids{$pid}= 1;
+
+ # We don't wait for termination of mysqladmin
}
# As mysqladmin is such a simple program, we trust it to terminate.
@@ -736,8 +737,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;
}
@@ -833,30 +832,36 @@ 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 )
{
return $pid;
}
- # Check if it died after the fork() was successful
- if ( $pid > 0 && waitpid($pid,&WNOHANG) == $pid )
+ # Check if it died after the fork() was successful
+ if ( $pid != 0 && waitpid($pid,&WNOHANG) == $pid )
{
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 0c25deac2e7..3a5fa2e7287 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -156,9 +156,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
@@ -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;
@@ -205,7 +206,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
@@ -246,9 +246,6 @@ our $instance_manager;
our $opt_ndbcluster_port;
our $opt_ndbconnectstring;
-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;
@@ -258,6 +255,7 @@ our $opt_result_ext;
our $opt_skip;
our $opt_skip_rpl;
+our $use_slaves;
our $opt_skip_test;
our $opt_skip_im;
@@ -339,6 +337,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 ndbcluster_install ();
sub ndbcluster_start ($);
@@ -377,6 +376,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();
@@ -407,16 +407,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();
@@ -558,7 +557,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,
@@ -575,7 +573,6 @@ sub command_line_setup () {
'master_port=i' => \$opt_master_myport,
'slave_port=i' => \$opt_slave_myport,
'ndbcluster_port=i' => \$opt_ndbcluster_port,
- '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
@@ -717,11 +714,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
@@ -970,6 +962,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/";
}
@@ -981,7 +974,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'},
@@ -1063,6 +1056,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
{
@@ -1155,7 +1150,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'}" : "");
@@ -1181,6 +1176,7 @@ sub environment_setup () {
$ENV{'MYSQL_TCP_PORT'}= 3306;
$ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port;
+ $ENV{'NDB_STATUS_OK'}= "YES";
$ENV{'IM_PATH_PID'}= $instance_manager->{path_pid};
$ENV{'IM_PORT'}= $instance_manager->{port};
@@ -1219,6 +1215,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.....");
@@ -1335,6 +1332,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 () {
@@ -1407,7 +1431,6 @@ sub check_ndbcluster_support () {
return;
}
-# FIXME why is there a different start below?!
sub ndbcluster_install () {
@@ -1434,6 +1457,7 @@ sub ndbcluster_install () {
return 0;
}
+
sub ndbcluster_start ($) {
my $use_ndbcluster= shift;
@@ -1467,6 +1491,7 @@ sub ndbcluster_start ($) {
return 0;
}
+
sub ndbcluster_stop () {
if ( ! $using_ndbcluster_master or $glob_use_running_ndbcluster )
{
@@ -1636,7 +1661,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'});
@@ -1656,6 +1681,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
{
@@ -1677,7 +1703,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: $!");
@@ -1721,8 +1747,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" .
@@ -1744,15 +1777,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);
}
@@ -1764,7 +1797,7 @@ sub im_create_defaults_file($) {
open(OUT, ">", $defaults_file)
or mtr_error("Can't write to $defaults_file: $!");
-
+
print OUT <<EOF
[mysql]
@@ -1843,7 +1876,7 @@ sub run_testcase ($) {
my $tname= $tinfo->{'name'};
- 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");
@@ -1922,7 +1955,7 @@ sub run_testcase ($) {
# ----------------------------------------------------------------------
stop_slaves();
- }
+ }
# ----------------------------------------------------------------------
# Prepare to start masters. Even if we use embedded, we want to run
@@ -1935,9 +1968,9 @@ sub run_testcase ($) {
mtr_tofile($master->[0]->{'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
@@ -2114,25 +2147,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)
@@ -2146,7 +2160,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");
}
}
@@ -2170,6 +2184,7 @@ sub save_files_before_restore($$) {
}
}
+
#
# Restore snapshot of the installed test db(s)
# if the snapshot exists
@@ -2188,7 +2203,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)
{
@@ -2239,9 +2254,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;
@@ -2274,13 +2289,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;
@@ -2308,7 +2324,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");
}
}
@@ -2318,6 +2334,7 @@ sub do_before_start_slave ($$) {
}
}
+
sub mysqld_arguments ($$$$$$) {
my $args= shift;
my $type= shift; # master/slave/bootstrap
@@ -2541,14 +2558,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;
-# }
##############################################################################
#
@@ -2648,6 +2657,7 @@ sub mysqld_start ($$$$$) {
return 0;
}
+
sub stop_masters_slaves () {
print "Ending Tests\n";
@@ -2657,7 +2667,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";
@@ -2665,6 +2675,7 @@ sub stop_masters_slaves () {
print "Slave(s) shutdown finished\n";
}
+
sub stop_masters () {
my @args;
@@ -2694,6 +2705,7 @@ sub stop_masters () {
mtr_stop_mysqld_servers(\@args);
}
+
sub stop_slaves () {
my $force= shift;
@@ -2736,7 +2748,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
@@ -2752,7 +2764,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.
@@ -2770,6 +2782,7 @@ sub im_start($$) {
mtr_get_pid_from_file($instance_manager->{'path_pid'});
}
+
sub im_stop($) {
my $instance_manager = shift;
@@ -2804,12 +2817,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
@@ -2858,6 +2872,7 @@ sub run_check_testcase ($) {
}
}
+
sub run_mysqltest ($) {
my $tinfo= shift;
@@ -2931,11 +2946,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;
@@ -2946,8 +2956,9 @@ 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_MGM'}= $exe_ndb_mgm;
$ENV{'NDB_BACKUP_DIR'}= $path_ndb_data_dir;
$ENV{'NDB_DATA_DIR'}= $path_ndb_data_dir;
@@ -3199,6 +3210,7 @@ sub gdb_arguments {
$$exe= "xterm";
}
+
#
# Modify the exe and args so that program is run in ddd
#
@@ -3444,18 +3456,18 @@ Deprecated options
Options not yet described, or that I want to look into more
- big-test
- debug
- local
- local-master
- netware
- old-master
- sleep=SECONDS
- socket=PATH
- user-test=s
- wait-timeout=SECONDS
- warnings
- log-warnings
+ big-test
+ debug
+ local
+ local-master
+ netware
+ old-master
+ sleep=SECONDS
+ socket=PATH
+ user-test=s
+ wait-timeout=SECONDS
+ warnings
+ log-warnings
HERE
mtr_exit(1);
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 869d1b254fd..2d21f65e4ac 100644
--- a/mysql-test/r/have_udf.require
+++ b/mysql-test/r/have_udf.require
@@ -1 +1,2 @@
-CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
+Variable_name Value
+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/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 37ba97851aa..1b587eea40f 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -11,4 +11,4 @@
##############################################################################
ndb_load : Bug#17233
-udf : Bug#18564 (Permission by Brian)
+udf : Not yet
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 47f262a9d59..90b0fd95eee 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1,6 +1,9 @@
# This test uses grants, which can't get tested for embedded server
-- source include/not_embedded.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/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test
index 77a8fb7d9a4..ee49f92910a 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/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();