⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mysql-test-run.pl

📁 开启mysql的远程连接的方法 mysql-noinstall-5.1.6-alpha-win32.zip
💻 PL
📖 第 1 页 / 共 5 页
字号:
sub initial_setup () {  select(STDOUT);  $| = 1;                       # Make unbuffered  $glob_scriptname=  basename($0);  $glob_win32_perl=  ($^O eq "MSWin32");  $glob_cygwin_perl= ($^O eq "cygwin");  $glob_win32=       ($glob_win32_perl or $glob_cygwin_perl);  # We require that we are in the "mysql-test" directory  # to run mysql-test-run  if (! -f $glob_scriptname)  {    mtr_error("Can't find the location for the mysql-test-run script\n" .              "Go to to the mysql-test directory and execute the script " .              "as follows:\n./$glob_scriptname");  }  if ( -d "../sql" )  {    $opt_source_dist=  1;  }  $glob_hostname=  mtr_short_hostname();  # 'basedir' is always parent of "mysql-test" directory  $glob_mysql_test_dir=  cwd();  if ( $glob_cygwin_perl )  {    # Windows programs like 'mysqld' needs Windows paths    $glob_mysql_test_dir= `cygpath -m $glob_mysql_test_dir`;    my $shell= $ENV{'SHELL'} || "/bin/bash";    $glob_cygwin_shell=   `cygpath -w $shell`; # The Windows path c:\...    chomp($glob_mysql_test_dir);    chomp($glob_cygwin_shell);  }  $glob_basedir=         dirname($glob_mysql_test_dir);  $glob_mysql_bench_dir= "$glob_basedir/mysql-bench"; # FIXME make configurable  # needs to be same length to test logging (FIXME what???)  $path_slave_load_tmpdir=  "../../var/tmp";  $path_my_basedir=    $opt_source_dist ? $glob_mysql_test_dir : $glob_basedir;  $glob_timers= mtr_init_timers();}################################################################################  Default settings###############################################################################sub command_line_setup () {  # These are defaults for things that are set on the command line  $opt_suite=        "main";    # Special default suite  my $opt_master_myport= 9306;  my $opt_slave_myport=  9308;  $opt_ndbcluster_port=  9350;  $opt_ndbcluster_port_slave=  9358;  my $im_port=           9310;  my $im_mysqld1_port=   9312;  my $im_mysqld2_port=   9314;  if ( $ENV{'MTR_BUILD_THREAD'} )  {    $opt_master_myport=   $ENV{'MTR_BUILD_THREAD'} * 40 + 8120;    $opt_slave_myport=    $opt_master_myport + 16;    $opt_ndbcluster_port= $opt_master_myport + 24;    $opt_ndbcluster_port_slave= $opt_master_myport + 32;    $im_port=             $opt_master_myport + 10;    $im_mysqld1_port=     $opt_master_myport + 12;    $im_mysqld2_port=     $opt_master_myport + 14;  }  # Read the command line  # Note: Keep list, and the order, in sync with usage at end of this file  Getopt::Long::Configure("pass_through");  GetOptions(             # Control what engine/variation to run             'embedded-server'          => \$opt_embedded_server,             'ps-protocol'              => \$opt_ps_protocol,             'sp-protocol'              => \$opt_sp_protocol,             'view-protocol'            => \$opt_view_protocol,             'cursor-protocol'          => \$opt_cursor_protocol,             'ssl|with-openssl'         => \$opt_ssl,             'skip-ssl'                 => \$opt_skip_ssl,             'compress'                 => \$opt_compress,             'bench'                    => \$opt_bench,             'small-bench'              => \$opt_small_bench,             'no-manager'               => \$opt_no_manager, # Currently not used             # Control what test suites or cases to run             'force'                    => \$opt_force,             'with-ndbcluster'          => \$opt_with_ndbcluster,             'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster,             'with-ndbcluster-slave'    => \$opt_with_ndbcluster_slave,             'skip-ndbcluster-slave|skip-ndb-slave'                                        => \$opt_skip_ndbcluster_slave,             'ndb-extra-test'           => \$opt_ndb_extra_test,             '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             'master_port=i'            => \$opt_master_myport,             'slave_port=i'             => \$opt_slave_myport,             'ndbcluster_port=i'        => \$opt_ndbcluster_port,             'ndbcluster_port_slave=i'  => \$opt_ndbcluster_port_slave,             'manager-port=i'           => \$opt_manager_port, # Currently not used             'im-port=i'                => \$im_port, # Instance Manager port.             'im-mysqld1-port=i'        => \$im_mysqld1_port, # Port of mysqld, controlled by IM             'im-mysqld2-port=i'        => \$im_mysqld2_port, # Port of mysqld, controlled by IM             # Test case authoring             'record'                   => \$opt_record,             # ???             'mysqld=s'                 => \@opt_extra_mysqld_opt,             # Run test on running server             'extern'                   => \$opt_extern,             'ndbconnectstring=s'       => \$opt_ndbconnectstring,             'ndbconnectstring-slave=s' => \$opt_ndbconnectstring_slave,             # Debugging             'gdb'                      => \$opt_gdb,             'manual-gdb'               => \$opt_manual_gdb,             'client-gdb'               => \$opt_client_gdb,             'ddd'                      => \$opt_ddd,             'strace-client'            => \$opt_strace_client,             'master-binary=s'          => \$exe_master_mysqld,             'slave-binary=s'           => \$exe_slave_mysqld,             # Coverage, profiling etc             'gcov'                     => \$opt_gcov,             'gprof'                    => \$opt_gprof,             'valgrind:s'               => \$opt_valgrind,             'valgrind-mysqltest:s'     => \$opt_valgrind_mysqltest,             'valgrind-all:s'           => \$opt_valgrind_all,             'valgrind-options=s'       => \$opt_valgrind_options,             # Stress testing              'stress'                   => \$opt_stress,             'stress-suite=s'           => \$opt_stress_suite,             'stress-threads=i'         => \$opt_stress_threads,             'stress-test-file=s'       => \$opt_stress_test_file,             'stress-init-file=s'       => \$opt_stress_init_file,             'stress-mode=s'            => \$opt_stress_mode,             'stress-loop-count=i'      => \$opt_stress_loop_count,             'stress-test-count=i'      => \$opt_stress_test_count,             'stress-test-duration=i'   => \$opt_stress_test_duration,             # Misc             'big-test'                 => \$opt_big_test,             'debug'                    => \$opt_debug,             'fast'                     => \$opt_fast,             'local'                    => \$opt_local,             'local-master'             => \$opt_local_master,             'netware'                  => \$opt_netware,             'old-master'               => \$opt_old_master,             'reorder'                  => \$opt_reorder,             'script-debug'             => \$opt_script_debug,             'sleep=i'                  => \$opt_sleep,             'socket=s'                 => \$opt_socket,             'start-dirty'              => \$opt_start_dirty,             'start-and-exit'           => \$opt_start_and_exit,             'start-from=s'             => \$opt_start_from,             'timer'                    => \$opt_timer,             'tmpdir=s'                 => \$opt_tmpdir,             'unified-diff|udiff'       => \$opt_udiff,             'user-test=s'              => \$opt_user_test,             'user=s'                   => \$opt_user,             'vardir=s'                 => \$opt_vardir,             'verbose'                  => \$opt_verbose,             'wait-timeout=i'           => \$opt_wait_timeout,             'testcase-timeout=i'       => \$opt_testcase_timeout,             'suite-timeout=i'          => \$opt_suite_timeout,             'warnings|log-warnings'    => \$opt_warnings,             'help|h'                   => \$opt_usage,            ) or usage("Can't read options");  if ( $opt_usage )  {    usage("");  }  foreach my $arg ( @ARGV )  {    if ( $arg =~ /^--skip-/ )    {      push(@opt_extra_mysqld_opt, $arg);    }    elsif ( $arg =~ /^-/ )    {      usage("Invalid option \"$arg\"");    }    else    {      push(@opt_cases, $arg);    }  }  # --------------------------------------------------------------------------  # Set the "var/" directory, as it is the base for everything else  # --------------------------------------------------------------------------  if ( ! $opt_vardir )  {    $opt_vardir= "$glob_mysql_test_dir/var";  }  # We make the path absolute, as the server will do a chdir() before usage  unless ( $opt_vardir =~ m,^/, or           ($glob_win32 and $opt_vardir =~ m,^[a-z]:/,i) )  {    # Make absolute path, relative test dir    $opt_vardir= "$glob_mysql_test_dir/$opt_vardir";  }  # --------------------------------------------------------------------------  # If not set, set these to defaults  # --------------------------------------------------------------------------  $opt_tmpdir=       "$opt_vardir/tmp" unless $opt_tmpdir;  # FIXME maybe not needed?  $path_manager_log= "$opt_vardir/log/manager.log"    unless $path_manager_log;  $opt_current_test= "$opt_vardir/log/current_test"    unless $opt_current_test;  # --------------------------------------------------------------------------  # Do sanity checks of command line arguments  # --------------------------------------------------------------------------  if ( $opt_extern and $opt_local )  {    mtr_error("Can't use --extern and --local at the same time");  }  if ( ! $opt_socket )  {     # FIXME set default before reading options?#    $opt_socket=  '@MYSQL_UNIX_ADDR@';    $opt_socket=  "/tmp/mysql.sock"; # FIXME  }  # --------------------------------------------------------------------------  # Look at the command line options and set script flags  # --------------------------------------------------------------------------  if ( $opt_record and ! @opt_cases )  {    mtr_error("Will not run in record mode without a specific test case");  }  if ( $opt_embedded_server )  {    $glob_use_embedded_server= 1;    push(@glob_test_mode, "embedded");    $opt_skip_rpl= 1;              # We never run replication with embedded    $opt_skip_ndbcluster= 1;       # Avoid auto detection    $opt_skip_ssl= 1;    if ( $opt_extern )    {      mtr_error("Can't use --extern with --embedded-server");    }  }  if ( $opt_ps_protocol )  {    push(@glob_test_mode, "ps-protocol");  }  # FIXME don't understand what this is#  if ( $opt_local_master )#  {#    $opt_master_myport=  3306;#  }  if ( $opt_small_bench )  {    $opt_bench=  1;  }  if ( $opt_sleep )  {    $opt_sleep_time_after_restart= $opt_sleep;  }  if ( $opt_gcov and ! $opt_source_dist )  {    mtr_error("Coverage test needs the source - please use source dist");  }  if ( $opt_gdb )  {    $opt_wait_timeout=  300;    if ( $opt_extern )    {      mtr_error("Can't use --extern with --gdb");    }  }  if ( $opt_manual_gdb )  {    $opt_gdb=  1;    if ( $opt_extern )    {      mtr_error("Can't use --extern with --manual-gdb");    }  }  if ( $opt_ddd )  {    if ( $opt_extern )    {      mtr_error("Can't use --extern with --ddd");    }  }  # The ":s" in the argument spec, means we have three different cases  #  #   undefined    option not set  #   ""           option set with no argument  #   "somestring" option is name/path of valgrind executable  # Take executable path from any of them, if any  $opt_valgrind_mysqld= $opt_valgrind;  $opt_valgrind= $opt_valgrind_mysqltest if $opt_valgrind_mysqltest;  $opt_valgrind= $opt_valgrind_all       if $opt_valgrind_all;  # If valgrind flag not defined, define if other valgrind flags are  unless ( defined $opt_valgrind )  {    $opt_valgrind= ""      if defined $opt_valgrind_mysqltest or defined $opt_valgrind_all;  }  if ( ! $opt_testcase_timeout )  {    $opt_testcase_timeout= $default_testcase_timeout;    $opt_testcase_timeout*= 10 if defined $opt_valgrind;  }  if ( ! $opt_suite_timeout )  {    $opt_suite_timeout= $default_suite_timeout;    $opt_suite_timeout*= 4 if defined $opt_valgrind;  }  if ( defined $opt_valgrind )  {    $opt_sleep_time_after_restart= 10;    $opt_sleep_time_for_delete= 60;    # >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr    #  valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && VALGRIND="$VALGRIND --tool=memcheck"  }  if ( ! $opt_user )  {    if ( $glob_use_running_server )    {      $opt_user= "test";    }    else    {      $opt_user= "root"; # We want to do FLUSH xxx commands    }  }  # On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be  # considered different, so avoid the extra slash (/) in the socket  # paths.  my $sockdir = $opt_tmpdir;  $sockdir =~ s|/+$||;  # Put this into a hash, will be a C struct  $master->[0]=  {   path_myddir   => "$opt_vardir/master-data",   path_myerr    => "$opt_vardir/log/master.err",   path_mylog    => "$opt_vardir/log/master.log",   path_mypid    => "$opt_vardir/run/master.pid",   path_mysock   => "$sockdir/master.sock",   path_myport   =>  $opt_master_myport,   start_timeout =>  400, # enough time create innodb tables   ndbcluster    =>  1, # ndbcluster not started  };  $master->[1]=  {   path_myddir   => "$opt_vardir/master1-data",   path_myerr    => "$opt_vardir/log/master1.err",   path_mylog    => "$opt_vardir/log/master1.log",   path_mypid    => "$opt_vardir/run/master1.pid",   path_mysock   => "$sockdir/master1.sock",   path_myport   => $opt_master_myport + 1,   start_timeout => 400, # enough time create innodb tables  };  $slave->[0]=  {   path_myddir   => "$opt_vardir/slave-data",   path_myerr    => "$opt_vardir/log/slave.err",   path_mylog    => "$opt_vardir/log/slave.log",   path_mypid    => "$opt_vardir/run/slave.pid",   path_mysock   => "$sockdir/slave.sock",   path_myport   => $opt_slave_myport,   start_timeout => 400,   ndbcluster    =>  1, # ndbcluster not started  };  $slave->[1]=  {   path_myddir   => "$opt_vardir/slave1-data",   path_myerr    => "$opt_vardir/log/slave1.err",   path_mylog    => "$opt_vardir/log/slave1.log",   path_mypid    => "$opt_vardir/run/slave1.pid",   path_mysock   => "$sockdir/slave1.sock",   path_myport   => $opt_slave_myport + 1,   start_timeout => 300,  };  $slave->[2]=  {   path_myddir   => "$opt_vardir/slave2-data",

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -