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/12] 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 ee4a5b865fe13bb493c232d9eb57ee89132487b5 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 10:31:07 +0100 Subject: [PATCH 02/12] 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 03/12] 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 fc1f9bfedee3ff0c7d674798a5179e562b41cbb5 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 15:15:01 +0100 Subject: [PATCH 04/12] 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 05/12] 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 06/12] 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 07/12] 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 08/12] 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 08e0e06eabd441b579face88fe7d80cd4639d223 Mon Sep 17 00:00:00 2001 From: "kent@mysql.com/kent-amd64.(none)" <> Date: Tue, 28 Nov 2006 18:04:10 +0100 Subject: [PATCH 09/12] Makefile.am: If using \$(srcdir)/mysql.info in action, use same in rule. --- Docs/Makefile.am | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Docs/Makefile.am b/Docs/Makefile.am index 159dffddde8..85a362133a1 100644 --- a/Docs/Makefile.am +++ b/Docs/Makefile.am @@ -26,7 +26,7 @@ all-local: $(TXT_FILES) # make sure that "make install" installs the info page, too # automake only seems to take care of this automatically, # if we're building the info page from texi directly. -install-data-hook: mysql.info +install-data-hook: $(srcdir)/mysql.info $(mkinstalldirs) $(DESTDIR)$(infodir) $(INSTALL_DATA) $(srcdir)/mysql.info $(DESTDIR)$(infodir) @@ -39,22 +39,22 @@ CLEAN_FILES: $(TXT_FILES) GT = $(srcdir)/Support/generate-text-files.pl -../INSTALL-SOURCE: mysql.info $(GT) +../INSTALL-SOURCE: $(srcdir)/mysql.info $(GT) perl -w $(GT) $(srcdir)/mysql.info "installing-source" "windows-source-build" > $@ -../INSTALL-WIN-SOURCE: mysql.info $(GT) +../INSTALL-WIN-SOURCE: $(srcdir)/mysql.info $(GT) perl -w $(GT) $(srcdir)/mysql.info "windows-source-build" "post-installation" > $@ # We put the description for the binary installation here so that # people who download source wont have to see it. It is moved up to # the toplevel by the script that makes the binary tar files. -INSTALL-BINARY: mysql.info $(GT) +INSTALL-BINARY: $(srcdir)/mysql.info $(GT) perl -w $(GT) $(srcdir)/mysql.info "installing-binary" "installing-source" > $@ -../EXCEPTIONS-CLIENT: mysql.info $(GT) +../EXCEPTIONS-CLIENT: $(srcdir)/mysql.info $(GT) perl -w $(GT) $(srcdir)/mysql.info "mysql-floss-license-exception" "function-index" > $@ -../support-files/MacOSX/ReadMe.txt: mysql.info $(GT) +../support-files/MacOSX/ReadMe.txt: $(srcdir)/mysql.info $(GT) perl -w $(GT) $(srcdir)/mysql.info "mac-os-x-installation" "netware-installation" > $@ # Don't update the files from bitkeeper From a92c7700bbe0199f82765e168c7f017f708cd67c Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 28 Nov 2006 19:10:39 +0100 Subject: [PATCH 10/12] 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 11/12] 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 12/12] 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",