summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <kent@mysql.com>2005-10-17 19:05:37 +0200
committerunknown <kent@mysql.com>2005-10-17 19:05:37 +0200
commit162076e47d43ae1211a182b59a24c7817e61012c (patch)
tree194293eb8e918d5f0f8e1966d1263f898aa77d67 /mysql-test
parentdf494c54811c6505b8fcd23d3388ed330a949592 (diff)
parent92af600b93a0c0954e6dd157d49e2698f4efbe84 (diff)
downloadmariadb-git-162076e47d43ae1211a182b59a24c7817e61012c.tar.gz
Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/Users/kent/mysql/bk/mysql-5.0
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/Makefile.am5
-rw-r--r--mysql-test/lib/init_db.sql2
-rw-r--r--mysql-test/lib/mtr_cases.pl8
-rw-r--r--mysql-test/lib/mtr_process.pl11
-rwxr-xr-xmysql-test/mysql-test-run.pl63
-rwxr-xr-xmysql-test/t/kill_n_check.sh4
6 files changed, 50 insertions, 43 deletions
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 1fb5f82c475..f1194d7fc2f 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -53,7 +53,8 @@ dist-hook:
-$(INSTALL_DATA) $(srcdir)/t/*.imtest $(distdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.sql $(distdir)/t
-$(INSTALL_DATA) $(srcdir)/t/*.disabled $(distdir)/t
- $(INSTALL_DATA) $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(srcdir)/t/*.slave-mi $(distdir)/t
+ $(INSTALL_DATA) $(srcdir)/t/*.opt $(srcdir)/t/*.slave-mi $(distdir)/t
+ $(INSTALL_SCRIPT) $(srcdir)/t/*.sh $(distdir)/t
$(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include
$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(distdir)/std_data
@@ -79,7 +80,7 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/t/*.sql $(DESTDIR)$(testdir)/t
-$(INSTALL_DATA) $(srcdir)/t/*.disabled $(DESTDIR)$(testdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.opt $(DESTDIR)$(testdir)/t
- $(INSTALL_DATA) $(srcdir)/t/*.sh $(DESTDIR)$(testdir)/t
+ $(INSTALL_SCRIPT) $(srcdir)/t/*.sh $(DESTDIR)$(testdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.slave-mi $(DESTDIR)$(testdir)/t
$(INSTALL_DATA) $(srcdir)/r/*.result $(DESTDIR)$(testdir)/r
$(INSTALL_DATA) $(srcdir)/r/*.require $(DESTDIR)$(testdir)/r
diff --git a/mysql-test/lib/init_db.sql b/mysql-test/lib/init_db.sql
index b366a429ab2..fd7b035e038 100644
--- a/mysql-test/lib/init_db.sql
+++ b/mysql-test/lib/init_db.sql
@@ -62,7 +62,7 @@ comment='Host privileges; Merged with database privileges';
CREATE TABLE user (
Host char(60) binary DEFAULT '' NOT NULL,
User char(16) binary DEFAULT '' NOT NULL,
- Password binary(41) DEFAULT '' NOT NULL,
+ Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL,
Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl
index ca984d37ecf..fb622f2bbb3 100644
--- a/mysql-test/lib/mtr_cases.pl
+++ b/mysql-test/lib/mtr_cases.pl
@@ -68,7 +68,7 @@ sub collect_test_cases ($) {
#
# Otherwise, try to guess the target component.
- if ( defined $component_id )
+ if ( $component_id )
{
if ( ! -f "$testdir/$elem")
{
@@ -80,11 +80,11 @@ sub collect_test_cases ($) {
my $mysqld_test_exists = -f "$testdir/$tname.test";
my $im_test_exists = -f "$testdir/$tname.imtest";
- if ( $mysqld_test_exists && $im_test_exists )
+ if ( $mysqld_test_exists and $im_test_exists )
{
mtr_error("Ambiguos test case name ($tname)");
}
- elsif ( ! $mysqld_test_exists && !$im_test_exists )
+ elsif ( ! $mysqld_test_exists and ! $im_test_exists )
{
mtr_error("Test case $tname is not found");
}
@@ -405,7 +405,7 @@ sub collect_one_test_case($$$$$$$) {
"Instance Manager tests are not run with --ps-protocol. " .
"Test case '$tname' is skipped.");
}
- elsif ( !$::exe_im )
+ elsif ( $::opt_skip_im )
{
$tinfo->{'skip'}= 1;
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index eb60df4a5cb..b3a243444c1 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -360,6 +360,7 @@ sub mtr_kill_leftovers () {
# First, kill all masters and slaves that would conflict with
# this run. Make sure to remove the PID file, if any.
+ # FIXME kill IM manager first, else it will restart the servers, how?!
my @args;
@@ -367,6 +368,16 @@ sub mtr_kill_leftovers () {
{
push(@args,{
pid => 0, # We don't know the PID
+ pidfile => $::instance_manager->{'instances'}->[$idx]->{'path_pid'},
+ sockfile => $::instance_manager->{'instances'}->[$idx]->{'path_sock'},
+ port => $::instance_manager->{'instances'}->[$idx]->{'port'},
+ });
+ }
+
+ for ( my $idx; $idx < 2; $idx++ )
+ {
+ push(@args,{
+ pid => 0, # We don't know the PID
pidfile => $::master->[$idx]->{'path_mypid'},
sockfile => $::master->[$idx]->{'path_mysock'},
port => $::master->[$idx]->{'path_myport'},
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 05e6169b4c7..35f26199fc8 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -233,6 +233,7 @@ our $opt_result_ext;
our $opt_skip;
our $opt_skip_rpl;
our $opt_skip_test;
+our $opt_skip_im;
our $opt_sleep;
our $opt_ps_protocol;
@@ -490,6 +491,7 @@ sub command_line_setup () {
'do-test=s' => \$opt_do_test,
'suite=s' => \$opt_suite,
'skip-rpl' => \$opt_skip_rpl,
+ 'skip-im' => \$opt_skip_im,
'skip-test=s' => \$opt_skip_test,
# Specify ports
@@ -840,8 +842,8 @@ sub command_line_setup () {
server_id => 1,
port => $im_mysqld1_port,
path_datadir => "$opt_vardir/im_mysqld_1.data",
- path_sock => "$opt_vardir/mysqld_1.sock",
- path_pid => "$opt_vardir/mysqld_1.pid",
+ path_sock => "$opt_tmpdir/mysqld_1.sock",
+ path_pid => "$opt_vardir/run/mysqld_1.pid",
};
$instance_manager->{'instances'}->[1]=
@@ -849,8 +851,8 @@ sub command_line_setup () {
server_id => 2,
port => $im_mysqld2_port,
path_datadir => "$opt_vardir/im_mysqld_2.data",
- path_sock => "$opt_vardir/mysqld_2.sock",
- path_pid => "$opt_vardir/mysqld_2.pid",
+ path_sock => "$opt_tmpdir/mysqld_2.sock",
+ path_pid => "$opt_vardir/run/mysqld_2.pid",
nonguarded => 1,
};
@@ -1118,7 +1120,7 @@ sub kill_and_cleanup () {
foreach my $instance (@{$instance_manager->{'instances'}})
{
- push (@data_dir_lst, $instance->{'path_datadir'});
+ push(@data_dir_lst, $instance->{'path_datadir'});
}
foreach my $data_dir (@data_dir_lst)
@@ -1364,7 +1366,7 @@ sub mysql_install_db () {
install_db('slave', $slave->[1]->{'path_myddir'});
install_db('slave', $slave->[2]->{'path_myddir'});
- if ( defined $exe_im)
+ if ( ! $opt_skip_im )
{
im_prepare_env($instance_manager);
}
@@ -1513,12 +1515,7 @@ skip-ndbcluster
EOF
;
- if ( exists $instance->{nonguarded} and
- defined $instance->{nonguarded} )
- {
- print OUT "nonguarded\n";
- }
-
+ print OUT "nonguarded\n" if $instance->{'nonguarded'};
print OUT "\n";
}
@@ -1678,7 +1675,7 @@ sub run_testcase ($) {
$master->[0]->{'running_master_is_special'}= 1;
}
}
- elsif ( $tinfo->{'component_id'} eq 'im')
+ elsif ( ! $opt_skip_im and $tinfo->{'component_id'} eq 'im' )
{
# We have to create defaults file every time, in order to ensure that it
# will be the same for each test. The problem is that test can change the
@@ -1776,7 +1773,8 @@ sub run_testcase ($) {
# Stop Instance Manager if we are processing an IM-test case.
# ----------------------------------------------------------------------
- if ( ! $glob_use_running_server and $tinfo->{'component_id'} eq 'im' )
+ if ( ! $glob_use_running_server and $tinfo->{'component_id'} eq 'im' and
+ $instance_manager->{'pid'} )
{
im_stop($instance_manager);
}
@@ -2195,7 +2193,7 @@ sub stop_masters_slaves () {
print "Ending Tests\n";
- if (defined $instance_manager->{'pid'})
+ if ( $instance_manager->{'pid'} )
{
print "Shutting-down Instance Manager\n";
im_stop($instance_manager);
@@ -2269,14 +2267,10 @@ sub im_start($$) {
my $instance_manager = shift;
my $opts = shift;
- if ( ! defined $exe_im)
- {
- return;
- }
-
my $args;
mtr_init_args(\$args);
- mtr_add_arg($args, "--defaults-file=" . $instance_manager->{'defaults_file'});
+ mtr_add_arg($args, "--defaults-file=%s",
+ $instance_manager->{'defaults_file'});
foreach my $opt (@{$opts})
{
@@ -2294,7 +2288,7 @@ sub im_start($$) {
{ append_log_file => 1 } # append log files
);
- if ( ! defined $instance_manager->{'pid'} )
+ if ( ! $instance_manager->{'pid'} )
{
mtr_report('Could not start Instance Manager');
return;
@@ -2304,10 +2298,14 @@ sub im_start($$) {
# 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.
- sleep_until_file_created(
- $instance_manager->{'path_pid'},
- $instance_manager->{'start_timeout'},
- -1); # real PID is still unknown
+ if ( ! sleep_until_file_created(
+ $instance_manager->{'path_pid'},
+ $instance_manager->{'start_timeout'},
+ -1)) # real PID is still unknown
+ {
+ mtr_report("Instance Manager PID file is missing");
+ return;
+ }
$instance_manager->{'pid'} =
mtr_get_pid_from_file($instance_manager->{'path_pid'});
@@ -2316,16 +2314,12 @@ sub im_start($$) {
sub im_stop($) {
my $instance_manager = shift;
- if (! defined $instance_manager->{'pid'})
- {
- return;
- }
-
# Re-read pid from the file, since during tests Instance Manager could have
# been restarted, so its pid could have been changed.
$instance_manager->{'pid'} =
- mtr_get_pid_from_file($instance_manager->{'path_pid'});
+ mtr_get_pid_from_file($instance_manager->{'path_pid'})
+ if -f $instance_manager->{'path_pid'};
# Inspired from mtr_stop_mysqld_servers().
@@ -2340,12 +2334,12 @@ sub im_stop($) {
if ( -r $instances->[0]->{'path_pid'} )
{
- push @pids, mtr_get_pid_from_file($instances->[0]->{'path_pid'});
+ push(@pids, mtr_get_pid_from_file($instances->[0]->{'path_pid'}));
}
if ( -r $instances->[1]->{'path_pid'} )
{
- push @pids, mtr_get_pid_from_file($instances->[1]->{'path_pid'});
+ push(@pids, mtr_get_pid_from_file($instances->[1]->{'path_pid'}));
}
# Kill processes.
@@ -2601,6 +2595,7 @@ Options to control what test suites or cases to run
start-from=PREFIX Run test cases starting from test prefixed with PREFIX
suite=NAME Run the test suite named NAME. The default is "main"
skip-rpl Skip the replication test cases.
+ skip-im Don't start IM, and skip the IM test cases
skip-test=PREFIX Skip test cases which name are prefixed with PREFIX
Options that specify ports
diff --git a/mysql-test/t/kill_n_check.sh b/mysql-test/t/kill_n_check.sh
index 7fe30c4774c..e722b3a180d 100755
--- a/mysql-test/t/kill_n_check.sh
+++ b/mysql-test/t/kill_n_check.sh
@@ -39,7 +39,7 @@ new_pid=""
# echo "New PID: $new_pid"
-if [ "$expected_result" == "restarted" ]; then
+if [ "$expected_result" = "restarted" ]; then
if [ -z "$new_pid" ]; then
echo "Error: the process was killed."
@@ -54,7 +54,7 @@ if [ "$expected_result" == "restarted" ]; then
echo "Success: the process was restarted."
exit 0
-else # $expected_result == killed
+else # $expected_result = killed
if [ "$new_pid" -a "$new_pid" -ne "$original_pid" ]; then
echo "Error: the process was restarted."