From 7d8c8af5a217315c5de1d01b0e1a7520630a9d94 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Fri, 24 Nov 2006 13:39:09 +0100 Subject: [PATCH 01/19] Fix merge conflicts --- mysql-test/mysql-test-run.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 4f32ae17724..79c3ac6582d 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -187,7 +187,6 @@ our $opt_fast; our $opt_force; our $opt_reorder= 0; our $opt_enable_disabled; -our $opt_report_features; our $opt_mem= $ENV{'MTR_MEM'}; our $opt_gcov; @@ -656,7 +655,7 @@ sub command_line_setup () { # directory. And we install "/usr/share/mysql-test". Moving up one # more directory relative to "mysql-test" gives us a usable base # directory for RPM installs. - if ( ! $opt_source_dist and ! -d "$glob_basedir/bin" ) + if ( ! $source_dist and ! -d "$glob_basedir/bin" ) { $glob_basedir= dirname($glob_basedir); } From 76b8b450d6bb073f7d84b36155babbed6f0d2bde Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 27 Nov 2006 19:56:04 +0100 Subject: [PATCH 02/19] Fix for rpl000015 that fails if $MYSQL_TCP_PORT is set. The default value for master_port after a "change master" will be set to the compiled in default value i.e not always the same as what the master report as it's port number. --- mysql-test/mysql-test-run.pl | 1 + mysql-test/r/rpl000015.result | 2 +- mysql-test/t/rpl000015.test | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index c9dcd75415c..ecd2bc19a86 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1668,6 +1668,7 @@ sub environment_setup () { $ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'port'}; $ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'port'}; $ENV{'MYSQL_TCP_PORT'}= $mysqld_variables{'port'}; + $ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'master-port'}; $ENV{'IM_PATH_SOCK'}= $instance_manager->{path_sock}; $ENV{'IM_USERNAME'}= $instance_manager->{admin_login}; diff --git a/mysql-test/r/rpl000015.result b/mysql-test/r/rpl000015.result index e33201ced93..080ef436a2e 100644 --- a/mysql-test/r/rpl000015.result +++ b/mysql-test/r/rpl000015.result @@ -8,7 +8,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File change master to master_host='127.0.0.1'; 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 test MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No # +# 127.0.0.1 test DEFAULT_MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No # change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=MASTER_PORT; show slave status; diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test index df4bf6f977b..d61b7120fa1 100644 --- a/mysql-test/t/rpl000015.test +++ b/mysql-test/t/rpl000015.test @@ -12,7 +12,7 @@ show slave status; change master to master_host='127.0.0.1'; # The following needs to be cleaned up when change master is fixed ---replace_result $MYSQL_TCP_PORT MASTER_PORT +--replace_result $DEFAULT_MASTER_PORT DEFAULT_MASTER_PORT --replace_column 1 # 8 # 9 # 23 # 33 # show slave status; --replace_result $MASTER_MYPORT MASTER_PORT From ee4a5b865fe13bb493c232d9eb57ee89132487b5 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 10:31:07 +0100 Subject: [PATCH 03/19] Backport of patch for bug#24471 mysql-test-run.pl: Removed "use diagnostics", reduces Perl speed significantly. Can be enabled with "perl -Mdiagnostics mysql-test-run.pl". mtr_report.pl: Don't try output "skipped" comment if there is none (bug#24471) --- mysql-test/lib/mtr_report.pl | 6 +++++- mysql-test/mysql-test-run.pl | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index 758e98984b8..a2c16e1941a 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -94,10 +94,14 @@ sub mtr_report_test_skipped ($) { { print "[ disabled ] $tinfo->{'comment'}\n"; } - else + elsif ( $tinfo->{'comment'} ) { print "[ skipped ] $tinfo->{'comment'}\n"; } + else + { + print "[ skipped ]\n"; + } } sub mtr_report_tests_not_skipped_though_disabled ($) { diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 5fe95fc3c6c..ab347157168 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -66,7 +66,6 @@ use IO::Socket::INET; use Data::Dumper; use strict; use warnings; -use diagnostics; select(STDOUT); $| = 1; # Automatically flush STDOUT From 26be89ed478f269b1ee6f8db391921b0ccb65400 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 11:43:56 +0100 Subject: [PATCH 04/19] Fix problem with mysqladmin logging to var/log before var has been created And if var/ has been created, it will be recreated later so the logs will be lost --- mysql-test/lib/mtr_process.pl | 5 ++--- mysql-test/mysql-test-run.pl | 13 ------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index 9d0c1f601ba..37a82177f46 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -708,7 +708,7 @@ sub mtr_wait_blocking($) { } } -# Start "mysqladmin shutdown" for a specific mysqld +# Start "mysqladmin " for a specific mysqld sub mtr_mysqladmin_start($$$) { my $srv= shift; my $command= shift; @@ -738,9 +738,8 @@ sub mtr_mysqladmin_start($$$) { # Shutdown time must be high as slave may be in reconnect mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo"); mtr_add_arg($args, "$command"); - my $path_mysqladmin_log= "$::opt_vardir/log/mysqladmin.log"; my $pid= mtr_spawn($::exe_mysqladmin, $args, - "", $path_mysqladmin_log, $path_mysqladmin_log, "", + "", "", "", "", { append_log_file => 1 }); mtr_verbose("mtr_mysqladmin_start, pid: $pid"); return $pid; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index ab347157168..840a3865625 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1915,19 +1915,6 @@ sub kill_running_servers () { # This is different from terminating processes we have # started from this run of the script, this is terminating # leftovers from previous runs. - - if ( ! -d $opt_vardir ) - { - if ( -l $opt_vardir and ! -d readlink($opt_vardir) ) - { - mtr_report("Removing $opt_vardir symlink without destination"); - unlink($opt_vardir); - } - # The "var" dir does not exist already - # the processes that mtr_kill_leftovers start will write - # their log files to var/log so it should be created - mkpath("$opt_vardir/log"); - } mtr_kill_leftovers(); } } From d1ed2e21b8855128a0cf705dc606f3b818f9a07f Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 12:33:36 +0100 Subject: [PATCH 05/19] Backport of patch for bug#24471 --- mysql-test/lib/mtr_report.pl | 6 +++++- mysql-test/mysql-test-run.pl | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index 8d7de9d1a4b..d0e836c1a90 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -89,10 +89,14 @@ sub mtr_report_test_skipped ($) { { print "[ disabled ] $tinfo->{'comment'}\n"; } - else + elsif ( $tinfo->{'comment'} ) { print "[ skipped ] $tinfo->{'comment'}\n"; } + else + { + print "[ skipped ]\n"; + } } sub mtr_report_tests_not_skipped_though_disabled ($) { diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 22dc49c5ebd..694ff4b712e 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -66,7 +66,6 @@ use IO::Socket::INET; use Data::Dumper; use strict; use warnings; -use diagnostics; select(STDOUT); $| = 1; # Automatically flush STDOUT From afe91a26c627608ea1fd4e9fc6d532d6712d6d36 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 12:36:26 +0100 Subject: [PATCH 06/19] Fix problem with mysqladmin logging to var/log before var has been created And if var/ has been created, it will be recreated later so the logs from "mtr_kill_leftovers" will be lost anyway --- mysql-test/lib/mtr_process.pl | 5 ++--- mysql-test/mysql-test-run.pl | 13 ------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index 9d0c1f601ba..37a82177f46 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -708,7 +708,7 @@ sub mtr_wait_blocking($) { } } -# Start "mysqladmin shutdown" for a specific mysqld +# Start "mysqladmin " for a specific mysqld sub mtr_mysqladmin_start($$$) { my $srv= shift; my $command= shift; @@ -738,9 +738,8 @@ sub mtr_mysqladmin_start($$$) { # Shutdown time must be high as slave may be in reconnect mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo"); mtr_add_arg($args, "$command"); - my $path_mysqladmin_log= "$::opt_vardir/log/mysqladmin.log"; my $pid= mtr_spawn($::exe_mysqladmin, $args, - "", $path_mysqladmin_log, $path_mysqladmin_log, "", + "", "", "", "", { append_log_file => 1 }); mtr_verbose("mtr_mysqladmin_start, pid: $pid"); return $pid; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 694ff4b712e..d06a6a0a6a0 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1887,19 +1887,6 @@ sub kill_running_servers () { # This is different from terminating processes we have # started from this run of the script, this is terminating # leftovers from previous runs. - - if ( ! -d $opt_vardir ) - { - if ( -l $opt_vardir and ! -d readlink($opt_vardir) ) - { - mtr_report("Removing $opt_vardir symlink without destination"); - unlink($opt_vardir); - } - # The "var" dir does not exist already - # the processes that mtr_kill_leftovers start will write - # their log files to var/log so it should be created - mkpath("$opt_vardir/log"); - } mtr_kill_leftovers(); } } From 896adf77aeb9584900ac4d803e638121c82c2f45 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 13:57:07 +0100 Subject: [PATCH 07/19] Bug#24354 option "--extern" of mysql-test-run.pl does not work anymore - Better control of when to create/remove vardir --- mysql-test/mysql-test-run.pl | 87 ++++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 18 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index d06a6a0a6a0..df9919a2f3f 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -312,7 +312,8 @@ sub datadir_setup (); sub executable_setup (); sub environment_setup (); sub kill_running_servers (); -sub cleanup_stale_files (); +sub remove_stale_vardir (); +sub setup_vardir (); sub check_ssl_support ($); sub check_running_as_root(); sub check_ndbcluster_support ($); @@ -1168,6 +1169,7 @@ sub command_line_setup () { # Setup master->[0] with the settings for the extern server $master->[0]->{'path_sock'}= $opt_socket if $opt_socket; + mtr_report("Using extern server at '$master->[0]->{path_sock}'"); } else { @@ -1891,12 +1893,24 @@ sub kill_running_servers () { } } -sub cleanup_stale_files () { +sub created_by_mem_filename(){ + return "$glob_mysql_test_dir/var/created_by_mem"; +} - my $created_by_mem_file= "$glob_mysql_test_dir/var/created_by_mem"; + +# +# Remove var and any directories in var/ created by previous +# tests +# +sub remove_stale_vardir () { mtr_report("Removing Stale Files"); + # Safety! + mtr_error("No, don't remove the vardir when running with --extern") + if $opt_extern; + + mtr_verbose("opt_vardir: $opt_vardir"); if ( $opt_vardir eq $default_vardir ) { # @@ -1905,29 +1919,37 @@ sub cleanup_stale_files () { if ( -l $opt_vardir) { # var is a symlink - if (-f $created_by_mem_file) + if (-f created_by_mem_filename() ) { # Remove the directory which the link points at + mtr_verbose("Removing " . readlink($opt_vardir)); rmtree(readlink($opt_vardir)); # Remove the entire "var" dir + mtr_verbose("Removing $opt_vardir/"); rmtree("$opt_vardir/"); # Remove the "var" symlink + mtr_verbose("unlink($opt_vardir)"); unlink($opt_vardir); } else { # Some users creates a soft link in mysql-test/var to another area - # - allow it + # - allow it, but remove all files in it + mtr_report("WARNING: Using the 'mysql-test/var' symlink"); - rmtree("$opt_vardir/log"); - rmtree("$opt_vardir/ndbcluster-$opt_ndbcluster_port"); - rmtree("$opt_vardir/run"); - rmtree("$opt_vardir/tmp"); + + my $dir= shift; + foreach my $bin ( glob("$opt_vardir/*") ) + { + mtr_verbose("Removing bin $bin"); + rmtree($bin); + } } } else { # Remove the entire "var" dir + mtr_verbose("Removing $opt_vardir/"); rmtree("$opt_vardir/"); } } @@ -1939,21 +1961,33 @@ sub cleanup_stale_files () { # Remove the var/ dir in mysql-test dir if any # this could be an old symlink that shouldn't be there + mtr_verbose("Removing $default_vardir"); rmtree($default_vardir); # Remove the "var" dir + mtr_verbose("Removing $opt_vardir/"); rmtree("$opt_vardir/"); } +} + +# +# Create var and the directories needed in var +# +sub setup_vardir() { + mtr_report("Creating Directories"); if ( $opt_mem ) { # Runinng with var as a link to some "memory" location, normally tmpfs - rmtree($opt_mem); + mtr_verbose("Creating $opt_mem"); mkpath($opt_mem); - mtr_report("Creating symlink from $opt_vardir to $opt_mem"); + + mtr_report("Symlinking 'var' to '$opt_mem'"); symlink($opt_mem, $opt_vardir); + # Put a small file to recognize this dir was created by --mem - mtr_tofile($created_by_mem_file, $opt_mem); + mtr_verbose("Creating " . created_by_mem_filename()); + mtr_tofile(created_by_mem_filename(), $opt_mem); } mkpath("$opt_vardir/log"); @@ -1961,10 +1995,9 @@ sub cleanup_stale_files () { mkpath("$opt_vardir/tmp"); mkpath($opt_tmpdir) if $opt_tmpdir ne "$opt_vardir/tmp"; - # Remove old and create new data dirs + # Create new data dirs foreach my $data_dir (@data_dir_lst) { - rmtree("$data_dir"); mkpath("$data_dir/mysql"); mkpath("$data_dir/test"); } @@ -2503,21 +2536,39 @@ sub initialize_servers () { datadir_setup(); - if ( ! $opt_extern ) + if ( $opt_extern ) + { + # Running against an already started server, if the specified + # vardir does not already exist it should be created + if ( ! -d $opt_vardir ) + { + mtr_report("Creating '$opt_vardir'"); + setup_vardir(); + } + else + { + mtr_report("No need to create '$opt_vardir' it already exists"); + } + } + else { kill_running_servers(); if ( ! $opt_start_dirty ) { - cleanup_stale_files(); + remove_stale_vardir(); + setup_vardir(); + mysql_install_db(); if ( $opt_force ) { + # Save a snapshot of the freshly installed db + # to make it possible to restore to a known point in time save_installed_db(); } } - check_running_as_root(); } + check_running_as_root(); } sub mysql_install_db () { @@ -4663,7 +4714,7 @@ Options that pass on options Options to run test on running server - extern Use running server for tests FIXME DANGEROUS + extern Use running server for tests ndb-connectstring=STR Use running cluster, and connect using STR ndb-connectstring-slave=STR Use running slave cluster, and connect using STR user=USER User for connection to extern server From fc1f9bfedee3ff0c7d674798a5179e562b41cbb5 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 15:15:01 +0100 Subject: [PATCH 08/19] Rename function datadir_setup to datadir_list_setup to avoid mixup with the function where vardir's are created --- mysql-test/mysql-test-run.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index df9919a2f3f..3305563296e 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -308,7 +308,7 @@ our %mysqld_variables; sub main (); sub initial_setup (); sub command_line_setup (); -sub datadir_setup (); +sub datadir_list_setup (); sub executable_setup (); sub environment_setup (); sub kill_running_servers (); @@ -1185,7 +1185,7 @@ sub command_line_setup () { $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/"; } -sub datadir_setup () { +sub datadir_list_setup () { # Make a list of all data_dirs @data_dir_lst = ( @@ -2534,7 +2534,7 @@ sub run_suite () { sub initialize_servers () { - datadir_setup(); + datadir_list_setup(); if ( $opt_extern ) { From bccf1442605189820ca44f6ea843a2d7facdf663 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 15:39:23 +0100 Subject: [PATCH 09/19] No need to have a "created_by_mem" file, just read the link and if that is same as opt_mem it can be removed --- mysql-test/mysql-test-run.pl | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 3305563296e..705b6e76578 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1893,10 +1893,6 @@ sub kill_running_servers () { } } -sub created_by_mem_filename(){ - return "$glob_mysql_test_dir/var/created_by_mem"; -} - # # Remove var and any directories in var/ created by previous @@ -1919,14 +1915,16 @@ sub remove_stale_vardir () { if ( -l $opt_vardir) { # var is a symlink - if (-f created_by_mem_filename() ) + if ( readlink($opt_vardir) eq $opt_mem ) { # Remove the directory which the link points at mtr_verbose("Removing " . readlink($opt_vardir)); rmtree(readlink($opt_vardir)); + # Remove the entire "var" dir mtr_verbose("Removing $opt_vardir/"); rmtree("$opt_vardir/"); + # Remove the "var" symlink mtr_verbose("unlink($opt_vardir)"); unlink($opt_vardir); @@ -1984,10 +1982,6 @@ sub setup_vardir() { mtr_report("Symlinking 'var' to '$opt_mem'"); symlink($opt_mem, $opt_vardir); - - # Put a small file to recognize this dir was created by --mem - mtr_verbose("Creating " . created_by_mem_filename()); - mtr_tofile(created_by_mem_filename(), $opt_mem); } mkpath("$opt_vardir/log"); From acf75687fb7b9861c0c63a119d2be3dd5ba37105 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 15:51:52 +0100 Subject: [PATCH 10/19] Some more checks to avoid removing unwanted directories. --- mysql-test/mysql-test-run.pl | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 705b6e76578..34fbf9f1b66 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1974,14 +1974,28 @@ sub remove_stale_vardir () { sub setup_vardir() { mtr_report("Creating Directories"); - if ( $opt_mem ) + if ( $opt_vardir eq $default_vardir ) { - # Runinng with var as a link to some "memory" location, normally tmpfs - mtr_verbose("Creating $opt_mem"); - mkpath($opt_mem); + # + # Running with "var" in mysql-test dir + # + if ( -l $opt_vardir ) + { + # it's a symlink - mtr_report("Symlinking 'var' to '$opt_mem'"); - symlink($opt_mem, $opt_vardir); + # Make sure the directory where it points exist + mtr_error("The destination for symlink $opt_vardir does not exist") + if ! -d readlink($opt_vardir); + } + elsif ( $opt_mem ) + { + # Runinng with "var" as a link to some "memory" location, normally tmpfs + mtr_verbose("Creating $opt_mem"); + mkpath($opt_mem); + + mtr_report("Symlinking 'var' to '$opt_mem'"); + symlink($opt_mem, $opt_vardir); + } } mkpath("$opt_vardir/log"); From e5ff9ebcd8cde1c935199dc7a9dbcf611129289d Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 16:22:59 +0100 Subject: [PATCH 11/19] Add warnings and more error checks in the creation of vardirs --- mysql-test/mysql-test-run.pl | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 34fbf9f1b66..84f884b3b4d 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1915,20 +1915,25 @@ sub remove_stale_vardir () { if ( -l $opt_vardir) { # var is a symlink - if ( readlink($opt_vardir) eq $opt_mem ) + + if ( $opt_mem and readlink($opt_vardir) eq $opt_mem ) { # Remove the directory which the link points at mtr_verbose("Removing " . readlink($opt_vardir)); rmtree(readlink($opt_vardir)); - # Remove the entire "var" dir - mtr_verbose("Removing $opt_vardir/"); - rmtree("$opt_vardir/"); - # Remove the "var" symlink mtr_verbose("unlink($opt_vardir)"); unlink($opt_vardir); } + elsif ( $opt_mem ) + { + # Just remove the "var" symlink + mtr_report("WARNING: Removing '$opt_vardir' symlink it's wrong"); + + mtr_verbose("unlink($opt_vardir)"); + unlink($opt_vardir); + } else { # Some users creates a soft link in mysql-test/var to another area @@ -1936,6 +1941,10 @@ sub remove_stale_vardir () { mtr_report("WARNING: Using the 'mysql-test/var' symlink"); + # Make sure the directory where it points exist + mtr_error("The destination for symlink $opt_vardir does not exist") + if ! -d readlink($opt_vardir); + my $dir= shift; foreach my $bin ( glob("$opt_vardir/*") ) { From ac2ef7dd5aee2e0dad356f614dbbe116057f4afd Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 16:24:31 +0100 Subject: [PATCH 12/19] Remove the check for writable var dir, it has to be done later on --- mysql-test/mysql-test-run.pl | 7 ------- 1 file changed, 7 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index e8ebb812b5c..ce910b8879c 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -808,13 +808,6 @@ sub command_line_setup () { $opt_vardir= "$glob_mysql_test_dir/$opt_vardir"; } - # Ensure a proper error message - mkpath("$opt_vardir"); - unless ( -d $opt_vardir and -w $opt_vardir ) - { - mtr_error("Writable 'var' directory is needed, use the '--vardir' option"); - } - # -------------------------------------------------------------------------- # Set tmpdir # -------------------------------------------------------------------------- From a92c7700bbe0199f82765e168c7f017f708cd67c Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 19:10:39 +0100 Subject: [PATCH 13/19] Only force mysqld to use log file up until 5.1.6 After that it will by default use log tables. That setting can be overruled by adding a -master.opt file like mysql_client_test has. --- mysql-test/mysql-test-run.pl | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 84f884b3b4d..74486fe81aa 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3454,6 +3454,12 @@ sub mysqld_arguments ($$$$$) { mtr_add_arg($args, "%s--ndb-extra-logging", $prefix); } } + + if ( $mysql_version_id <= 50106 ) + { + # Force mysqld to use log files up until 5.1.6 + mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'}); + } } if ( $type eq 'slave' ) @@ -3471,8 +3477,6 @@ sub mysqld_arguments ($$$$$) { mtr_add_arg($args, "%s--log-slave-updates", $prefix); } - mtr_add_arg($args, "%s--log=%s", $prefix, - $slave->[$idx]->{'path_mylog'}); mtr_add_arg($args, "%s--master-retry-count=10", $prefix); mtr_add_arg($args, "%s--pid-file=%s", $prefix, $slave->[$idx]->{'path_pid'}); @@ -3533,6 +3537,13 @@ sub mysqld_arguments ($$$$$) { mtr_add_arg($args, "%s--ndb-extra-logging", $prefix); } } + + if ( $mysql_version_id <= 50106 ) + { + # Force mysqld to use log files up until 5.1.6 + mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'}); + } + } # end slave if ( $opt_debug ) @@ -3609,7 +3620,6 @@ sub mysqld_arguments ($$$$$) { elsif ( $type eq 'master' ) { mtr_add_arg($args, "%s--open-files-limit=1024", $prefix); - mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'}); } return $args; From 961ae4ab2f17cf0dfcad5acbc2c2f34f619e11a2 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 19:54:16 +0100 Subject: [PATCH 14/19] Create new function "run_testcase_mark_logs' and use it to mark start of testcase in all cuurently known log files --- mysql-test/mysql-test-run.pl | 47 +++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 74486fe81aa..aed1b2c318b 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2952,26 +2952,15 @@ sub do_before_run_mysqltest($) unlink("$result_dir/$tname.log"); unlink("$result_dir/$tname.warnings"); - 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($path_ndb_testrun_log,"CURRENT TEST $tname\n"); - - mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n"); - if ( $master->[1]->{'pid'} ) - { - mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n"); - } - if ( $mysql_version_id < 50000 ) { - # Set envirnoment variable NDB_STATUS_OK to 1 + # Set environment variable NDB_STATUS_OK to 1 # if script decided to run mysqltest cluster _is_ installed ok $ENV{'NDB_STATUS_OK'} = "1"; } elsif ( $mysql_version_id < 50100 ) { - # Set envirnoment variable NDB_STATUS_OK to YES + # Set environment variable NDB_STATUS_OK to YES # if script decided to run mysqltest cluster _is_ installed ok $ENV{'NDB_STATUS_OK'} = "YES"; } @@ -2982,9 +2971,9 @@ sub do_after_run_mysqltest($) my $tinfo= shift; my $tname= $tinfo->{'name'}; - mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n"); - # Save info from this testcase run to mysqltest.log + mtr_appendfile_to_file($path_current_test_log, $path_mysqltest_log) + if -f $path_current_test_log; mtr_appendfile_to_file($path_timefile, $path_mysqltest_log) if -f $path_timefile; @@ -2994,6 +2983,26 @@ sub do_after_run_mysqltest($) } +sub run_testcase_mark_logs($) +{ + my ($log_msg)= @_; + + # Write a marker to all log files + + # The file indicating current test name + mtr_tonewfile($path_current_test_log, $log_msg); + + # each mysqld's .err file + foreach my $mysqld (@{$master}, @{$slave}) + { + mtr_tofile($mysqld->{path_myerr}, $log_msg); + } + + # ndbcluster log file + mtr_tofile($path_ndb_testrun_log, $log_msg); + +} + sub find_testcase_skipped_reason($) { my ($tinfo)= @_; @@ -3113,6 +3122,10 @@ sub run_testcase ($) { run_testcase_stop_servers($tinfo, $master_restart, $slave_restart); } + + # Write to all log files to indicate start of testcase + run_testcase_mark_logs("CURRENT_TEST: $tinfo->{name}\n"); + my $died= mtr_record_dead_children(); if ($died or $master_restart or $slave_restart) { @@ -4124,8 +4137,6 @@ sub run_testcase_start_servers($) { return 1; } } - mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n"); - mysqld_start($master->[1],$tinfo->{'master_opt'},[]); } @@ -4153,8 +4164,6 @@ sub run_testcase_start_servers($) { # ---------------------------------------------------------------------- if ( $tinfo->{'slave_num'} ) { - mtr_tofile($slave->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n"); - restore_slave_databases($tinfo->{'slave_num'}); do_before_start_slave($tinfo); From fa8af126511502ce5ab7fa4a7662da19f0a6803d Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 20:00:27 +0100 Subject: [PATCH 15/19] Look for client binaries also in bin/ directory --- mysql-test/mysql-test-run.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index aed1b2c318b..3aabf9ab742 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -656,11 +656,12 @@ sub command_line_setup () { # number as early as possible # - # Look for the client binaries + # Look for the client binaries directory $path_client_bindir= mtr_path_exists("$glob_basedir/client_release", "$glob_basedir/client_debug", vs_config_dirs('client', ''), - "$glob_basedir/client"); + "$glob_basedir/client", + "$glob_basedir/bin/"); $exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'), "$glob_basedir/sql/mysqld", From 0c48000e6c636c62feed9f0a49de23ecf93bda4d Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 21:57:42 +0100 Subject: [PATCH 16/19] Fix missing parameter declaration --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 91a5b09e4df..1ffa2bbc68c 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1224,7 +1224,7 @@ sub command_line_setup () { # But a fairly safe range seems to be 5001 - 32767 # -sub set_mtr_build_thread_ports() { +sub set_mtr_build_thread_ports($) { my $mtr_build_thread= shift; # Up to two masters, up to three slaves From 05eb532514c11fc73a7134cdaa92369a984b21ad Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 22:16:31 +0100 Subject: [PATCH 17/19] Bug#24335 mysql-test-run.pl fails with ActiveState Perl on Windows - Avoid use of mtr_run when executing "mysqld --verbose --help" to find version and supported features --- mysql-test/mysql-test-run.pl | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 3aabf9ab742..c1b0c44a00c 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1216,26 +1216,15 @@ sub datadir_list_setup () { sub collect_mysqld_features () { - # - # Execute "mysqld --no-defaults --help --verbose", that will - # print out version and a list of all features and settings - # my $found_variable_list_start= 0; - my $spec_file= "$glob_mysql_test_dir/mysqld.spec.$$"; - if ( mtr_run($exe_mysqld, - ["--no-defaults", - "--verbose", - "--help"], - "", "$spec_file", "$spec_file", "") != 0 ) - { - mtr_error("Failed to get version and list of features from %s", - $exe_mysqld); - } - my $F= IO::File->new($spec_file) or - mtr_error("can't open file \"$spec_file\": $!"); + # + # Execute "mysqld --no-defaults --help --verbose" to get a + # of all features and settings + # + my $list= `$exe_mysqld --no-defaults --verbose --help`; - while ( my $line= <$F> ) + foreach my $line (split('\n', $list)) { # First look for version if ( !$mysql_version_id ) @@ -1288,7 +1277,7 @@ sub collect_mysqld_features () { } } } - unlink($spec_file); + mtr_error("Could not find version of MySQL") unless $mysql_version_id; mtr_error("Could not find variabes list") unless $found_variable_list_start; From 7eb487ab26f753e72bd8b4a9b9a689885a2edf3b Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 23:06:06 +0100 Subject: [PATCH 18/19] Move the check that $opt_vardir could be created and was writable to the function where we know how to creat the vardir Remove unused variable --- mysql-test/mysql-test-run.pl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index c1b0c44a00c..0859b02167c 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1883,7 +1883,6 @@ sub kill_running_servers () { } } - # # Remove var and any directories in var/ created by previous # tests @@ -1935,7 +1934,6 @@ sub remove_stale_vardir () { mtr_error("The destination for symlink $opt_vardir does not exist") if ! -d readlink($opt_vardir); - my $dir= shift; foreach my $bin ( glob("$opt_vardir/*") ) { mtr_verbose("Removing bin $bin"); @@ -1997,6 +1995,19 @@ sub setup_vardir() { } } + if ( ! -d $opt_vardir ) + { + mtr_verbose("Creating $opt_vardir"); + mkpath($opt_vardir); + } + + # Ensure a proper error message if vardir couldn't be created + unless ( -d $opt_vardir and -w $opt_vardir ) + { + mtr_error("Writable 'var' directory is needed, use the " . + "'--vardir=' option"); + } + mkpath("$opt_vardir/log"); mkpath("$opt_vardir/run"); mkpath("$opt_vardir/tmp"); From 2b98e19bb538a9fb48d3cd5a0fe2d2c6aa814583 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 23:09:17 +0100 Subject: [PATCH 19/19] Remove the moved check a second time. --- mysql-test/mysql-test-run.pl | 7 ------- 1 file changed, 7 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 963aae85a59..80a444acb27 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -813,13 +813,6 @@ sub command_line_setup () { $opt_vardir= "$glob_mysql_test_dir/$opt_vardir"; } - # Ensure a proper error message - mkpath("$opt_vardir"); - unless ( -d $opt_vardir and -w $opt_vardir ) - { - mtr_error("Writable 'var' directory is needed, use the '--vardir' option"); - } - # -------------------------------------------------------------------------- # Set tmpdir # --------------------------------------------------------------------------