~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/test-run.pl

  • Committer: Brian Aker
  • Date: 2010-02-07 01:33:54 UTC
  • Revision ID: brian@gaz-20100207013354-d2pg1n68u5c09pgo
Remove giant include header to its own file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/perl
2
2
# -*- cperl -*-
3
3
 
 
4
use utf8;
 
5
 
4
6
#
5
7
##############################################################################
6
8
#
8
10
#
9
11
#  Tool used for executing a suite of .test file
10
12
#
11
 
#  See the "MySQL Test framework manual" for more information
12
 
#  http://dev.mysql.com/doc/drizzletest/en/index.html
 
13
#  For now, see the "MySQL Test framework manual" for more information
 
14
#  http://dev.mysql.com/doc/mysqltest/en/index.html
 
15
#  (as the Drizzle test environment is currently still fairly similar)
13
16
#
14
17
#  Please keep the test framework tools identical in all versions!
15
18
#
62
65
use File::Basename;
63
66
use File::Copy;
64
67
use File::Temp qw /tempdir/;
65
 
use File::Spec::Functions qw /splitdir/;
 
68
use File::Spec::Functions qw /splitdir catpath catdir
 
69
                              updir curdir splitpath rel2abs/;
66
70
use Cwd;
67
71
use Getopt::Long;
68
72
use IO::Socket;
94
98
##############################################################################
95
99
 
96
100
# Misc global variables
97
 
our $mysql_version_id;
 
101
our $drizzle_version_id;
 
102
our $glob_suite_path=             undef;
98
103
our $glob_mysql_test_dir=         undef;
99
104
our $glob_mysql_bench_dir=        undef;
100
105
our $glob_scriptname=             undef;
101
106
our $glob_timers=                 undef;
102
107
our @glob_test_mode;
103
108
 
 
109
our $glob_builddir;
 
110
 
104
111
our $glob_basedir;
105
112
 
106
 
our $path_charsetsdir;
107
113
our $path_client_bindir;
108
 
our $path_share;
109
114
our $path_timefile;
110
115
our $path_snapshot;
111
116
our $path_drizzletest_log;
115
120
our $opt_vardir;                 # A path but set directly on cmd line
116
121
our $path_vardir_trace;          # unix formatted opt_vardir for trace files
117
122
our $opt_tmpdir;                 # A path but set directly on cmd line
 
123
our $opt_suitepath;
 
124
our $opt_testdir;
118
125
 
 
126
our $opt_subunit;
119
127
 
120
128
our $default_vardir;
121
129
 
122
130
our $opt_usage;
123
131
our $opt_suites;
124
 
our $opt_suites_default= "main,binlog,rpl"; # Default suites to run
 
132
our $opt_suites_default= "main,jp"; # Default suites to run
125
133
our $opt_script_debug= 0;  # Script debugging, enable with --script-debug
126
134
our $opt_verbose= 0;  # Verbose output, enable with --verbose
127
135
 
 
136
our $opt_repeat_test= 1;
 
137
 
128
138
our $exe_master_mysqld;
129
139
our $exe_drizzle;
130
 
our $exe_drizzleadmin;
131
 
our $exe_drizzlebinlog;
132
140
our $exe_drizzle_client_test;
133
141
our $exe_bug25714;
134
142
our $exe_drizzled;
135
 
our $exe_drizzlecheck;
136
143
our $exe_drizzledump;
137
 
our $exe_mysqlslap;
 
144
our $exe_drizzleslap;
138
145
our $exe_drizzleimport;
139
146
our $exe_drizzle_fix_system_tables;
140
147
our $exe_drizzletest;
147
154
 
148
155
our $opt_bench= 0;
149
156
our $opt_small_bench= 0;
150
 
our $opt_big_test= 0;
151
157
 
152
158
our @opt_combinations;
153
159
our $opt_skip_combination;
159
165
our $opt_debug;
160
166
our $opt_do_test;
161
167
our @opt_cases;                  # The test cases names in argv
 
168
our $opt_engine;
162
169
 
163
170
our $opt_extern= 0;
164
171
our $opt_socket;
175
182
 
176
183
our $glob_debugger= 0;
177
184
our $opt_gdb;
 
185
our $opt_dbx;
178
186
our $opt_client_gdb;
 
187
our $opt_client_dbx;
 
188
our $opt_dbx_gdb;
179
189
our $opt_ddd;
180
190
our $opt_client_ddd;
181
191
our $opt_manual_gdb;
 
192
our $opt_manual_dbx;
182
193
our $opt_manual_ddd;
183
194
our $opt_manual_debug;
184
 
our $opt_mtr_build_thread=0;
 
195
# Magic number -69.4 results in traditional test ports starting from 9306.
 
196
our $opt_mtr_build_thread=-69.4;
185
197
our $opt_debugger;
186
198
our $opt_client_debugger;
187
199
 
196
208
 
197
209
our $opt_master_myport;
198
210
our $opt_slave_myport;
 
211
our $opt_memc_myport;
199
212
our $opt_record;
200
213
my $opt_report_features;
201
214
our $opt_check_testcases;
202
215
our $opt_mark_progress;
203
216
 
204
 
our $opt_skip_rpl;
 
217
our $opt_skip_rpl= 1;
205
218
our $max_slave_num= 0;
206
219
our $max_master_num= 1;
207
220
our $use_innodb;
231
244
my @valgrind_args;
232
245
my $opt_valgrind_path;
233
246
my $opt_callgrind;
 
247
my $opt_massif;
234
248
 
235
249
our $opt_stress=               "";
236
250
our $opt_stress_suite=     "main";
244
258
 
245
259
our $opt_warnings;
246
260
 
247
 
our $opt_skip_master_binlog= 0;
248
 
our $opt_skip_slave_binlog= 0;
249
 
 
250
261
our $path_sql_dir;
251
262
 
252
263
our @data_dir_lst;
253
264
 
254
 
our $used_binlog_format;
255
265
our $used_default_engine;
256
266
our $debug_compiled_binaries;
257
267
 
261
271
 
262
272
our $opt_max_save_core= 5;
263
273
my $num_saved_cores= 0;  # Number of core files saved in vardir/log/ so far.
 
274
our $mysql_port_offset= 50;
264
275
 
265
276
######################################################################
266
277
#
295
306
sub mysqld_arguments ($$$$);
296
307
sub stop_all_servers ();
297
308
sub run_drizzletest ($);
 
309
sub collapse_path ($);
298
310
sub usage ($);
299
311
 
300
312
 
420
432
 
421
433
  my $opt_comment;
422
434
 
423
 
  # Magic number -69.4 results in traditional test ports starting from 9306.
424
 
  set_mtr_build_thread_ports(-69.4);
425
 
 
426
435
  # If so requested, we try to avail ourselves of a unique build thread number.
427
436
  if ( $ENV{'MTR_BUILD_THREAD'} ) {
428
437
    if ( lc($ENV{'MTR_BUILD_THREAD'}) eq 'auto' ) {
464
473
 
465
474
             # Control what test suites or cases to run
466
475
             'force'                    => \$opt_force,
467
 
             'skip-master-binlog'       => \$opt_skip_master_binlog,
468
 
             'skip-slave-binlog'        => \$opt_skip_slave_binlog,
469
476
             'do-test=s'                => \$opt_do_test,
470
477
             'start-from=s'             => \$opt_start_from,
471
478
             'suite|suites=s'           => \$opt_suites,
472
479
             'skip-rpl'                 => \$opt_skip_rpl,
473
480
             'skip-test=s'              => \$opt_skip_test,
474
 
             'big-test'                 => \$opt_big_test,
475
481
             'combination=s'            => \@opt_combinations,
476
482
             'skip-combination'         => \$opt_skip_combination,
477
483
 
478
484
             # Specify ports
479
485
             'master_port=i'            => \$opt_master_myport,
480
486
             'slave_port=i'             => \$opt_slave_myport,
 
487
             'memc_port=i'              => \$opt_memc_myport,
481
488
             'mtr-build-thread=i'       => \$opt_mtr_build_thread,
482
489
 
483
490
             # Test case authoring
487
494
 
488
495
             # Extra options used when starting mysqld
489
496
             'mysqld=s'                 => \@opt_extra_mysqld_opt,
 
497
             'engine=s'                 => \$opt_engine,
490
498
 
491
499
             # Run test on running server
492
500
             'extern'                   => \$opt_extern,
493
501
 
 
502
             # Output format
 
503
             'subunit'                  => \$opt_subunit,
 
504
 
494
505
             # Debugging
495
506
             'gdb'                      => \$opt_gdb,
 
507
             'dbx'                      => \$opt_dbx,
496
508
             'client-gdb'               => \$opt_client_gdb,
 
509
             'client-dbx'               => \$opt_client_dbx,
497
510
             'manual-gdb'               => \$opt_manual_gdb,
 
511
             'manual-dbx'               => \$opt_manual_dbx,
498
512
             'manual-debug'             => \$opt_manual_debug,
499
513
             'ddd'                      => \$opt_ddd,
500
514
             'client-ddd'               => \$opt_client_ddd,
526
540
             'valgrind-option=s'        => \@valgrind_args,
527
541
             'valgrind-path=s'          => \$opt_valgrind_path,
528
542
             'callgrind'                => \$opt_callgrind,
 
543
             'massif'                   => \$opt_massif,
529
544
 
530
545
             # Stress testing 
531
546
             'stress'                   => \$opt_stress,
541
556
             # Directories
542
557
             'tmpdir=s'                 => \$opt_tmpdir,
543
558
             'vardir=s'                 => \$opt_vardir,
 
559
             'suitepath=s'              => \$opt_suitepath,
 
560
             'testdir=s'                => \$opt_testdir,
544
561
             'benchdir=s'               => \$glob_mysql_bench_dir,
545
562
             'mem'                      => \$opt_mem,
546
563
 
562
579
             'testcase-timeout=i'       => \$opt_testcase_timeout,
563
580
             'suite-timeout=i'          => \$opt_suite_timeout,
564
581
             'warnings|log-warnings'    => \$opt_warnings,
 
582
             'repeat-test=i'            => \$opt_repeat_test,
565
583
 
566
584
             # Options which are no longer used
567
585
             (map { $_ => \&warn_about_removed_option } @removed_options),
571
589
 
572
590
  usage("") if $opt_usage;
573
591
 
 
592
  usage("you cannot specify --gdb and --dbx both!") if 
 
593
        ($opt_gdb && $opt_dbx) ||
 
594
        ($opt_manual_gdb && $opt_manual_dbx);
 
595
 
574
596
  $glob_scriptname=  basename($0);
575
597
 
576
598
  if ($opt_mtr_build_thread != 0)
582
604
    $opt_mtr_build_thread= $ENV{'MTR_BUILD_THREAD'};
583
605
  }
584
606
 
585
 
  # We require that we are in the "mysql-test" directory
586
 
  # to run drizzle-test-run
587
 
  if (! -f $glob_scriptname)
588
 
  {
589
 
    mtr_error("Can't find the location for the drizzle-test-run script\n" .
590
 
              "Go to to the mysql-test directory and execute the script " .
591
 
              "as follows:\n./$glob_scriptname");
592
 
  }
593
 
 
594
607
  if ( -d "../drizzled" )
595
608
  {
596
609
    $source_dist=  1;
597
610
  }
598
611
 
599
612
  # Find the absolute path to the test directory
600
 
  $glob_mysql_test_dir=  cwd();
 
613
  if ( ! $opt_testdir )
 
614
  {
 
615
    $glob_mysql_test_dir=  cwd();
 
616
  } 
 
617
  else
 
618
  {
 
619
    $glob_mysql_test_dir= $opt_testdir;
 
620
  }
601
621
  $default_vardir= "$glob_mysql_test_dir/var";
602
622
 
 
623
  if ( ! $opt_suitepath )
 
624
  {
 
625
    $glob_suite_path= "$glob_mysql_test_dir/../plugin";
 
626
  }
 
627
  else
 
628
  {
 
629
    $glob_suite_path= $opt_suitepath;
 
630
  }
603
631
  # In most cases, the base directory we find everything relative to,
604
632
  # is the parent directory of the "mysql-test" directory. For source
605
633
  # distributions, TAR binary distributions and some other packages.
615
643
    $glob_basedir= dirname($glob_basedir);
616
644
  }
617
645
 
 
646
  if ( $opt_testdir and -d $opt_testdir and $opt_vardir and -d $opt_vardir
 
647
         and -f "$opt_vardir/../../drizzled/drizzled")
 
648
  {
 
649
    # probably in a VPATH build
 
650
    $glob_builddir= "$opt_vardir/../..";
 
651
  }
 
652
  else
 
653
  {
 
654
    $glob_builddir="..";
 
655
  }
 
656
 
618
657
  # Expect mysql-bench to be located adjacent to the source tree, by default
619
658
  $glob_mysql_bench_dir= "$glob_basedir/../mysql-bench"
620
659
    unless defined $glob_mysql_bench_dir;
632
671
  #
633
672
 
634
673
  # Look for the client binaries directory
635
 
  $path_client_bindir= mtr_path_exists("$glob_basedir/client",
 
674
  $path_client_bindir= mtr_path_exists("$glob_builddir/client",
 
675
                                       "$glob_basedir/client",
636
676
                                       "$glob_basedir/bin");
637
677
 
638
 
  # Look for charsetsdir, use same share
639
 
  $path_share=      mtr_path_exists("$glob_basedir/share/mysql",
640
 
                                    "$glob_basedir/drizzled/share",
641
 
                                    "$glob_basedir/share");
642
 
 
643
 
  $path_charsetsdir=   mtr_path_exists("$path_share/charsets");
644
 
 
645
 
 
646
 
 
647
678
  if (!$opt_extern)
648
679
  {
649
680
    $exe_drizzled=       mtr_exe_exists ("$glob_basedir/drizzled/drizzled",
650
681
                                       "$path_client_bindir/drizzled",
651
682
                                       "$glob_basedir/libexec/drizzled",
652
683
                                       "$glob_basedir/bin/drizzled",
653
 
                                       "$glob_basedir/sbin/drizzled");
 
684
                                       "$glob_basedir/sbin/drizzled",
 
685
                                       "$glob_builddir/drizzled/drizzled");
654
686
 
655
687
    # Use the mysqld found above to find out what features are available
656
688
    collect_mysqld_features();
660
692
    $mysqld_variables{'port'}= 4427;
661
693
  }
662
694
 
 
695
  if (!$opt_engine)
 
696
  {
 
697
    $opt_engine= "innodb";
 
698
  }
 
699
 
663
700
  if ( $opt_comment )
664
701
  {
665
702
    print "\n";
691
728
  }
692
729
 
693
730
  # --------------------------------------------------------------------------
694
 
  # Find out type of logging that are being used
695
 
  # --------------------------------------------------------------------------
696
 
  if (!$opt_extern && $mysql_version_id >= 50100 )
697
 
  {
698
 
    foreach my $arg ( @opt_extra_mysqld_opt )
699
 
    {
700
 
      if ( $arg =~ /binlog[-_]format=(\S+)/ )
701
 
      {
702
 
        $used_binlog_format= $1;
703
 
      }
704
 
    }
705
 
    if (defined $used_binlog_format) 
706
 
    {
707
 
      mtr_report("Using binlog format '$used_binlog_format'");
708
 
    }
709
 
    else
710
 
    {
711
 
      mtr_report("Using dynamic switching of binlog format");
712
 
    }
713
 
  }
714
 
 
715
 
 
716
 
  # --------------------------------------------------------------------------
717
731
  # Find out default storage engine being used(if any)
718
732
  # --------------------------------------------------------------------------
719
733
  foreach my $arg ( @opt_extra_mysqld_opt )
760
774
  {
761
775
    $opt_vardir= $default_vardir;
762
776
  }
763
 
  elsif ( $mysql_version_id < 50000 and
764
 
          $opt_vardir ne $default_vardir)
765
 
  {
766
 
    # Version 4.1 and --vardir was specified
767
 
    # Only supported as a symlink from var/
768
 
    # by setting up $opt_mem that symlink will be created
769
 
    {
770
 
      # Only platforms that have native symlinks can use the vardir trick
771
 
      $opt_mem= $opt_vardir;
772
 
      mtr_report("Using 4.1 vardir trick");
773
 
    }
774
 
 
775
 
    $opt_vardir= $default_vardir;
776
 
  }
777
777
 
778
778
  $path_vardir_trace= $opt_vardir;
779
779
  # Chop off any "c:", DBUG likes a unix path ex: c:/src/... => /src/...
780
780
  $path_vardir_trace=~ s/^\w://;
781
781
 
782
 
  # We make the path absolute, as the server will do a chdir() before usage
783
 
  unless ( $opt_vardir =~ m,^/,)
784
 
  {
785
 
    # Make absolute path, relative test dir
786
 
    $opt_vardir= "$glob_mysql_test_dir/$opt_vardir";
787
 
  }
 
782
  $opt_vardir= collapse_path($opt_vardir);
788
783
 
789
784
  # --------------------------------------------------------------------------
790
785
  # Set tmpdir
814
809
  }
815
810
 
816
811
  # --------------------------------------------------------------------------
817
 
  # Big test flags
818
 
  # --------------------------------------------------------------------------
819
 
   if ( $opt_big_test )
820
 
   {
821
 
     $ENV{'BIG_TEST'}= 1;
822
 
   }
823
 
 
824
 
  # --------------------------------------------------------------------------
825
812
  # Gcov flag
826
813
  # --------------------------------------------------------------------------
827
814
  if ( $opt_gcov and ! $source_dist )
834
821
  # --------------------------------------------------------------------------
835
822
  if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
836
823
       $opt_manual_gdb || $opt_manual_ddd || $opt_manual_debug ||
837
 
       $opt_debugger || $opt_client_debugger )
 
824
       $opt_debugger || $opt_client_debugger || $opt_gdb || $opt_manual_gdb)
838
825
  {
839
826
    # Indicate that we are using debugger
840
827
    $glob_debugger= 1;
882
869
      unless @valgrind_args;
883
870
  }
884
871
 
 
872
  if ( $opt_massif )
 
873
  {
 
874
    mtr_report("Valgrind with Massif tool for drizzled(s)");
 
875
    $opt_valgrind= 1;
 
876
    $opt_valgrind_mysqld= 1;
 
877
  }
 
878
 
885
879
  if ( $opt_valgrind )
886
880
  {
887
881
    # Set valgrind_options to default unless already defined
937
931
   path_pid      => "$opt_vardir/run/master.pid",
938
932
   path_sock     => "$sockdir/master.sock",
939
933
   port          =>  $opt_master_myport,
 
934
   mysql_port    =>  $opt_master_myport + $mysql_port_offset,
940
935
   start_timeout =>  400, # enough time create innodb tables
941
936
   cluster       =>  0, # index in clusters list
942
937
   start_opts    => [],
952
947
   path_pid      => "$opt_vardir/run/master1.pid",
953
948
   path_sock     => "$sockdir/master1.sock",
954
949
   port          => $opt_master_myport + 1,
 
950
   mysql_port    => $opt_master_myport + 1 + $mysql_port_offset,
955
951
   start_timeout => 400, # enough time create innodb tables
956
952
   cluster       =>  0, # index in clusters list
957
953
   start_opts    => [],
964
960
   idx           => 0,
965
961
   path_myddir   => "$opt_vardir/slave-data",
966
962
   path_myerr    => "$opt_vardir/log/slave.err",
967
 
   path_pid    => "$opt_vardir/run/slave.pid",
968
 
   path_sock   => "$sockdir/slave.sock",
969
 
   port   => $opt_slave_myport,
 
963
   path_pid      => "$opt_vardir/run/slave.pid",
 
964
   path_sock     => "$sockdir/slave.sock",
 
965
   port          => $opt_slave_myport,
 
966
   mysql_port    => $opt_slave_myport + $mysql_port_offset,
970
967
   start_timeout => 400,
971
968
 
972
969
   cluster       =>  1, # index in clusters list
980
977
   idx           => 1,
981
978
   path_myddir   => "$opt_vardir/slave1-data",
982
979
   path_myerr    => "$opt_vardir/log/slave1.err",
983
 
   path_pid    => "$opt_vardir/run/slave1.pid",
984
 
   path_sock   => "$sockdir/slave1.sock",
985
 
   port   => $opt_slave_myport + 1,
 
980
   path_pid      => "$opt_vardir/run/slave1.pid",
 
981
   path_sock     => "$sockdir/slave1.sock",
 
982
   port          => $opt_slave_myport + 1,
 
983
   mysql_port    => $opt_slave_myport + 1 + $mysql_port_offset,
986
984
   start_timeout => 300,
987
985
   cluster       =>  -1, # index in clusters list
988
986
   start_opts    => [],
995
993
   idx           => 2,
996
994
   path_myddir   => "$opt_vardir/slave2-data",
997
995
   path_myerr    => "$opt_vardir/log/slave2.err",
998
 
   path_pid    => "$opt_vardir/run/slave2.pid",
999
 
   path_sock   => "$sockdir/slave2.sock",
1000
 
   port   => $opt_slave_myport + 2,
 
996
   path_pid      => "$opt_vardir/run/slave2.pid",
 
997
   path_sock     => "$sockdir/slave2.sock",
 
998
   port          => $opt_slave_myport + 2,
 
999
   mysql_port    => $opt_slave_myport + 2 + $mysql_port_offset,
1001
1000
   start_timeout => 300,
1002
1001
   cluster       =>  -1, # index in clusters list
1003
1002
   start_opts    => [],
1069
1068
    print "got ".$mtr_build_thread."\n";
1070
1069
  }
1071
1070
 
 
1071
  $mtr_build_thread= (($mtr_build_thread * 10) % 2000) - 1000;
 
1072
 
1072
1073
  # Up to two masters, up to three slaves
1073
1074
  # A magic value in command_line_setup depends on these equations.
1074
 
  $opt_master_myport=         $mtr_build_thread * 10 + 10000; # and 1
 
1075
  $opt_master_myport=         $mtr_build_thread + 9000; # and 1
1075
1076
  $opt_slave_myport=          $opt_master_myport + 2;  # and 3 4
 
1077
  $opt_memc_myport= $opt_master_myport + 10;
1076
1078
 
1077
1079
  if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 )
1078
1080
  {
1123
1125
  foreach my $line (split('\n', $list))
1124
1126
  {
1125
1127
    # First look for version
1126
 
    if ( !$mysql_version_id )
 
1128
    if ( !$drizzle_version_id )
1127
1129
    {
1128
1130
      # Look for version
1129
1131
      my $exe_name= basename($exe_drizzled);
1131
1133
      if ( $line =~ /^\S*$exe_name\s\sVer\s([0-9]*)\.([0-9]*)\.([0-9]*)/ )
1132
1134
      {
1133
1135
        #print "Major: $1 Minor: $2 Build: $3\n";
1134
 
        $mysql_version_id= $1*10000 + $2*100 + $3;
1135
 
        #print "mysql_version_id: $mysql_version_id\n";
1136
 
        mtr_report("MySQL Version $1.$2.$3");
 
1136
        $drizzle_version_id= $1*10000 + $2*100 + $3;
 
1137
        #print "drizzle_version_id: $drizzle_version_id\n";
 
1138
        mtr_report("Drizzle Version $1.$2.$3");
1137
1139
      }
1138
1140
    }
1139
1141
    else
1174
1176
    }
1175
1177
  }
1176
1178
  rmtree($tmpdir);
1177
 
  mtr_error("Could not find version of MySQL") unless $mysql_version_id;
 
1179
  mtr_error("Could not find version of Drizzle") unless $drizzle_version_id;
1178
1180
  mtr_error("Could not find variabes list") unless $found_variable_list_start;
1179
1181
 
1180
1182
}
1187
1189
  mtr_init_args(\$args);
1188
1190
 
1189
1191
  mtr_add_arg($args, "--no-defaults");
 
1192
  mtr_add_arg($args, "--skip-stack-trace");
1190
1193
  mtr_add_arg($args, "--user=%s", $opt_user);
1191
1194
  mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
1192
1195
  mtr_add_arg($args, "--silent"); # Tab separated output
1234
1237
  $exe_my_print_defaults=
1235
1238
    mtr_exe_exists(
1236
1239
        "$path_client_bindir/my_print_defaults",
1237
 
        "$glob_basedir/extra/my_print_defaults");
 
1240
        "$glob_basedir/extra/my_print_defaults",
 
1241
        "$glob_builddir/extra/my_print_defaults");
1238
1242
 
1239
1243
# Look for perror
1240
1244
  $exe_perror= "perror";
1241
1245
 
1242
1246
# Look for the client binaries
1243
 
  $exe_drizzlecheck= mtr_exe_exists("$path_client_bindir/drizzlecheck");
1244
1247
  $exe_drizzledump= mtr_exe_exists("$path_client_bindir/drizzledump");
1245
1248
  $exe_drizzleimport= mtr_exe_exists("$path_client_bindir/drizzleimport");
1246
 
  $exe_drizzlebinlog= mtr_exe_exists("$path_client_bindir/drizzlebinlog");
1247
 
  $exe_drizzleadmin= mtr_exe_exists("$path_client_bindir/drizzleadmin");
1248
1249
  $exe_drizzle=          mtr_exe_exists("$path_client_bindir/drizzle");
1249
1250
 
1250
1251
  if (!$opt_extern)
1251
1252
  {
1252
1253
# Look for SQL scripts directory
1253
 
    if ( $mysql_version_id >= 50100 )
1254
 
    {
1255
 
      $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
1256
 
    }
 
1254
     if ( $drizzle_version_id >= 50100 )
 
1255
     {
 
1256
         $exe_drizzleslap= mtr_exe_exists("$path_client_bindir/drizzleslap");
 
1257
     }
1257
1258
  }
1258
1259
 
1259
1260
# Look for drizzletest executable
1283
1284
  my($mysqld) = @_;
1284
1285
  return
1285
1286
    mtr_native_path($exe_drizzledump) .
1286
 
      " --no-defaults -uroot --debug-check " .
 
1287
      " --no-defaults -uroot " .
1287
1288
      "--port=$mysqld->{'port'} ";
1288
1289
}
1289
1290
 
1311
1312
  mtr_add_arg($args, "--user=root");
1312
1313
  mtr_add_arg($args, "--port=$master->[0]->{'port'}");
1313
1314
 
1314
 
  if ( $opt_extern || $mysql_version_id >= 50000 )
 
1315
  if ( $opt_extern || $drizzle_version_id >= 50000 )
1315
1316
  {
1316
1317
    mtr_add_arg($args, "--vardir=$opt_vardir")
1317
1318
  }
1340
1341
  # --------------------------------------------------------------------------
1341
1342
  if ( $source_dist )
1342
1343
  {
1343
 
    push(@ld_library_paths, "$glob_basedir/libmysql/.libs/",
1344
 
                            "$glob_basedir/libmysql_r/.libs/",
1345
 
                            "$glob_basedir/zlib.libs/");
 
1344
    push(@ld_library_paths, "$glob_basedir/libdrizzleclient/.libs/",
 
1345
                            "$glob_basedir/mysys/.libs/",
 
1346
                            "$glob_basedir/mystrings/.libs/",
 
1347
                            "$glob_basedir/drizzled/.libs/",
 
1348
                            "/usr/local/lib");
1346
1349
  }
1347
1350
  else
1348
1351
  {
1369
1372
    push(@ld_library_paths, $debug_libraries_path);
1370
1373
  }
1371
1374
 
1372
 
  $ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths,
 
1375
  $ENV{'LD_LIBRARY_PATH'}= join(":", 
1373
1376
                                $ENV{'LD_LIBRARY_PATH'} ?
1374
 
                                split(':', $ENV{'LD_LIBRARY_PATH'}) : ());
 
1377
                                split(':', $ENV{'LD_LIBRARY_PATH'}) : (),
 
1378
                                @ld_library_paths);
1375
1379
  mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}");
1376
1380
 
1377
1381
  $ENV{'DYLD_LIBRARY_PATH'}= join(":", @ld_library_paths,
1395
1399
  # Also command lines in .opt files may contain env vars
1396
1400
  # --------------------------------------------------------------------------
1397
1401
 
1398
 
  $ENV{'CHARSETSDIR'}=              $path_charsetsdir;
 
1402
  $ENV{'CHARSETSDIR'}=              "";
1399
1403
  $ENV{'UMASK'}=              "0660"; # The octal *string*
1400
1404
  $ENV{'UMASK_DIR'}=          "0770"; # The octal *string*
1401
1405
  
1412
1416
  
1413
1417
  $ENV{'LC_COLLATE'}=         "C";
1414
1418
  $ENV{'USE_RUNNING_SERVER'}= $opt_extern;
1415
 
  $ENV{'DRIZZLE_TEST_DIR'}=     $glob_mysql_test_dir;
 
1419
  $ENV{'DRIZZLE_TEST_DIR'}=     collapse_path($glob_mysql_test_dir);
1416
1420
  $ENV{'MYSQLTEST_VARDIR'}=   $opt_vardir;
1417
1421
  $ENV{'DRIZZLE_TMP_DIR'}=      $opt_tmpdir;
1418
1422
  $ENV{'MASTER_MYSOCK'}=      $master->[0]->{'path_sock'};
1423
1427
  $ENV{'SLAVE_MYPORT'}=       $slave->[0]->{'port'};
1424
1428
  $ENV{'SLAVE_MYPORT1'}=      $slave->[1]->{'port'};
1425
1429
  $ENV{'SLAVE_MYPORT2'}=      $slave->[2]->{'port'};
 
1430
  $ENV{'MC_PORT'}=            $opt_memc_myport;
1426
1431
  $ENV{'DRIZZLE_TCP_PORT'}=     $mysqld_variables{'port'};
1427
1432
 
1428
 
  $ENV{MTR_BUILD_THREAD}=      $opt_mtr_build_thread;
 
1433
  $ENV{'MTR_BUILD_THREAD'}=      $opt_mtr_build_thread;
1429
1434
 
1430
1435
  $ENV{'EXE_MYSQL'}=          $exe_drizzle;
1431
1436
 
1432
 
  # ----------------------------------------------------
1433
 
  # Setup env so childs can execute mysqlcheck
1434
 
  # ----------------------------------------------------
1435
 
  my $cmdline_mysqlcheck=
1436
 
    mtr_native_path($exe_drizzlecheck) .
1437
 
    " --no-defaults --debug-check -uroot " .
1438
 
    "--port=$master->[0]->{'port'} ";
1439
 
 
1440
 
  if ( $opt_debug )
1441
 
  {
1442
 
    $cmdline_mysqlcheck .=
1443
 
      " --debug=d:t:A,$path_vardir_trace/log/mysqlcheck.trace";
1444
 
  }
1445
 
  $ENV{'DRIZZLE_CHECK'}=              $cmdline_mysqlcheck;
1446
1437
 
1447
1438
  # ----------------------------------------------------
1448
1439
  # Setup env to childs can execute myqldump
1449
1440
  # ----------------------------------------------------
1450
1441
  my $cmdline_mysqldump= generate_cmdline_mysqldump($master->[0]);
1451
1442
  my $cmdline_mysqldumpslave= generate_cmdline_mysqldump($slave->[0]);
 
1443
  my $cmdline_mysqldumpmysql= mtr_native_path($exe_drizzledump) .
 
1444
       " --no-defaults -uroot " .
 
1445
       "--mysql --port=$master->[0]->{'mysql_port'} ";
1452
1446
 
1453
1447
  if ( $opt_debug )
1454
1448
  {
1456
1450
      " --debug=d:t:A,$path_vardir_trace/log/mysqldump-master.trace";
1457
1451
    $cmdline_mysqldumpslave .=
1458
1452
      " --debug=d:t:A,$path_vardir_trace/log/mysqldump-slave.trace";
 
1453
    $cmdline_mysqldumpmysql .=
 
1454
      " --debug=d:t:A,$path_vardir_trace/log/mysqldump-mysql.trace";
1459
1455
  }
1460
1456
  $ENV{'DRIZZLE_DUMP'}= $cmdline_mysqldump;
1461
1457
  $ENV{'DRIZZLE_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
1462
 
 
 
1458
  $ENV{'DRIZZLE_DUMP_MYSQL'}= $cmdline_mysqldumpmysql;
1463
1459
 
1464
1460
  # ----------------------------------------------------
1465
1461
  # Setup env so childs can execute mysqlslap
1466
1462
  # ----------------------------------------------------
1467
 
  if ( $exe_mysqlslap )
 
1463
  if ( $exe_drizzleslap )
1468
1464
  {
1469
 
    my $cmdline_mysqlslap=
1470
 
      mtr_native_path($exe_mysqlslap) .
 
1465
    my $cmdline_drizzleslap=
 
1466
      mtr_native_path($exe_drizzleslap) .
1471
1467
      " -uroot " .
1472
1468
      "--port=$master->[0]->{'port'} ";
 
1469
    my $cmdline_drizzleslapmysql=
 
1470
      mtr_native_path($exe_drizzleslap) .
 
1471
      " -uroot " .
 
1472
      "--mysql --port=$master->[0]->{'mysql_port'} ";
1473
1473
 
1474
1474
    if ( $opt_debug )
1475
1475
   {
1476
 
      $cmdline_mysqlslap .=
1477
 
        " --debug=d:t:A,$path_vardir_trace/log/mysqlslap.trace";
 
1476
      $cmdline_drizzleslap .=
 
1477
        " --debug=d:t:A,$path_vardir_trace/log/drizzleslap.trace";
 
1478
      $cmdline_drizzleslapmysql .=
 
1479
        " --debug=d:t:A,$path_vardir_trace/log/drizzleslap.trace";
1478
1480
    }
1479
 
    $ENV{'DRIZZLE_SLAP'}= $cmdline_mysqlslap;
 
1481
    $ENV{'DRIZZLE_SLAP'}= $cmdline_drizzleslap;
 
1482
    $ENV{'DRIZZLE_SLAP_MYSQL'}= $cmdline_drizzleslapmysql;
1480
1483
  }
1481
1484
 
 
1485
 
 
1486
 
1482
1487
  # ----------------------------------------------------
1483
1488
  # Setup env so childs can execute mysqlimport
1484
1489
  # ----------------------------------------------------
1485
1490
  my $cmdline_mysqlimport=
1486
1491
    mtr_native_path($exe_drizzleimport) .
1487
 
    " -uroot --debug-check " .
 
1492
    " -uroot " .
1488
1493
    "--port=$master->[0]->{'port'} ";
1489
1494
 
1490
1495
  if ( $opt_debug )
1496
1501
 
1497
1502
 
1498
1503
  # ----------------------------------------------------
1499
 
  # Setup env so childs can execute mysqlbinlog
1500
 
  # ----------------------------------------------------
1501
 
  my $cmdline_mysqlbinlog=
1502
 
    mtr_native_path($exe_drizzlebinlog) .
1503
 
      " --no-defaults --disable-force-if-open --debug-check";
1504
 
  if ( !$opt_extern && $mysql_version_id >= 50000 )
1505
 
  {
1506
 
    $cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
1507
 
  }
1508
 
 
1509
 
  if ( $opt_debug )
1510
 
  {
1511
 
    $cmdline_mysqlbinlog .=
1512
 
      " --debug=d:t:A,$path_vardir_trace/log/mysqlbinlog.trace";
1513
 
  }
1514
 
  $ENV{'DRIZZLE_BINLOG'}= $cmdline_mysqlbinlog;
1515
 
 
1516
 
  # ----------------------------------------------------
1517
1504
  # Setup env so childs can execute mysql
1518
1505
  # ----------------------------------------------------
1519
1506
  my $cmdline_mysql=
1520
1507
    mtr_native_path($exe_drizzle) .
1521
 
    " --no-defaults --debug-check --host=localhost  --user=root --password= " .
1522
 
    "--port=$master->[0]->{'port'} " .
1523
 
    "--character-sets-dir=$path_charsetsdir";
 
1508
    " --no-defaults --host=localhost  --user=root --password= " .
 
1509
    "--port=$master->[0]->{'port'} ";
 
1510
  my $cmdline_drizzlemysql=
 
1511
    mtr_native_path($exe_drizzle) .
 
1512
    " --no-defaults --host=localhost  --user=root --password= " .
 
1513
    "--mysql --port=$master->[0]->{'mysql_port'} ";
1524
1514
 
1525
1515
  $ENV{'MYSQL'}= $cmdline_mysql;
 
1516
  $ENV{'DRIZZLE_MYSQL'}= $cmdline_drizzlemysql;
1526
1517
 
1527
1518
  # ----------------------------------------------------
1528
1519
  # Setup env so childs can execute bug25714
1556
1547
  $ENV{'DRIZZLE_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults);
1557
1548
 
1558
1549
  # ----------------------------------------------------
1559
 
  # Setup env so childs can execute mysqladmin
 
1550
  # Setup env so childs can shutdown the server
1560
1551
  # ----------------------------------------------------
1561
 
  $ENV{'MYSQLADMIN'}= mtr_native_path($exe_drizzleadmin);
 
1552
  $ENV{'DRIZZLED_SHUTDOWN'}= mtr_native_path($exe_drizzle);
1562
1553
 
1563
1554
  # ----------------------------------------------------
1564
1555
  # Setup env so childs can execute perror  
1596
1587
    print "Using SLAVE_MYPORT          = $ENV{SLAVE_MYPORT}\n";
1597
1588
    print "Using SLAVE_MYPORT1         = $ENV{SLAVE_MYPORT1}\n";
1598
1589
    print "Using SLAVE_MYPORT2         = $ENV{SLAVE_MYPORT2}\n";
 
1590
    print "Using MC_PORT               = $ENV{MC_PORT}\n";
1599
1591
  }
1600
1592
 
1601
1593
  # Create an environment variable to make it possible
1789
1781
  }
1790
1782
 
1791
1783
  # Make a link std_data_ln in var/ that points to std_data
1792
 
  symlink("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln");
 
1784
  symlink(collapse_path("$glob_mysql_test_dir/std_data"),
 
1785
          "$opt_vardir/std_data_ln");
1793
1786
 
1794
1787
  # Remove old log files
1795
1788
  foreach my $name (glob("r/*.progress r/*.log r/*.warnings"))
1796
1789
  {
1797
1790
    unlink($name);
1798
1791
  }
 
1792
  system("chmod -R ugo+r $opt_vardir");
 
1793
  system("chmod -R ugo+r $opt_vardir/std_data_ln/*");
1799
1794
}
1800
1795
 
1801
1796
 
1886
1881
 
1887
1882
  if ( ! $benchmark )
1888
1883
  {
1889
 
    mtr_add_arg($args, "--log");
1890
1884
    mtr_run("$glob_mysql_bench_dir/run-all-tests", $args, "", "", "", "");
1891
1885
    # FIXME check result code?!
1892
1886
  }
1927
1921
 
1928
1922
  foreach my $tinfo ( @$tests )
1929
1923
  {
1930
 
    if (run_testcase_check_skip_test($tinfo))
 
1924
    foreach(1..$opt_repeat_test)
1931
1925
    {
1932
 
      next;
 
1926
      if (run_testcase_check_skip_test($tinfo))
 
1927
        {
 
1928
          next;
 
1929
        }
 
1930
 
 
1931
      mtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout);
 
1932
      run_testcase($tinfo);
 
1933
      mtr_timer_stop($glob_timers,"testcase");
1933
1934
    }
1934
 
 
1935
 
    mtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout);
1936
 
    run_testcase($tinfo);
1937
 
    mtr_timer_stop($glob_timers,"testcase");
1938
1935
  }
1939
1936
 
1940
1937
  mtr_print_line();
2092
2089
  unlink("$base_file.log");
2093
2090
  unlink("$base_file.warnings");
2094
2091
 
2095
 
  if (!$opt_extern)
2096
 
  {
2097
 
    if (defined $tinfo->{binlog_format} and  $mysql_version_id > 50100 )
2098
 
    {
2099
 
      # Dynamically switch binlog format of
2100
 
      # master, slave is always restarted
2101
 
      foreach my $server ( @$master )
2102
 
      {
2103
 
        next unless ($server->{'pid'});
2104
 
 
2105
 
        mtr_init_args(\$args);
2106
 
        mtr_add_arg($args, "--no-defaults");
2107
 
        mtr_add_arg($args, "--user=root");
2108
 
        mtr_add_arg($args, "--port=$server->{'port'}");
2109
 
 
2110
 
        my $sql= "include/set_binlog_format_".$tinfo->{binlog_format}.".sql";
2111
 
        mtr_verbose("Setting binlog format:", $tinfo->{binlog_format});
2112
 
        if (mtr_run($exe_drizzle, $args, $sql, "", "", "") != 0)
2113
 
        {
2114
 
          mtr_error("Failed to switch binlog format");
2115
 
        }
2116
 
      }
2117
 
    }
2118
 
  }
2119
2092
}
2120
2093
 
2121
2094
sub do_after_run_drizzletest($)
2488
2461
 
2489
2462
  mtr_add_arg($args, "%s--no-defaults", $prefix);
2490
2463
 
 
2464
  $path_my_basedir= collapse_path($path_my_basedir);
2491
2465
  mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir);
2492
 
  mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir);
2493
 
 
2494
 
  if ( $mysql_version_id >= 50036)
 
2466
 
 
2467
  if ($opt_engine)
 
2468
  {
 
2469
    mtr_add_arg($args, "%s--default-storage-engine=%s", $prefix, $opt_engine);
 
2470
  }
 
2471
 
 
2472
  if ( $drizzle_version_id >= 50036)
2495
2473
  {
2496
2474
    # By default, prevent the started mysqld to access files outside of vardir
2497
2475
    mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir);
2498
2476
  }
2499
2477
 
2500
 
  if ( $mysql_version_id >= 50000 )
2501
 
  {
2502
 
    mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
2503
 
  }
2504
 
 
2505
 
  mtr_add_arg($args, "%s--default-character-set=latin1", $prefix);
2506
2478
  mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
2507
2479
 
2508
2480
  # Increase default connect_timeout to avoid intermittent
2509
2481
  # disconnects when test servers are put under load
2510
2482
  # see BUG#28359
2511
 
  mtr_add_arg($args, "%s--connect-timeout=60", $prefix);
 
2483
  mtr_add_arg($args, "%s--drizzle-protocol-connect-timeout=60", $prefix);
2512
2484
 
2513
2485
 
2514
2486
  # When mysqld is run by a root user(euid is 0), it will fail
2521
2493
  mtr_add_arg($args, "%s--pid-file=%s", $prefix,
2522
2494
              $mysqld->{'path_pid'});
2523
2495
 
2524
 
  mtr_add_arg($args, "%s--port=%d", $prefix,
2525
 
                $mysqld->{'port'});
 
2496
  mtr_add_arg($args, "%s--drizzle-protocol-port=%d", $prefix,
 
2497
              $mysqld->{'port'});
 
2498
 
 
2499
  mtr_add_arg($args, "%s--mysql-protocol-port=%d", $prefix,
 
2500
              $mysqld->{'mysql_port'});
2526
2501
 
2527
2502
  mtr_add_arg($args, "%s--datadir=%s", $prefix,
2528
2503
              $mysqld->{'path_myddir'});
2529
2504
 
2530
 
  my $log_base_path= "$opt_vardir/log/$mysqld->{'type'}$sidx";
2531
 
  mtr_add_arg($args, "%s--log=%s.log", $prefix, $log_base_path);
2532
 
  mtr_add_arg($args,
2533
 
              "%s--log-slow-queries=%s-slow.log", $prefix, $log_base_path);
2534
 
 
2535
2505
  # Check if "extra_opt" contains --skip-log-bin
2536
 
  my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt, @opt_extra_mysqld_opt);
2537
2506
  if ( $mysqld->{'type'} eq 'master' )
2538
2507
  {
2539
 
    if (! ($opt_skip_master_binlog || $skip_binlog) )
2540
 
    {
2541
 
      mtr_add_arg($args, "%s--log-bin=%s/log/master-bin%s", $prefix,
2542
 
                  $opt_vardir, $sidx);
2543
 
    }
2544
 
 
2545
2508
    mtr_add_arg($args, "%s--server-id=%d", $prefix,
2546
2509
               $idx > 0 ? $idx + 101 : 1);
2547
2510
 
2548
2511
    mtr_add_arg($args, "%s--loose-innodb_data_file_path=ibdata1:10M:autoextend",
2549
2512
                $prefix);
2550
2513
 
2551
 
    mtr_add_arg($args, "%s--local-infile", $prefix);
 
2514
    mtr_add_arg($args, "%s--loose-innodb-lock-wait-timeout=5", $prefix);
2552
2515
 
2553
 
    if ( $idx > 0 or !$use_innodb)
2554
 
    {
2555
 
      mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
2556
 
    }
2557
2516
  }
2558
2517
  else
2559
2518
  {
2560
2519
    mtr_error("unknown mysqld type")
2561
2520
      unless $mysqld->{'type'} eq 'slave';
2562
2521
 
2563
 
    #mtr_add_arg($args, "%s--init-rpl-role=slave", $prefix);
2564
 
    if (! ( $opt_skip_slave_binlog || $skip_binlog ))
2565
 
    {
2566
 
      mtr_add_arg($args, "%s--log-bin=%s/log/slave%s-bin", $prefix,
2567
 
                  $opt_vardir, $sidx); # FIXME use own dir for binlogs
2568
 
      mtr_add_arg($args, "%s--log-slave-updates", $prefix);
2569
 
    }
2570
 
 
2571
 
    mtr_add_arg($args, "%s--master-retry-count=10", $prefix);
2572
 
 
2573
 
    mtr_add_arg($args, "%s--relay-log=%s/log/slave%s-relay-bin", $prefix,
2574
 
                $opt_vardir, $sidx);
2575
 
    mtr_add_arg($args, "%s--report-host=127.0.0.1", $prefix);
2576
 
    mtr_add_arg($args, "%s--report-port=%d", $prefix,
2577
 
                $mysqld->{'port'});
2578
 
#    mtr_add_arg($args, "%s--report-user=root", $prefix);
2579
 
    mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
2580
 
    mtr_add_arg($args, "%s--skip-slave-start", $prefix);
2581
 
 
2582
2522
    # Directory where slaves find the dumps generated by "load data"
2583
2523
    # on the server. The path need to have constant length otherwise
2584
2524
    # test results will vary, thus a relative path is used.
2585
2525
    my $slave_load_path= "../tmp";
2586
 
    mtr_add_arg($args, "%s--slave-load-tmpdir=%s", $prefix,
2587
 
                $slave_load_path);
2588
 
    mtr_add_arg($args, "%s--set-variable=slave_net_timeout=120", $prefix);
2589
2526
 
2590
2527
    if ( @$slave_master_info )
2591
2528
    {
2599
2536
      my $slave_server_id=  2 + $idx;
2600
2537
      my $slave_rpl_rank= $slave_server_id;
2601
2538
      mtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id);
2602
 
#      mtr_add_arg($args, "%s--rpl-recovery-rank=%d", $prefix, $slave_rpl_rank);
2603
2539
    }
2604
2540
  } # end slave
2605
2541
 
2609
2545
                $prefix, $path_vardir_trace, $mysqld->{'type'}, $sidx);
2610
2546
  }
2611
2547
 
2612
 
  mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix);
 
2548
  mtr_add_arg($args, "%s--myisam_key_cache_size=1M", $prefix);
2613
2549
  mtr_add_arg($args, "%s--sort_buffer=256K", $prefix);
2614
2550
  mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix);
2615
2551
 
2632
2568
    {
2633
2569
      $found_skip_core= 1;
2634
2570
    }
2635
 
    elsif ($skip_binlog and mtr_match_prefix($arg, "--binlog-format"))
2636
 
    {
2637
 
      ; # Dont add --binlog-format when running without binlog
2638
 
    }
2639
2571
    else
2640
2572
    {
2641
2573
      mtr_add_arg($args, "%s%s", $prefix, $arg);
2646
2578
    mtr_add_arg($args, "%s%s", $prefix, "--core-file");
2647
2579
  }
2648
2580
 
2649
 
  if ( $opt_bench )
2650
 
  {
2651
 
    #mtr_add_arg($args, "%s--rpl-recovery-rank=1", $prefix);
2652
 
    #mtr_add_arg($args, "%s--init-rpl-role=master", $prefix);
2653
 
  }
2654
 
  elsif ( $mysqld->{'type'} eq 'master' )
2655
 
  {
2656
 
    mtr_add_arg($args, "%s--open-files-limit=1024", $prefix);
2657
 
  }
2658
 
 
2659
2581
  return $args;
2660
2582
}
2661
2583
 
2709
2631
  {
2710
2632
    ddd_arguments(\$args, \$exe, "$type"."_$idx");
2711
2633
  }
 
2634
  if ( $opt_dbx || $opt_manual_dbx)
 
2635
  {
 
2636
    dbx_arguments(\$args, \$exe, "$type"."_$idx");
 
2637
  }
2712
2638
  elsif ( $opt_debugger )
2713
2639
  {
2714
2640
    debugger_arguments(\$args, \$exe, "$type"."_$idx");
2777
2703
  {
2778
2704
    if ( $mysqld->{'pid'} )
2779
2705
    {
2780
 
      $pid= mtr_mysqladmin_start($mysqld, "shutdown", 70);
 
2706
      $pid= mtr_server_shutdown($mysqld);
2781
2707
      $admin_pids{$pid}= 1;
2782
2708
 
2783
2709
      push(@kill_pids,{
2839
2765
    my $diff_opts= mtr_diff_opts($master->[0]->{'start_opts'},$tinfo->{'master_opt'});
2840
2766
    if (scalar(@$diff_opts) eq 2) 
2841
2767
    {
2842
 
      $do_restart= 1 unless ($diff_opts->[0] =~/^--binlog-format=/ and $diff_opts->[1] =~/^--binlog-format=/);
 
2768
      $do_restart= 1;
2843
2769
    }
2844
2770
    else
2845
2771
    {
2935
2861
    {
2936
2862
      if ( $mysqld->{'pid'} )
2937
2863
      {
2938
 
        $pid= mtr_mysqladmin_start($mysqld, "shutdown", 20);
2939
 
 
2940
 
        $admin_pids{$pid}= 1;
2941
 
 
2942
 
        push(@kill_pids,{
2943
 
                         pid      => $mysqld->{'pid'},
2944
 
                         real_pid => $mysqld->{'real_pid'},
2945
 
                         pidfile  => $mysqld->{'path_pid'},
2946
 
                         sockfile => $mysqld->{'path_sock'},
2947
 
                         port     => $mysqld->{'port'},
2948
 
                         errfile   => $mysqld->{'path_myerr'},
2949
 
                        });
2950
 
 
2951
 
        $mysqld->{'pid'}= 0; # Assume we are done with it
 
2864
        $pid= mtr_server_shutdown($mysqld);
 
2865
 
 
2866
        $admin_pids{$pid}= 1;
 
2867
 
 
2868
        push(@kill_pids,{
 
2869
              pid      => $mysqld->{'pid'},
 
2870
              real_pid => $mysqld->{'real_pid'},
 
2871
              pidfile  => $mysqld->{'path_pid'},
 
2872
              sockfile => $mysqld->{'path_sock'},
 
2873
              port     => $mysqld->{'port'},
 
2874
              errfile   => $mysqld->{'path_myerr'},
 
2875
        });
 
2876
 
 
2877
        $mysqld->{'pid'}= 0; # Assume we are done with it
2952
2878
      }
2953
2879
    }
2954
2880
  }
2963
2889
    {
2964
2890
      if ( $mysqld->{'pid'} )
2965
2891
      {
2966
 
        $pid= mtr_mysqladmin_start($mysqld, "shutdown", 20);
2967
 
 
2968
 
        $admin_pids{$pid}= 1;
2969
 
 
2970
 
        push(@kill_pids,{
2971
 
                         pid      => $mysqld->{'pid'},
2972
 
                         real_pid => $mysqld->{'real_pid'},
2973
 
                         pidfile  => $mysqld->{'path_pid'},
2974
 
                         sockfile => $mysqld->{'path_sock'},
2975
 
                         port     => $mysqld->{'port'},
2976
 
                         errfile   => $mysqld->{'path_myerr'},
2977
 
                        });
2978
 
 
2979
 
 
2980
 
        $mysqld->{'pid'}= 0; # Assume we are done with it
 
2892
        $pid= mtr_server_shutdown($mysqld);
 
2893
 
 
2894
        $admin_pids{$pid}= 1;
 
2895
 
 
2896
        push(@kill_pids,{
 
2897
              pid      => $mysqld->{'pid'},
 
2898
              real_pid => $mysqld->{'real_pid'},
 
2899
              pidfile  => $mysqld->{'path_pid'},
 
2900
              sockfile => $mysqld->{'path_sock'},
 
2901
              port     => $mysqld->{'port'},
 
2902
              errfile  => $mysqld->{'path_myerr'},
 
2903
        });
 
2904
 
 
2905
        $mysqld->{'pid'}= 0; # Assume we are done with it
2981
2906
      }
2982
2907
    }
2983
2908
  }
3087
3012
  mtr_add_arg($args, "--no-defaults");
3088
3013
  mtr_add_arg($args, "--silent");
3089
3014
  mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
3090
 
  mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
3091
3015
 
3092
3016
  mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
3093
3017
  mtr_add_arg($args, "--database=test");
3102
3026
    mtr_add_arg($args, "--record");
3103
3027
  }
3104
3028
 
 
3029
  if ( $opt_testdir )
 
3030
  {
 
3031
    mtr_add_arg($args, "--testdir=%s", $opt_testdir);
 
3032
  }
 
3033
 
3105
3034
  my $res = mtr_run_test($exe_drizzletest,$args,
3106
3035
                "include/check-testcase.test", "", "", "");
3107
3036
 
3166
3095
  mtr_add_arg($args, "--no-defaults");
3167
3096
  mtr_add_arg($args, "--silent");
3168
3097
  mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
3169
 
  mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
3170
3098
  mtr_add_arg($args, "--logdir=%s/log", $opt_vardir);
3171
3099
 
3172
3100
  # Log line number and time  for each line in .test file
3209
3137
                $path_vardir_trace);
3210
3138
  }
3211
3139
 
 
3140
  if ( $opt_testdir )
 
3141
  {
 
3142
    mtr_add_arg($args, "--testdir=%s", $opt_testdir);
 
3143
  }
 
3144
 
 
3145
 
3212
3146
  # ----------------------------------------------------------------------
3213
3147
  # export DRIZZLE_TEST variable containing <path>/drizzletest <args>
3214
3148
  # ----------------------------------------------------------------------
3289
3223
 
3290
3224
}
3291
3225
 
 
3226
#
 
3227
# Modify the exe and args so that program is run in gdb in xterm
 
3228
#
 
3229
sub dbx_arguments {
 
3230
  my $args= shift;
 
3231
  my $exe=  shift;
 
3232
  my $type= shift;
 
3233
 
 
3234
  # Write $args to gdb init file
 
3235
  my $str= join(" ", @$$args);
 
3236
  my $dbx_init_file= "$opt_tmpdir/dbxinit.$type";
 
3237
 
 
3238
  # Remove the old gdbinit file
 
3239
  unlink($dbx_init_file);
 
3240
  if ( $type eq "client" )
 
3241
  {
 
3242
    # write init file for client
 
3243
    mtr_tofile($dbx_init_file,
 
3244
               "runargs $str\n" .
 
3245
               "run\n");
 
3246
  }
 
3247
  else
 
3248
  {
 
3249
    # write init file for drizzled
 
3250
    mtr_tofile($dbx_init_file,
 
3251
               "stop in mysql_parse\n" .
 
3252
               "runargs $str\n" .
 
3253
               "run\n" .
 
3254
               "\n");
 
3255
  }
 
3256
 
 
3257
  if ( $opt_manual_dbx )
 
3258
  {
 
3259
     print "\nTo start dbx for $type, type in another window:\n";
 
3260
     print "dbx -c 'source $dbx_init_file' $$exe\n";
 
3261
 
 
3262
     # Indicate the exe should not be started
 
3263
     $$exe= undef;
 
3264
     return;
 
3265
  }
 
3266
 
 
3267
  $$args= [];
 
3268
  mtr_add_arg($$args, "-title");
 
3269
  mtr_add_arg($$args, "$type");
 
3270
  mtr_add_arg($$args, "-e");
 
3271
 
 
3272
  mtr_add_arg($$args, "dbx");
 
3273
  mtr_add_arg($$args, "-c");
 
3274
  mtr_add_arg($$args, "source $dbx_init_file");
 
3275
  mtr_add_arg($$args, "$$exe");
 
3276
 
 
3277
  $$exe= "xterm";
 
3278
}
3292
3279
 
3293
3280
#
3294
3281
# Modify the exe and args so that program is run in gdb in xterm
3435
3422
    $$exe= $debugger;
3436
3423
 
3437
3424
  }
3438
 
  elsif ( $debugger eq "dbx" )
3439
 
  {
3440
 
    # xterm -e dbx -r exe arg1 .. argn
3441
 
 
3442
 
    unshift(@$$args, $$exe);
3443
 
    unshift(@$$args, "-r");
3444
 
    unshift(@$$args, $debugger);
3445
 
    unshift(@$$args, "-e");
3446
 
 
3447
 
    $$exe= "xterm";
3448
 
 
3449
 
  }
 
3425
  #elsif ( $debugger eq "dbx" )
 
3426
  #{
 
3427
  #  # xterm -e dbx -r exe arg1 .. argn
 
3428
#
 
3429
#    unshift(@$$args, $$exe);
 
3430
#    unshift(@$$args, "-r");
 
3431
#    unshift(@$$args, $debugger);
 
3432
#    unshift(@$$args, "-e");
 
3433
#
 
3434
#    $$exe= "xterm";
 
3435
#
 
3436
#  }
3450
3437
  else
3451
3438
  {
3452
3439
    mtr_error("Unknown argument \"$debugger\" passed to --debugger");
3466
3453
    mtr_add_arg($args, "--tool=callgrind");
3467
3454
    mtr_add_arg($args, "--base=$opt_vardir/log");
3468
3455
  }
 
3456
  elsif ($opt_massif)
 
3457
  {
 
3458
    mtr_add_arg($args, "--tool=massif");
 
3459
  }
3469
3460
  else
3470
3461
  {
3471
3462
    mtr_add_arg($args, "--tool=memcheck"); # From >= 2.1.2 needs this option
3472
 
    mtr_add_arg($args, "--alignment=8");
3473
3463
    mtr_add_arg($args, "--leak-check=yes");
3474
3464
    mtr_add_arg($args, "--num-callers=16");
3475
3465
    mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
3511
3501
  return 0;
3512
3502
}
3513
3503
 
 
3504
sub collapse_path ($) {
 
3505
 
 
3506
    my $c_path= rel2abs(shift);
 
3507
    my $updir  = updir($c_path);
 
3508
    my $curdir = curdir($c_path);
 
3509
 
 
3510
    my($vol, $dirs, $file) = splitpath($c_path);
 
3511
    my @dirs = splitdir($dirs);
 
3512
 
 
3513
    my @collapsed;
 
3514
    foreach my $dir (@dirs) {
 
3515
        if( $dir eq $updir              and   # if we have an updir
 
3516
            @collapsed                  and   # and something to collapse
 
3517
            length $collapsed[-1]       and   # and its not the rootdir
 
3518
            $collapsed[-1] ne $updir    and   # nor another updir
 
3519
            $collapsed[-1] ne $curdir         # nor the curdir
 
3520
          )
 
3521
        {                                     # then
 
3522
            pop @collapsed;                   # collapse
 
3523
        }
 
3524
        else {                                # else
 
3525
            push @collapsed, $dir;            # just hang onto it
 
3526
        }
 
3527
    }
 
3528
 
 
3529
    return catpath($vol, catdir(@collapsed), $file);
 
3530
}
3514
3531
 
3515
3532
##############################################################################
3516
3533
#
3565
3582
                        list of suite names.
3566
3583
                        The default is: "$opt_suites_default"
3567
3584
  skip-rpl              Skip the replication test cases.
3568
 
  big-test              Set the environment variable BIG_TEST, which can be
3569
 
                        checked from test cases.
3570
3585
  combination="ARG1 .. ARG2" Specify a set of "mysqld" arguments for one
3571
3586
                        combination.
3572
3587
  skip-combination      Skip any combination options and combinations files
 
3588
  repeat-test=n         How many times to repeat each test (default: 1)
3573
3589
 
3574
3590
Options that specify ports
3575
3591
 
3630
3646
                        can be specified more then once
3631
3647
  valgrind-path=[EXE]   Path to the valgrind executable
3632
3648
  callgrind             Instruct valgrind to use callgrind
 
3649
  massif                Instruct valgrind to use massif
3633
3650
 
3634
3651
Misc options
3635
3652