Commit e16d9851 authored by unknown's avatar unknown
Browse files

Fix problem with specifying vardir, mysql_version_id was not yet available...

Fix problem with specifying vardir, mysql_version_id was not yet available when vardir arguments is checked
Move the code to look for exe_mysqld earlier => to initial_setup
Fix warnings detected by running with "diagnostics"
Remove unused option "opt_result_ext"
Init "path_ndb_examples_dir"


mysql-test/lib/mtr_cases.pl:
  Set default number of slave to 0
  Remove unused/uninitialized "$opt_result_ext"
mysql-test/lib/mtr_report.pl:
  Remove unused/uninitialized "$opt_result_ext"
parent 4c7beb83
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -250,6 +250,7 @@ sub collect_one_test_case($$$$$$$) {
  $tinfo->{'path'}= $path;
  $tinfo->{'timezone'}= "GMT-3"; # for UNIX_TIMESTAMP tests to work

  $tinfo->{'slave_num'}= 0; # Default, no slave
  if ( defined mtr_match_prefix($tname,"rpl") )
  {
    if ( $::opt_skip_rpl )
@@ -259,7 +260,8 @@ sub collect_one_test_case($$$$$$$) {
      return;
    }

    $tinfo->{'slave_num'}= 1;           # Default, use one slave

    $tinfo->{'slave_num'}= 1; # Default for rpl* tests, use one slave

    if ( $tname eq 'rpl_failsafe' or $tname eq 'rpl_chain_temp_table' )
    {
@@ -346,11 +348,6 @@ sub collect_one_test_case($$$$$$$) {
        if ( defined $value )
        {
          $tinfo->{'result_file'}= "r/$value.result";
          if ( $::opt_result_ext and $::opt_record or
               -f "$tinfo->{'result_file'}$::opt_result_ext")
          {
            $tinfo->{'result_file'}.= $::opt_result_ext;
          }
          $tinfo->{'master_restart'}= 0;
          last MASTER_OPT;
        }
+0 −7
Original line number Diff line number Diff line
@@ -53,13 +53,6 @@ sub mtr_show_failed_diff ($) {
  {
    $result_file=  $eval_file;
  }
  elsif ( $::opt_result_ext and
          ( $::opt_record or -f "$result_file$::opt_result_ext" ))
  {
    # If we have an special externsion for result files we use it if we are
    # recording or a result file with that extension exists.
    $result_file=  "$result_file$::opt_result_ext";
  }

  my $diffopts= $::opt_udiff ? "-u" : "-c";

+64 −44
Original line number Diff line number Diff line
@@ -142,6 +142,8 @@ our $opt_vardir; # A path but set directly on cmd line
our $path_vardir_trace;          # unix formatted opt_vardir for trace files
our $opt_tmpdir;                 # A path but set directly on cmd line

our $default_vardir;

our $opt_usage;
our $opt_suite;

@@ -230,8 +232,6 @@ our $opt_ndbconnectstring_slave;
our $opt_record;
our $opt_check_testcases;

our $opt_result_ext;

our $opt_skip;
our $opt_skip_rpl;
our $max_slave_num= 0;
@@ -471,6 +471,38 @@ sub initial_setup () {
    $opt_source_dist ? $glob_mysql_test_dir : $glob_basedir;

  $glob_timers= mtr_init_timers();

  #
  # Find the mysqld executable to be able to find the mysqld version
  # number as early as possible
  #

  # Look for the path where to find the client binaries
  $path_client_bindir= mtr_path_exists("$glob_basedir/client",
				       "$glob_basedir/client_release",
				       "$glob_basedir/client_debug",
				       "$glob_basedir/client/release",
				       "$glob_basedir/client/debug",
				       "$glob_basedir/bin");

  # Look for the mysqld executable
  $exe_mysqld=         mtr_exe_exists ("$glob_basedir/sql/mysqld",
				       "$path_client_bindir/mysqld-max-nt",
				       "$path_client_bindir/mysqld-max",
				       "$path_client_bindir/mysqld-nt",
				       "$path_client_bindir/mysqld",
				       "$path_client_bindir/mysqld-debug",
				       "$path_client_bindir/mysqld-max",
				       "$glob_basedir/libexec/mysqld",
				       "$glob_basedir/sql/release/mysqld",
				       "$glob_basedir/sql/debug/mysqld");

  $exe_master_mysqld= $exe_master_mysqld || $exe_mysqld;
  $exe_slave_mysqld=  $exe_slave_mysqld  || $exe_mysqld;

  # Use the mysqld found above to find out what features are available
  check_mysqld_features();

}


@@ -731,17 +763,20 @@ sub command_line_setup () {
  # Set the "var/" directory, as it is the base for everything else
  # --------------------------------------------------------------------------

  $default_vardir= "$glob_mysql_test_dir/var";
  if ( ! $opt_vardir )
  {
    $opt_vardir= "$glob_mysql_test_dir/var";
    $opt_vardir= $default_vardir;
  }
  elsif ( $mysql_version_id < 50000 )
  elsif ( $mysql_version_id < 50000 and
	  $opt_vardir ne $default_vardir )
  {
    # --vardir was specified
    # It's only supported in 4.1 as a symlink from var/
    # by setting up $opt_mem that will be created
    # Version 4.1 and --vardir was specified
    # Only supported as a symlink from var/
    # by setting up $opt_mem that symlink will be created
    $opt_mem= $opt_vardir;
    $opt_vardir= undef;
    $opt_vardir= $default_vardir;
    mtr_report("Using 4.1 vardir trick");
  }

  $path_vardir_trace= $opt_vardir;
@@ -1247,8 +1282,8 @@ sub check_mysqld_features () {
  }

  # Set default values from mysqld_variables
  $opt_socket=  %mysqld_variables->{'socket'};
  $default_mysqld_port = %mysqld_variables->{'port'};
  $opt_socket=  $mysqld_variables{'socket'};
  $default_mysqld_port = $mysqld_variables{'port'};
}


@@ -1269,32 +1304,6 @@ sub executable_setup () {
    }
  }

  # Look for the path where to find the client binaries
  $path_client_bindir= mtr_path_exists("$glob_basedir/client",
				       "$glob_basedir/client_release",
				       "$glob_basedir/client_debug",
				       "$glob_basedir/client/release",
				       "$glob_basedir/client/debug",
				       "$glob_basedir/bin");

  # Look for the mysqld executable
  $exe_mysqld=         mtr_exe_exists ("$glob_basedir/sql/mysqld",
				       "$path_client_bindir/mysqld-max-nt",
				       "$path_client_bindir/mysqld-max",
				       "$path_client_bindir/mysqld-nt",
				       "$path_client_bindir/mysqld",
				       "$path_client_bindir/mysqld-debug",
				       "$path_client_bindir/mysqld-max",
				       "$glob_basedir/libexec/mysqld",
				       "$glob_basedir/sql/release/mysqld",
				       "$glob_basedir/sql/debug/mysqld");

  $exe_master_mysqld= $exe_master_mysqld || $exe_mysqld;
  $exe_slave_mysqld=  $exe_slave_mysqld  || $exe_mysqld;

  # Use the mysqld found above to find out what features are available
  check_mysqld_features();

  # Look for language files and charsetsdir, use same share
  my $path_share=      mtr_path_exists("$glob_basedir/share",
				       "$glob_basedir/sql/share",
@@ -1326,6 +1335,10 @@ sub executable_setup () {
		     "$glob_basedir/server-tools/instance-manager/mysqlmanager",
		     "$glob_basedir/libexec/mysqlmanager");
  }
  else
  {
    $exe_im= "not_available";
  }

  # Look for the client binaries
  $exe_mysqlcheck=     mtr_exe_exists("$path_client_bindir/mysqlcheck");
@@ -1365,12 +1378,19 @@ sub executable_setup () {
    $exe_ndbd=
      mtr_exe_exists("$ndb_path/src/kernel/ndbd",
		     "$glob_basedir/bin/ndbd");

    $path_ndb_examples_dir=
      mtr_path_exists("$ndb_path/ndbapi-examples",
		      "$ndb_path/examples");
    $exe_ndb_example=
      mtr_file_exists("$path_ndb_examples_dir/ndbapi_simple/ndbapi_simple");
  }

  # Look for the udf_example library
  $lib_udf_example=
    mtr_file_exists("$glob_basedir/sql/.libs/udf_example.so");

    mtr_file_exists("$glob_basedir/sql/.libs/udf_example.so",
		    "$glob_basedir/sql/release/udf_example.dll",
		    "$glob_basedir/sql/debug/udf_example.dll");

  # Look for mysqltest executable
  if ( $glob_use_embedded_server )
@@ -1468,11 +1488,11 @@ sub environment_setup () {
  }

  $ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths,
				split(':', $ENV{'LD_LIBRARY_PATH'}));
				split(':', qw($ENV{'LD_LIBRARY_PATH'})));
  mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}");

  $ENV{'DYLD_LIBRARY_PATH'}= join(":", @ld_library_paths,
				split(':', $ENV{'DYLD_LIBRARY_PATH'}));
				split(':', qw($ENV{'DYLD_LIBRARY_PATH'})));
  mtr_debug("DYLD_LIBRARY_PATH: $ENV{'DYLD_LIBRARY_PATH'}");


@@ -1798,7 +1818,7 @@ sub cleanup_stale_files () {

  mtr_report("Removing Stale Files");

  if ( $opt_vardir eq "$glob_mysql_test_dir/var" )
  if ( $opt_vardir eq $default_vardir )
  {
    #
    # Running with "var" in mysql-test dir
@@ -1838,7 +1858,7 @@ 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
    rmtree("$glob_mysql_test_dir/var");
    rmtree($default_vardir);

    # Remove the "var" dir
    rmtree("$opt_vardir/");
@@ -1849,7 +1869,7 @@ sub cleanup_stale_files () {
    # Runinng with var as a link to some "memory" location, normally tmpfs
    rmtree($opt_mem);
    mkpath($opt_mem);
    mtr_verbose("Creating symlink from $opt_vardir to $opt_mem");
    mtr_report("Creating symlink from $opt_vardir 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);
@@ -2710,7 +2730,7 @@ sub do_before_run_mysqltest($)

  # Remove old files produced by mysqltest
  my $result_dir= "r";
  if ( ! $opt_suite eq "main" )
  if ( $opt_suite ne "main" )
  {
    $result_dir= "suite/$opt_suite/r";
  }