~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/test-run.pl

  • Committer: Brian Aker
  • Date: 2009-01-21 23:38:47 UTC
  • mto: This revision was merged to the branch mainline in revision 801.
  • Revision ID: brian@tangent.org-20090121233847-jzjpp910j73ch3tw
Factor test-run for binlog removal

Show diffs side-by-side

added added

removed removed

Lines of Context:
126
126
 
127
127
our $opt_usage;
128
128
our $opt_suites;
129
 
our $opt_suites_default= "main,binlog,rpl"; # Default suites to run
 
129
our $opt_suites_default= "main"; # Default suites to run
130
130
our $opt_script_debug= 0;  # Script debugging, enable with --script-debug
131
131
our $opt_verbose= 0;  # Verbose output, enable with --verbose
132
132
 
207
207
our $opt_check_testcases;
208
208
our $opt_mark_progress;
209
209
 
210
 
our $opt_skip_rpl;
 
210
our $opt_skip_rpl= 1;
211
211
our $max_slave_num= 0;
212
212
our $max_master_num= 1;
213
213
our $use_innodb;
250
250
 
251
251
our $opt_warnings;
252
252
 
253
 
our $opt_skip_master_binlog= 0;
254
 
our $opt_skip_slave_binlog= 0;
255
 
 
256
253
our $path_sql_dir;
257
254
 
258
255
our @data_dir_lst;
259
256
 
260
 
our $used_binlog_format;
261
257
our $used_default_engine;
262
258
our $debug_compiled_binaries;
263
259
 
468
464
 
469
465
             # Control what test suites or cases to run
470
466
             'force'                    => \$opt_force,
471
 
             'skip-master-binlog'       => \$opt_skip_master_binlog,
472
 
             'skip-slave-binlog'        => \$opt_skip_slave_binlog,
473
467
             'do-test=s'                => \$opt_do_test,
474
468
             'start-from=s'             => \$opt_start_from,
475
469
             'suite|suites=s'           => \$opt_suites,
704
698
  }
705
699
 
706
700
  # --------------------------------------------------------------------------
707
 
  # Find out type of logging that are being used
708
 
  # --------------------------------------------------------------------------
709
 
  if (!$opt_extern && $mysql_version_id >= 50100 )
710
 
  {
711
 
    foreach my $arg ( @opt_extra_mysqld_opt )
712
 
    {
713
 
      if ( $arg =~ /binlog[-_]format=(\S+)/ )
714
 
      {
715
 
        $used_binlog_format= $1;
716
 
      }
717
 
    }
718
 
    if (defined $used_binlog_format) 
719
 
    {
720
 
      mtr_report("Using binlog format '$used_binlog_format'");
721
 
    }
722
 
    else
723
 
    {
724
 
      mtr_report("Using dynamic switching of binlog format");
725
 
    }
726
 
  }
727
 
 
728
 
 
729
 
  # --------------------------------------------------------------------------
730
701
  # Find out default storage engine being used(if any)
731
702
  # --------------------------------------------------------------------------
732
703
  foreach my $arg ( @opt_extra_mysqld_opt )
773
744
  {
774
745
    $opt_vardir= $default_vardir;
775
746
  }
776
 
  elsif ( $mysql_version_id < 50000 and
777
 
          $opt_vardir ne $default_vardir)
778
 
  {
779
 
    # Version 4.1 and --vardir was specified
780
 
    # Only supported as a symlink from var/
781
 
    # by setting up $opt_mem that symlink will be created
782
 
    {
783
 
      # Only platforms that have native symlinks can use the vardir trick
784
 
      $opt_mem= $opt_vardir;
785
 
      mtr_report("Using 4.1 vardir trick");
786
 
    }
787
 
 
788
 
    $opt_vardir= $default_vardir;
789
 
  }
790
747
 
791
748
  $path_vardir_trace= $opt_vardir;
792
749
  # Chop off any "c:", DBUG likes a unix path ex: c:/src/... => /src/...
2085
2042
  unlink("$base_file.log");
2086
2043
  unlink("$base_file.warnings");
2087
2044
 
2088
 
  if (!$opt_extern)
2089
 
  {
2090
 
    if (defined $tinfo->{binlog_format} and  $mysql_version_id > 50100 )
2091
 
    {
2092
 
      # Dynamically switch binlog format of
2093
 
      # master, slave is always restarted
2094
 
      foreach my $server ( @$master )
2095
 
      {
2096
 
        next unless ($server->{'pid'});
2097
 
 
2098
 
        mtr_init_args(\$args);
2099
 
        mtr_add_arg($args, "--no-defaults");
2100
 
        mtr_add_arg($args, "--user=root");
2101
 
        mtr_add_arg($args, "--port=$server->{'port'}");
2102
 
 
2103
 
        my $sql= "include/set_binlog_format_".$tinfo->{binlog_format}.".sql";
2104
 
        mtr_verbose("Setting binlog format:", $tinfo->{binlog_format});
2105
 
        if (mtr_run($exe_drizzle, $args, $sql, "", "", "") != 0)
2106
 
        {
2107
 
          mtr_error("Failed to switch binlog format");
2108
 
        }
2109
 
      }
2110
 
    }
2111
 
  }
2112
2045
}
2113
2046
 
2114
2047
sub do_after_run_drizzletest($)
2523
2456
  mtr_add_arg($args, "%s--log=%s.log", $prefix, $log_base_path);
2524
2457
 
2525
2458
  # Check if "extra_opt" contains --skip-log-bin
2526
 
  my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt, @opt_extra_mysqld_opt);
2527
2459
  if ( $mysqld->{'type'} eq 'master' )
2528
2460
  {
2529
 
    if (! ($opt_skip_master_binlog || $skip_binlog) )
2530
 
    {
2531
 
      mtr_add_arg($args, "%s--log-bin=%s/log/master-bin%s", $prefix,
2532
 
                  $opt_vardir, $sidx);
2533
 
    }
2534
 
 
2535
2461
    mtr_add_arg($args, "%s--server-id=%d", $prefix,
2536
2462
               $idx > 0 ? $idx + 101 : 1);
2537
2463
 
2552
2478
    mtr_error("unknown mysqld type")
2553
2479
      unless $mysqld->{'type'} eq 'slave';
2554
2480
 
2555
 
    #mtr_add_arg($args, "%s--init-rpl-role=slave", $prefix);
2556
 
    if (! ( $opt_skip_slave_binlog || $skip_binlog ))
2557
 
    {
2558
 
      mtr_add_arg($args, "%s--log-bin=%s/log/slave%s-bin", $prefix,
2559
 
                  $opt_vardir, $sidx); # FIXME use own dir for binlogs
2560
 
      mtr_add_arg($args, "%s--log-slave-updates", $prefix);
2561
 
    }
2562
 
 
2563
 
    mtr_add_arg($args, "%s--master-retry-count=10", $prefix);
2564
 
 
2565
 
    mtr_add_arg($args, "%s--relay-log=%s/log/slave%s-relay-bin", $prefix,
2566
 
                $opt_vardir, $sidx);
2567
 
    mtr_add_arg($args, "%s--report-host=127.0.0.1", $prefix);
2568
 
    mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
2569
 
    mtr_add_arg($args, "%s--skip-slave-start", $prefix);
2570
 
 
2571
2481
    # Directory where slaves find the dumps generated by "load data"
2572
2482
    # on the server. The path need to have constant length otherwise
2573
2483
    # test results will vary, thus a relative path is used.
2574
2484
    my $slave_load_path= "../tmp";
2575
 
    mtr_add_arg($args, "%s--slave-load-tmpdir=%s", $prefix,
2576
 
                $slave_load_path);
2577
 
    mtr_add_arg($args, "%s--set-variable=slave_net_timeout=120", $prefix);
2578
2485
 
2579
2486
    if ( @$slave_master_info )
2580
2487
    {
2588
2495
      my $slave_server_id=  2 + $idx;
2589
2496
      my $slave_rpl_rank= $slave_server_id;
2590
2497
      mtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id);
2591
 
#      mtr_add_arg($args, "%s--rpl-recovery-rank=%d", $prefix, $slave_rpl_rank);
2592
2498
    }
2593
2499
  } # end slave
2594
2500
 
2621
2527
    {
2622
2528
      $found_skip_core= 1;
2623
2529
    }
2624
 
    elsif ($skip_binlog and mtr_match_prefix($arg, "--binlog-format"))
2625
 
    {
2626
 
      ; # Dont add --binlog-format when running without binlog
2627
 
    }
2628
2530
    else
2629
2531
    {
2630
2532
      mtr_add_arg($args, "%s%s", $prefix, $arg);
2828
2730
    my $diff_opts= mtr_diff_opts($master->[0]->{'start_opts'},$tinfo->{'master_opt'});
2829
2731
    if (scalar(@$diff_opts) eq 2) 
2830
2732
    {
2831
 
      $do_restart= 1 unless ($diff_opts->[0] =~/^--binlog-format=/ and $diff_opts->[1] =~/^--binlog-format=/);
 
2733
      $do_restart= 1;
2832
2734
    }
2833
2735
    else
2834
2736
    {