Commit d89054df authored by jimw@mysql.com's avatar jimw@mysql.com

Merge mysql.com:/home/jimw/my/mysql-5.0-19083

into  mysql.com:/home/jimw/my/mysql-5.0-clean
parents 960c5621 559995f1
...@@ -333,6 +333,7 @@ our @data_dir_lst; ...@@ -333,6 +333,7 @@ our @data_dir_lst;
sub main (); sub main ();
sub initial_setup (); sub initial_setup ();
sub command_line_setup (); sub command_line_setup ();
sub snapshot_setup ();
sub executable_setup (); sub executable_setup ();
sub environment_setup (); sub environment_setup ();
sub kill_running_server (); sub kill_running_server ();
...@@ -343,7 +344,7 @@ sub ndbcluster_install (); ...@@ -343,7 +344,7 @@ sub ndbcluster_install ();
sub ndbcluster_start ($); sub ndbcluster_start ($);
sub ndbcluster_stop (); sub ndbcluster_stop ();
sub run_benchmarks ($); sub run_benchmarks ($);
sub run_tests (); sub initialize_servers ();
sub mysql_install_db (); sub mysql_install_db ();
sub install_db ($$); sub install_db ($$);
sub run_testcase ($); sub run_testcase ($);
...@@ -374,7 +375,7 @@ sub main () { ...@@ -374,7 +375,7 @@ sub main () {
command_line_setup(); command_line_setup();
executable_setup(); executable_setup();
check_ndbcluster_support(); check_ndbcluster_support(); # We check whether to actually use it later
check_ssl_support(); check_ssl_support();
environment_setup(); environment_setup();
...@@ -389,24 +390,7 @@ sub main () { ...@@ -389,24 +390,7 @@ sub main () {
{ {
gprof_prepare(); gprof_prepare();
} }
if ( ! $glob_use_running_server )
{
if ( $opt_start_dirty )
{
kill_running_server();
}
else
{
kill_and_cleanup();
mysql_install_db();
if ( $opt_force )
{
save_installed_db();
}
}
}
if ( $opt_start_dirty ) if ( $opt_start_dirty )
{ {
if ( ndbcluster_start($opt_with_ndbcluster) ) if ( ndbcluster_start($opt_with_ndbcluster) )
...@@ -424,15 +408,35 @@ sub main () { ...@@ -424,15 +408,35 @@ sub main () {
} }
elsif ( $opt_bench ) elsif ( $opt_bench )
{ {
initialize_servers();
run_benchmarks(shift); # Shift what? Extra arguments?! run_benchmarks(shift); # Shift what? Extra arguments?!
} }
elsif ( $opt_stress ) elsif ( $opt_stress )
{ {
initialize_servers();
run_stress_test() run_stress_test()
} }
else else
{ {
run_tests(); # Figure out which tests we are going to run
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);
foreach my $test (@$tests)
{
$need_ndbcluster||= $test->{ndb_test};
$need_im||= $test->{component_id} eq 'im';
$need_slave||= $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();
run_suite($opt_suite, $tests);
} }
mtr_exit(0); mtr_exit(0);
...@@ -983,20 +987,29 @@ sub command_line_setup () { ...@@ -983,20 +987,29 @@ sub command_line_setup () {
$path_mysqltest_log= "$opt_vardir/log/mysqltest.log"; $path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
$path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/"; $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/";
}
sub snapshot_setup () {
# Make a list of all data_dirs # Make a list of all data_dirs
@data_dir_lst = ( @data_dir_lst = (
$master->[0]->{'path_myddir'}, $master->[0]->{'path_myddir'},
$master->[1]->{'path_myddir'}, $master->[1]->{'path_myddir'});
$slave->[0]->{'path_myddir'},
$slave->[1]->{'path_myddir'},
$slave->[2]->{'path_myddir'});
foreach my $instance (@{$instance_manager->{'instances'}}) unless ($opt_skip_rpl)
{ {
push(@data_dir_lst, $instance->{'path_datadir'}); push @data_dir_lst, ($slave->[0]->{'path_myddir'},
$slave->[1]->{'path_myddir'},
$slave->[2]->{'path_myddir'});
} }
unless ($opt_skip_im)
{
foreach my $instance (@{$instance_manager->{'instances'}})
{
push(@data_dir_lst, $instance->{'path_datadir'});
}
}
} }
...@@ -1388,7 +1401,7 @@ sub check_ndbcluster_support () { ...@@ -1388,7 +1401,7 @@ sub check_ndbcluster_support () {
if ($opt_with_ndbcluster) if ($opt_with_ndbcluster)
{ {
mtr_report("Using ndbcluster"); mtr_report("Using ndbcluster if necessary");
return; return;
} }
...@@ -1404,7 +1417,7 @@ sub check_ndbcluster_support () { ...@@ -1404,7 +1417,7 @@ sub check_ndbcluster_support () {
$opt_with_ndbcluster= 0; $opt_with_ndbcluster= 0;
return; return;
} }
mtr_report("Using ndbcluster, mysqld supports it"); mtr_report("Using ndbcluster if necessary, mysqld supports it");
$opt_with_ndbcluster= 1; $opt_with_ndbcluster= 1;
return; return;
} }
...@@ -1562,12 +1575,9 @@ sub run_benchmarks ($) { ...@@ -1562,12 +1575,9 @@ sub run_benchmarks ($) {
# FIXME how to specify several suites to run? Comma separated list? # FIXME how to specify several suites to run? Comma separated list?
sub run_tests () {
run_suite($opt_suite);
}
sub run_suite () { sub run_suite () {
my $suite= shift; my ($suite, $tests)= @_;
mtr_print_thick_line(); mtr_print_thick_line();
...@@ -1575,8 +1585,6 @@ sub run_suite () { ...@@ -1575,8 +1585,6 @@ sub run_suite () {
mtr_timer_start($glob_timers,"suite", 60 * $opt_suite_timeout); mtr_timer_start($glob_timers,"suite", 60 * $opt_suite_timeout);
my $tests= collect_test_cases($suite);
mtr_report("Starting Tests in the '$suite' suite"); mtr_report("Starting Tests in the '$suite' suite");
mtr_print_header(); mtr_print_header();
...@@ -1618,14 +1626,37 @@ sub run_suite () { ...@@ -1618,14 +1626,37 @@ sub run_suite () {
# #
############################################################################## ##############################################################################
sub initialize_servers () {
if ( ! $glob_use_running_server )
{
if ( $opt_start_dirty )
{
kill_running_server();
}
else
{
kill_and_cleanup();
mysql_install_db();
if ( $opt_force )
{
save_installed_db();
}
}
}
}
sub mysql_install_db () { sub mysql_install_db () {
# FIXME not exactly true I think, needs improvements # FIXME not exactly true I think, needs improvements
install_db('master', $master->[0]->{'path_myddir'}); install_db('master', $master->[0]->{'path_myddir'});
install_db('master', $master->[1]->{'path_myddir'}); install_db('master', $master->[1]->{'path_myddir'});
install_db('slave', $slave->[0]->{'path_myddir'});
install_db('slave', $slave->[1]->{'path_myddir'}); if ( ! $opt_skip_rpl )
install_db('slave', $slave->[2]->{'path_myddir'}); {
install_db('slave', $slave->[0]->{'path_myddir'});
install_db('slave', $slave->[1]->{'path_myddir'});
install_db('slave', $slave->[2]->{'path_myddir'});
}
if ( ! $opt_skip_im ) if ( ! $opt_skip_im )
{ {
......
...@@ -236,8 +236,8 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" ...@@ -236,8 +236,8 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
# test if Ndb Cluster starts properly # test if Ndb Cluster starts properly
echo "Waiting for started..." echo "Waiting for NDB data nodes to start..."
if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else if ( $exec_waiter ) | grep -q "NDBT_ProgramExit: 0 - OK"; then :; else
echo "Ndbcluster startup failed" echo "Ndbcluster startup failed"
stop_default_ndbcluster stop_default_ndbcluster
exit 1 exit 1
......
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