~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/test-run.pl

Lowercase plugin name prefix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
use utf8;
5
5
 
6
6
#
7
 
# Copyright (C) 2008
8
 
9
 
# This program is free software; you can redistribute it and/or modify
10
 
# it under the terms of the GNU General Public License as published by
11
 
# the Free Software Foundation; version 2 of the License.
12
 
13
 
# This program is distributed in the hope that it will be useful,
14
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 
# GNU General Public License for more details.
17
 
18
 
# You should have received a copy of the GNU General Public License
19
 
# along with this program; if not, write to the Free Software
20
 
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
21
 
#
22
 
#
23
7
##############################################################################
24
8
#
25
9
#  drizzle-test-run.pl
38
22
#
39
23
#   - To make this Perl script easy to alter even for those that not
40
24
#     code Perl that often, keeep the coding style as close as possible to
41
 
#     the C/C++ drizzle coding standard.
 
25
#     the C/C++ MySQL coding standard.
42
26
#
43
27
#   - All lists of arguments to send to commands are Perl lists/arrays,
44
28
#     not strings we append args to. Within reason, most string
45
29
#     concatenation for arguments should be avoided.
46
30
#
47
31
#   - Functions defined in the main program are not to be prefixed,
48
 
#     functions in "library files" are to be prefixed with "dtr_" (for
49
 
#     Drizzle-Test-Run). There are some exceptions, code that fits best in
 
32
#     functions in "library files" are to be prefixed with "mtr_" (for
 
33
#     Mysql-Test-Run). There are some exceptions, code that fits best in
50
34
#     the main program, but are put into separate files to avoid
51
35
#     clutter, may be without prefix.
52
36
#
68
52
# A nice way to trace the execution of this script while debugging
69
53
# is to use the Devel::Trace package found at
70
54
# "http://www.plover.com/~mjd/perl/Trace/" and run this script like
71
 
# "perl -d:Trace test-run.pl"
 
55
# "perl -d:Trace drizzle-test-run.pl"
72
56
#
73
57
 
74
58
 
93
77
select(STDOUT);
94
78
$| = 1; # Automatically flush STDOUT
95
79
 
96
 
require "dtr_cases.pl";
97
 
require "dtr_process.pl";
98
 
require "dtr_timer.pl";
99
 
require "dtr_io.pl";
100
 
require "dtr_gcov.pl";
101
 
require "dtr_gprof.pl";
102
 
require "dtr_report.pl";
103
 
require "dtr_match.pl";
104
 
require "dtr_misc.pl";
105
 
require "dtr_stress.pl";
106
 
require "dtr_unique.pl";
 
80
require "mtr_cases.pl";
 
81
require "mtr_process.pl";
 
82
require "mtr_timer.pl";
 
83
require "mtr_io.pl";
 
84
require "mtr_gcov.pl";
 
85
require "mtr_gprof.pl";
 
86
require "mtr_report.pl";
 
87
require "mtr_match.pl";
 
88
require "mtr_misc.pl";
 
89
require "mtr_stress.pl";
 
90
require "mtr_unique.pl";
107
91
 
108
92
$Devel::Trace::TRACE= 1;
109
93
 
116
100
# Misc global variables
117
101
our $drizzle_version_id;
118
102
our $glob_suite_path=             undef;
119
 
our $glob_drizzle_test_dir=         undef;
120
 
our $glob_drizzle_bench_dir=        undef;
 
103
our $glob_mysql_test_dir=         undef;
 
104
our $glob_mysql_bench_dir=        undef;
121
105
our $glob_scriptname=             undef;
122
106
our $glob_timers=                 undef;
123
107
our @glob_test_mode;
131
115
our $path_snapshot;
132
116
our $path_drizzletest_log;
133
117
our $path_current_test_log;
 
118
our $path_my_basedir;
134
119
 
135
120
our $opt_vardir;                 # A path but set directly on cmd line
136
121
our $opt_top_srcdir;
154
139
 
155
140
our $opt_repeat_test= 1;
156
141
 
157
 
our $exe_master_drizzled;
 
142
our $exe_master_mysqld;
158
143
our $exe_drizzle;
159
 
our $exe_drizzleadmin;
160
144
our $exe_drizzle_client_test;
161
145
our $exe_bug25714;
162
146
our $exe_drizzled;
165
149
our $exe_drizzleimport;
166
150
our $exe_drizzle_fix_system_tables;
167
151
our $exe_drizzletest;
168
 
our $exe_slave_drizzled;
 
152
our $exe_slave_mysqld;
 
153
our $exe_my_print_defaults;
169
154
our $exe_perror;
170
155
our $lib_udf_example;
171
156
our $lib_example_plugin;
178
163
our @opt_combinations;
179
164
our $opt_skip_combination;
180
165
 
181
 
our @opt_extra_drizzled_opt;
 
166
our @opt_extra_mysqld_opt;
182
167
 
183
168
our $opt_compress;
184
169
 
194
179
our $opt_force;
195
180
our $opt_reorder= 0;
196
181
our $opt_enable_disabled;
197
 
our $opt_mem= $ENV{'DTR_MEM'};
 
182
our $opt_mem= $ENV{'MTR_MEM'};
198
183
 
199
184
our $opt_gcov;
200
185
our $opt_gcov_err;
213
198
our $opt_manual_ddd;
214
199
our $opt_manual_debug;
215
200
# Magic number -69.4 results in traditional test ports starting from 9306.
216
 
our $opt_dtr_build_thread=-69.4;
 
201
our $opt_mtr_build_thread=-69.4;
217
202
our $opt_debugger;
218
203
our $opt_client_debugger;
219
204
 
229
214
our $opt_master_myport;
230
215
our $opt_slave_myport;
231
216
our $opt_memc_myport;
232
 
our $opt_pbms_myport;
233
217
our $opt_record;
234
218
my $opt_report_features;
235
219
our $opt_check_testcases;
259
243
our $opt_user;
260
244
 
261
245
my $opt_valgrind= 0;
262
 
my $opt_valgrind_drizzled= 0;
 
246
my $opt_valgrind_mysqld= 0;
263
247
my $opt_valgrind_drizzletest= 0;
264
 
my $opt_valgrind_drizzleslap= 0;
265
248
my @default_valgrind_args= ("--show-reachable=yes --malloc-fill=0xDEADBEEF --free-fill=0xDEADBEEF");
266
249
my @valgrind_args;
267
250
my $opt_valgrind_path;
287
270
our $used_default_engine;
288
271
our $debug_compiled_binaries;
289
272
 
290
 
our %drizzled_variables;
 
273
our %mysqld_variables;
291
274
 
292
275
my $source_dist= 0;
293
276
 
304
287
sub main ();
305
288
sub initial_setup ();
306
289
sub command_line_setup ();
307
 
sub set_dtr_build_thread_ports($);
 
290
sub set_mtr_build_thread_ports($);
308
291
sub datadir_list_setup ();
309
292
sub executable_setup ();
310
293
sub environment_setup ();
312
295
sub remove_stale_vardir ();
313
296
sub setup_vardir ();
314
297
sub check_running_as_root();
315
 
sub drizzled_wait_started($);
 
298
sub mysqld_wait_started($);
316
299
sub run_benchmarks ($);
317
300
sub initialize_servers ();
318
 
sub drizzle_install_db ();
 
301
sub mysql_install_db ();
319
302
sub copy_install_db ($$);
320
303
sub run_testcase ($);
321
304
sub run_testcase_stop_servers ($$$);
324
307
sub report_failure_and_restart ($);
325
308
sub do_before_start_master ($);
326
309
sub do_before_start_slave ($);
327
 
sub drizzled_start ($$$);
328
 
sub drizzled_arguments ($$$$);
 
310
sub mysqld_start ($$$);
 
311
sub mysqld_arguments ($$$$);
329
312
sub stop_all_servers ();
330
313
sub run_drizzletest ($);
331
314
sub collapse_path ($);
344
327
 
345
328
  command_line_setup();
346
329
 
347
 
  check_debug_support(\%drizzled_variables);
 
330
  check_debug_support(\%mysqld_variables);
348
331
 
349
332
  executable_setup();
350
333
 
385
368
      {
386
369
        my $extra_suite= $extra_suites{$dir};
387
370
        if (defined $extra_suite){
388
 
          dtr_report("Found extra suite: $extra_suite");
 
371
          mtr_report("Found extra suite: $extra_suite");
389
372
          $opt_suites= "$extra_suite,$opt_suites";
390
373
          last;
391
374
        }
404
387
        # Count max number of slaves used by a test case
405
388
        if ( $test->{slave_num} > $max_slave_num) {
406
389
          $max_slave_num= $test->{slave_num};
407
 
          dtr_error("Too many slaves") if $max_slave_num > 3;
 
390
          mtr_error("Too many slaves") if $max_slave_num > 3;
408
391
        }
409
392
 
410
393
        # Count max number of masters used by a test case
411
394
        if ( $test->{master_num} > $max_master_num) {
412
395
          $max_master_num= $test->{master_num};
413
 
          dtr_error("Too many masters") if $max_master_num > 2;
414
 
          dtr_error("Too few masters") if $max_master_num < 1;
 
396
          mtr_error("Too many masters") if $max_master_num > 2;
 
397
          mtr_error("Too few masters") if $max_master_num < 1;
415
398
        }
416
399
      }
417
400
      $use_innodb||= $test->{'innodb_test'};
426
409
    run_tests($tests);
427
410
  }
428
411
 
429
 
  dtr_exit(0);
 
412
  mtr_exit(0);
430
413
}
431
414
 
432
415
##############################################################################
437
420
 
438
421
#
439
422
# When an option is no longer used by this program, it must be explicitly
440
 
# ignored or else it will be passed through to drizzled.  GetOptions will call
 
423
# ignored or else it will be passed through to mysqld.  GetOptions will call
441
424
# this subroutine once for each such option on the command line.  See
442
425
# Getopt::Long documentation.
443
426
#
455
438
  my $opt_comment;
456
439
 
457
440
  # If so requested, we try to avail ourselves of a unique build thread number.
458
 
  if ( $ENV{'DTR_BUILD_THREAD'} ) {
459
 
    if ( lc($ENV{'DTR_BUILD_THREAD'}) eq 'auto' ) {
 
441
  if ( $ENV{'MTR_BUILD_THREAD'} ) {
 
442
    if ( lc($ENV{'MTR_BUILD_THREAD'}) eq 'auto' ) {
460
443
      print "Requesting build thread... ";
461
 
      $ENV{'DTR_BUILD_THREAD'} = dtr_require_unique_id_and_wait("/tmp/drizzle-test-ports", 200, 299);
462
 
      print "got ".$ENV{'DTR_BUILD_THREAD'}."\n";
 
444
      $ENV{'MTR_BUILD_THREAD'} = mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299);
 
445
      print "got ".$ENV{'MTR_BUILD_THREAD'}."\n";
463
446
    }
464
447
  }
465
448
 
466
 
  if ( $ENV{'DTR_BUILD_THREAD'} )
 
449
  if ( $ENV{'MTR_BUILD_THREAD'} )
467
450
  {
468
 
    set_dtr_build_thread_ports($ENV{'DTR_BUILD_THREAD'});
 
451
    set_mtr_build_thread_ports($ENV{'MTR_BUILD_THREAD'});
469
452
  }
470
453
 
471
454
  # This is needed for test log evaluation in "gen-build-status-page"
477
460
  # Note: Keep list, and the order, in sync with usage at end of this file
478
461
 
479
462
  # Options that are no longer used must still be processed, because all
480
 
  # unprocessed options are passed directly to drizzled.  The user will be
 
463
  # unprocessed options are passed directly to mysqld.  The user will be
481
464
  # warned that the option is being ignored.
482
465
  #
483
466
  # Put the complete option string here.  For example, to remove the --suite
507
490
             'master_port=i'            => \$opt_master_myport,
508
491
             'slave_port=i'             => \$opt_slave_myport,
509
492
             'memc_port=i'              => \$opt_memc_myport,
510
 
             'pbms_port=i'              => \$opt_pbms_myport,
511
 
             'dtr-build-thread=i'       => \$opt_dtr_build_thread,
 
493
             'mtr-build-thread=i'       => \$opt_mtr_build_thread,
512
494
 
513
495
             # Test case authoring
514
496
             'record'                   => \$opt_record,
515
497
             'check-testcases'          => \$opt_check_testcases,
516
498
             'mark-progress'            => \$opt_mark_progress,
517
499
 
518
 
             # Extra options used when starting drizzled
519
 
             'drizzled=s'                 => \@opt_extra_drizzled_opt,
 
500
             # Extra options used when starting mysqld
 
501
             'mysqld=s'                 => \@opt_extra_mysqld_opt,
520
502
             'engine=s'                 => \$opt_engine,
521
503
 
522
504
             # Run test on running server
539
521
             'debugger=s'               => \$opt_debugger,
540
522
             'client-debugger=s'        => \$opt_client_debugger,
541
523
             'strace-client'            => \$opt_strace_client,
542
 
             'master-binary=s'          => \$exe_master_drizzled,
543
 
             'slave-binary=s'           => \$exe_slave_drizzled,
 
524
             'master-binary=s'          => \$exe_master_mysqld,
 
525
             'slave-binary=s'           => \$exe_slave_mysqld,
544
526
             'max-save-core=i'          => \$opt_max_save_core,
545
527
 
546
528
             # Coverage, profiling etc
548
530
             'gprof'                    => \$opt_gprof,
549
531
             'valgrind|valgrind-all'    => \$opt_valgrind,
550
532
             'valgrind-drizzletest'       => \$opt_valgrind_drizzletest,
551
 
             'valgrind-drizzleslap'       => \$opt_valgrind_drizzleslap,
552
 
             'valgrind-drizzled'          => \$opt_valgrind_drizzled,
 
533
             'valgrind-mysqld'          => \$opt_valgrind_mysqld,
553
534
             'valgrind-options=s'       => sub {
554
535
               my ($opt, $value)= @_;
555
536
               # Deprecated option unless it's what we know pushbuild uses
584
565
             'top-srcdir=s'             => \$opt_top_srcdir,
585
566
             'suitepath=s'              => \$opt_suitepath,
586
567
             'testdir=s'                => \$opt_testdir,
587
 
             'benchdir=s'               => \$glob_drizzle_bench_dir,
 
568
             'benchdir=s'               => \$glob_mysql_bench_dir,
588
569
             'mem'                      => \$opt_mem,
589
570
 
590
571
             # Misc
621
602
 
622
603
  $glob_scriptname=  basename($0);
623
604
 
624
 
  if ($opt_dtr_build_thread != 0)
 
605
  if ($opt_mtr_build_thread != 0)
625
606
  {
626
 
    set_dtr_build_thread_ports($opt_dtr_build_thread)
 
607
    set_mtr_build_thread_ports($opt_mtr_build_thread)
627
608
  }
628
 
  elsif ($ENV{'DTR_BUILD_THREAD'})
 
609
  elsif ($ENV{'MTR_BUILD_THREAD'})
629
610
  {
630
 
    $opt_dtr_build_thread= $ENV{'DTR_BUILD_THREAD'};
 
611
    $opt_mtr_build_thread= $ENV{'MTR_BUILD_THREAD'};
631
612
  }
632
613
 
633
614
  if ( -d "../drizzled" )
638
619
  # Find the absolute path to the test directory
639
620
  if ( ! $opt_testdir )
640
621
  {
641
 
    $glob_drizzle_test_dir=  cwd();
 
622
    $glob_mysql_test_dir=  cwd();
642
623
  } 
643
624
  else
644
625
  {
645
 
    $glob_drizzle_test_dir= $opt_testdir;
 
626
    $glob_mysql_test_dir= $opt_testdir;
646
627
  }
647
 
  $default_vardir= "$glob_drizzle_test_dir/var";
648
 
  $default_top_srcdir= "$glob_drizzle_test_dir/..";
649
 
  $default_top_builddir= "$glob_drizzle_test_dir/..";
 
628
  $default_vardir= "$glob_mysql_test_dir/var";
 
629
  $default_top_srcdir= "$glob_mysql_test_dir/..";
 
630
  $default_top_builddir= "$glob_mysql_test_dir/..";
650
631
 
651
632
  if ( ! $opt_suitepath )
652
633
  {
653
 
    $glob_suite_path= "$glob_drizzle_test_dir/../plugin";
 
634
    $glob_suite_path= "$glob_mysql_test_dir/../plugin";
654
635
  }
655
636
  else
656
637
  {
657
638
    $glob_suite_path= $opt_suitepath;
658
639
  }
659
640
  # In most cases, the base directory we find everything relative to,
660
 
  # is the parent directory of the "drizzle-test" directory. For source
 
641
  # is the parent directory of the "mysql-test" directory. For source
661
642
  # distributions, TAR binary distributions and some other packages.
662
 
  $glob_basedir= dirname($glob_drizzle_test_dir);
 
643
  $glob_basedir= dirname($glob_mysql_test_dir);
663
644
 
664
645
  # In the RPM case, binaries and libraries are installed in the
665
646
  # default system locations, instead of having our own private base
666
 
  # directory. And we install "/usr/share/drizzle-test". Moving up one
667
 
  # more directory relative to "drizzle-test" gives us a usable base
 
647
  # directory. And we install "/usr/share/mysql-test". Moving up one
 
648
  # more directory relative to "mysql-test" gives us a usable base
668
649
  # directory for RPM installs.
669
650
  if ( ! $source_dist and ! -d "$glob_basedir/bin" )
670
651
  {
682
663
    $glob_builddir="..";
683
664
  }
684
665
 
685
 
  # Expect drizzle-bench to be located adjacent to the source tree, by default
686
 
  $glob_drizzle_bench_dir= "$glob_basedir/../drizzle-bench"
687
 
    unless defined $glob_drizzle_bench_dir;
688
 
  $glob_drizzle_bench_dir= undef
689
 
    unless -d $glob_drizzle_bench_dir;
690
 
 
691
 
  $glob_timers= dtr_init_timers();
 
666
  # Expect mysql-bench to be located adjacent to the source tree, by default
 
667
  $glob_mysql_bench_dir= "$glob_basedir/../mysql-bench"
 
668
    unless defined $glob_mysql_bench_dir;
 
669
  $glob_mysql_bench_dir= undef
 
670
    unless -d $glob_mysql_bench_dir;
 
671
 
 
672
  $path_my_basedir=
 
673
    $source_dist ? $glob_mysql_test_dir : $glob_basedir;
 
674
 
 
675
  $glob_timers= mtr_init_timers();
692
676
 
693
677
  #
694
 
  # Find the drizzled executable to be able to find the drizzled version
 
678
  # Find the mysqld executable to be able to find the mysqld version
695
679
  # number as early as possible
696
680
  #
697
681
 
698
682
  # Look for the client binaries directory
699
 
  $path_client_bindir= dtr_path_exists("$glob_builddir/client",
 
683
  $path_client_bindir= mtr_path_exists("$glob_builddir/client",
700
684
                                       "$glob_basedir/client",
701
685
                                       "$glob_basedir/bin");
702
686
 
703
687
  if (!$opt_extern)
704
688
  {
705
 
    $exe_drizzled=       dtr_exe_exists ("$glob_basedir/drizzled/drizzled",
 
689
    $exe_drizzled=       mtr_exe_exists ("$glob_basedir/drizzled/drizzled",
706
690
                                       "$path_client_bindir/drizzled",
707
691
                                       "$glob_basedir/libexec/drizzled",
708
692
                                       "$glob_basedir/bin/drizzled",
709
693
                                       "$glob_basedir/sbin/drizzled",
710
694
                                       "$glob_builddir/drizzled/drizzled");
711
695
 
712
 
    # Use the drizzled found above to find out what features are available
713
 
    collect_drizzled_features();
 
696
    # Use the mysqld found above to find out what features are available
 
697
    collect_mysqld_features();
714
698
  }
715
699
  else
716
700
  {
717
 
    $drizzled_variables{'port'}= 4427;
 
701
    $mysqld_variables{'port'}= 4427;
718
702
  }
719
703
 
720
704
  if (!$opt_engine)
734
718
  {
735
719
    if ( $arg =~ /^--skip-/ )
736
720
    {
737
 
      push(@opt_extra_drizzled_opt, $arg);
 
721
      push(@opt_extra_mysqld_opt, $arg);
738
722
    }
739
723
    elsif ( $arg =~ /^--$/ )
740
724
    {
755
739
  # --------------------------------------------------------------------------
756
740
  # Find out default storage engine being used(if any)
757
741
  # --------------------------------------------------------------------------
758
 
  foreach my $arg ( @opt_extra_drizzled_opt )
 
742
  foreach my $arg ( @opt_extra_mysqld_opt )
759
743
  {
760
744
    if ( $arg =~ /default-storage-engine=(\S+)/ )
761
745
    {
762
746
      $used_default_engine= $1;
763
747
    }
764
748
  }
765
 
  dtr_report("Using default engine '$used_default_engine'")
 
749
  mtr_report("Using default engine '$used_default_engine'")
766
750
    if defined $used_default_engine;
767
751
 
768
752
  # --------------------------------------------------------------------------
770
754
  # --------------------------------------------------------------------------
771
755
  if ( defined $opt_mem )
772
756
  {
773
 
    dtr_error("Can't use --mem and --vardir at the same time ")
 
757
    mtr_error("Can't use --mem and --vardir at the same time ")
774
758
      if $opt_vardir;
775
 
    dtr_error("Can't use --mem and --tmpdir at the same time ")
 
759
    mtr_error("Can't use --mem and --tmpdir at the same time ")
776
760
      if $opt_tmpdir;
777
761
 
778
762
    # Search through list of locations that are known
784
768
    {
785
769
      if ( -d $fs )
786
770
      {
787
 
        dtr_report("Using tmpfs in $fs");
 
771
        mtr_report("Using tmpfs in $fs");
788
772
        $opt_mem= "$fs/var";
789
 
        $opt_mem .= $opt_dtr_build_thread if $opt_dtr_build_thread;
 
773
        $opt_mem .= $opt_mtr_build_thread if $opt_mtr_build_thread;
790
774
        last;
791
775
      }
792
776
    }
835
819
# --------------------------------------------------------------------------
836
820
  if ( $opt_record and ! @opt_cases )
837
821
  {
838
 
    dtr_error("Will not run in record mode without a specific test case");
 
822
    mtr_error("Will not run in record mode without a specific test case");
839
823
  }
840
824
 
841
825
  if ( $opt_record )
856
840
  # --------------------------------------------------------------------------
857
841
  if ( $opt_gcov and ! $source_dist )
858
842
  {
859
 
    dtr_error("Coverage test needs the source - please use source dist");
 
843
    mtr_error("Coverage test needs the source - please use source dist");
860
844
  }
861
845
 
862
846
  # --------------------------------------------------------------------------
870
854
    $glob_debugger= 1;
871
855
    if ( $opt_extern )
872
856
    {
873
 
      dtr_error("Can't use --extern when using debugger");
 
857
      mtr_error("Can't use --extern when using debugger");
874
858
    }
875
859
  }
876
860
 
877
861
  # --------------------------------------------------------------------------
878
862
  # Check if special exe was selected for master or slave
879
863
  # --------------------------------------------------------------------------
880
 
  $exe_master_drizzled= $exe_master_drizzled || $exe_drizzled;
881
 
  $exe_slave_drizzled=  $exe_slave_drizzled  || $exe_drizzled;
 
864
  $exe_master_mysqld= $exe_master_mysqld || $exe_drizzled;
 
865
  $exe_slave_mysqld=  $exe_slave_mysqld  || $exe_drizzled;
882
866
 
883
867
  # --------------------------------------------------------------------------
884
868
  # Check valgrind arguments
885
869
  # --------------------------------------------------------------------------
886
870
  if ( $opt_valgrind or $opt_valgrind_path or @valgrind_args)
887
871
  {
888
 
    dtr_report("Turning on valgrind for all executables");
 
872
    mtr_report("Turning on valgrind for all executables");
889
873
    $opt_valgrind= 1;
890
 
    $opt_valgrind_drizzled= 1;
 
874
    $opt_valgrind_mysqld= 1;
891
875
    $opt_valgrind_drizzletest= 1;
892
 
    $ENV{'VALGRIND_RUN'} = '1';
893
876
  }
894
 
  elsif ( $opt_valgrind_drizzled )
 
877
  elsif ( $opt_valgrind_mysqld )
895
878
  {
896
 
    dtr_report("Turning on valgrind for drizzled(s) only");
 
879
    mtr_report("Turning on valgrind for mysqld(s) only");
897
880
    $opt_valgrind= 1;
898
881
  }
899
882
  elsif ( $opt_valgrind_drizzletest )
900
883
  {
901
 
    dtr_report("Turning on valgrind for drizzletest and drizzle_client_test only");
902
 
    $opt_valgrind= 1;
903
 
  }
904
 
  elsif ( $opt_valgrind_drizzleslap )
905
 
  {
906
 
    dtr_report("Turning on valgrind for drizzleslap only");
 
884
    mtr_report("Turning on valgrind for drizzletest and drizzle_client_test only");
907
885
    $opt_valgrind= 1;
908
886
  }
909
887
 
910
888
  if ( $opt_callgrind )
911
889
  {
912
 
    dtr_report("Turning on valgrind with callgrind for drizzled(s)");
 
890
    mtr_report("Turning on valgrind with callgrind for mysqld(s)");
913
891
    $opt_valgrind= 1;
914
 
    $opt_valgrind_drizzled= 1;
 
892
    $opt_valgrind_mysqld= 1;
915
893
 
916
894
    # Set special valgrind options unless options passed on command line
917
895
    push(@valgrind_args, "--trace-children=yes")
920
898
 
921
899
  if ( $opt_massif )
922
900
  {
923
 
    dtr_report("Valgrind with Massif tool for drizzled(s)");
 
901
    mtr_report("Valgrind with Massif tool for drizzled(s)");
924
902
    $opt_valgrind= 1;
925
 
    $opt_valgrind_drizzled= 1;
 
903
    $opt_valgrind_mysqld= 1;
926
904
  }
927
905
 
928
906
  if ( $opt_valgrind )
931
909
    push(@valgrind_args, @default_valgrind_args)
932
910
      unless @valgrind_args;
933
911
 
934
 
    dtr_report("Running valgrind with options \"",
 
912
    mtr_report("Running valgrind with options \"",
935
913
               join(" ", @valgrind_args), "\"");
936
914
  }
937
915
 
959
937
    }
960
938
  }
961
939
 
 
940
  # On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be
 
941
  # considered different, so avoid the extra slash (/) in the socket
 
942
  # paths.
 
943
  my $sockdir = $opt_tmpdir;
 
944
  $sockdir =~ s|/+$||;
 
945
 
 
946
  # On some operating systems, there is a limit to the length of a
 
947
  # UNIX domain socket's path far below PATH_MAX, so try to avoid long
 
948
  # socket path names.
 
949
  $sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) >= 70 );
 
950
 
962
951
  $master->[0]=
963
952
  {
964
953
   pid            => 0,
967
956
   path_myddir    => "$opt_vardir/master-data",
968
957
   path_myerr     => "$opt_vardir/log/master.err",
969
958
   path_pid       => "$opt_vardir/run/master.pid",
970
 
   path_sock      => "$opt_vardir/master.sock",
 
959
   path_sock      => "$sockdir/master.sock",
971
960
   port           =>  $opt_master_myport,
972
961
   secondary_port =>  $opt_master_myport + $secondary_port_offset,
973
962
   start_timeout  =>  400, # enough time create innodb tables
983
972
   path_myddir    => "$opt_vardir/master1-data",
984
973
   path_myerr     => "$opt_vardir/log/master1.err",
985
974
   path_pid       => "$opt_vardir/run/master1.pid",
986
 
   path_sock      => "$opt_vardir/master1.sock",
 
975
   path_sock      => "$sockdir/master1.sock",
987
976
   port           => $opt_master_myport + 1,
988
977
   secondary_port => $opt_master_myport + 1 + $secondary_port_offset,
989
978
   start_timeout  => 400, # enough time create innodb tables
999
988
   path_myddir    => "$opt_vardir/slave-data",
1000
989
   path_myerr     => "$opt_vardir/log/slave.err",
1001
990
   path_pid       => "$opt_vardir/run/slave.pid",
1002
 
   path_sock      => "$opt_vardir/slave.sock",
 
991
   path_sock      => "$sockdir/slave.sock",
1003
992
   port           => $opt_slave_myport,
1004
993
   secondary_port => $opt_slave_myport + $secondary_port_offset,
1005
994
   start_timeout  => 400,
1015
1004
   path_myddir    => "$opt_vardir/slave1-data",
1016
1005
   path_myerr     => "$opt_vardir/log/slave1.err",
1017
1006
   path_pid       => "$opt_vardir/run/slave1.pid",
1018
 
   path_sock      => "$opt_vardir/slave1.sock",
 
1007
   path_sock      => "$sockdir/slave1.sock",
1019
1008
   port           => $opt_slave_myport + 1,
1020
1009
   secondary_port => $opt_slave_myport + 1 + $secondary_port_offset,
1021
1010
   start_timeout  => 300,
1031
1020
   path_myddir    => "$opt_vardir/slave2-data",
1032
1021
   path_myerr     => "$opt_vardir/log/slave2.err",
1033
1022
   path_pid       => "$opt_vardir/run/slave2.pid",
1034
 
   path_sock      => "$opt_vardir/slave2.sock",
 
1023
   path_sock      => "$sockdir/slave2.sock",
1035
1024
   port           => $opt_slave_myport + 2,
1036
1025
   secondary_port => $opt_slave_myport + 2 + $secondary_port_offset,
1037
1026
   start_timeout  => 300,
1050
1039
    warn("Currenty broken --extern");
1051
1040
 
1052
1041
    # Setup master->[0] with the settings for the extern server
1053
 
    $master->[0]->{'path_sock'}=  $opt_socket ? $opt_socket : "/tmp/drizzle.sock";
1054
 
    dtr_report("Using extern server at '$master->[0]->{path_sock}'");
 
1042
    $master->[0]->{'path_sock'}=  $opt_socket ? $opt_socket : "/tmp/mysql.sock";
 
1043
    mtr_report("Using extern server at '$master->[0]->{path_sock}'");
1055
1044
  }
1056
1045
  else
1057
1046
  {
1058
 
    dtr_error("--socket can only be used in combination with --extern")
 
1047
    mtr_error("--socket can only be used in combination with --extern")
1059
1048
      if $opt_socket;
1060
1049
  }
1061
1050
 
1071
1060
    # When both --valgrind and --debug is selected, send
1072
1061
    # all output to the trace file, making it possible to
1073
1062
    # see the exact location where valgrind complains
1074
 
    foreach my $drizzled (@{$master}, @{$slave})
 
1063
    foreach my $mysqld (@{$master}, @{$slave})
1075
1064
    {
1076
 
      my $sidx= $drizzled->{idx} ? "$drizzled->{idx}" : "";
1077
 
      $drizzled->{path_myerr}=
1078
 
        "$opt_vardir/log/" . $drizzled->{type} . "$sidx.trace";
 
1065
      my $sidx= $mysqld->{idx} ? "$mysqld->{idx}" : "";
 
1066
      $mysqld->{path_myerr}=
 
1067
        "$opt_vardir/log/" . $mysqld->{type} . "$sidx.trace";
1079
1068
    }
1080
1069
  }
1081
1070
}
1113
1102
#
1114
1103
# Note the MASTER_MYPORT has to be set the same in all 4.x and 5.x
1115
1104
# versions of this script, else a 4.0 test run might conflict with a
1116
 
# 5.1 test run, even if different DTR_BUILD_THREAD is used. This means
 
1105
# 5.1 test run, even if different MTR_BUILD_THREAD is used. This means
1117
1106
# all port numbers might not be used in this version of the script.
1118
1107
#
1119
1108
# Also note the limitation of ports we are allowed to hand out. This
1122
1111
# But a fairly safe range seems to be 5001 - 32767
1123
1112
#
1124
1113
 
1125
 
sub set_dtr_build_thread_ports($) {
1126
 
  my $dtr_build_thread= shift;
 
1114
sub set_mtr_build_thread_ports($) {
 
1115
  my $mtr_build_thread= shift;
1127
1116
 
1128
 
  if ( lc($dtr_build_thread) eq 'auto' ) {
 
1117
  if ( lc($mtr_build_thread) eq 'auto' ) {
1129
1118
    print "Requesting build thread... ";
1130
 
    $ENV{'DTR_BUILD_THREAD'} = $dtr_build_thread = dtr_require_unique_id_and_wait("/tmp/drizzle-test-ports", 200, 299);
1131
 
    print "got ".$dtr_build_thread."\n";
 
1119
    $ENV{'MTR_BUILD_THREAD'} = $mtr_build_thread = mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299);
 
1120
    print "got ".$mtr_build_thread."\n";
1132
1121
  }
1133
1122
 
1134
 
  $dtr_build_thread= (($dtr_build_thread * 10) % 2000) - 1000;
 
1123
  $mtr_build_thread= (($mtr_build_thread * 10) % 2000) - 1000;
1135
1124
 
1136
1125
  # Up to two masters, up to three slaves
1137
1126
  # A magic value in command_line_setup depends on these equations.
1138
 
  $opt_master_myport=         gimme_a_good_port($dtr_build_thread + 9000); # and 1
 
1127
  $opt_master_myport=         gimme_a_good_port($mtr_build_thread + 9000); # and 1
1139
1128
 
1140
1129
 
1141
1130
  $opt_slave_myport=          gimme_a_good_port($opt_master_myport + 2);  # and 3 4
1142
1131
  $opt_memc_myport= gimme_a_good_port($opt_master_myport + 10);
1143
 
  $opt_pbms_myport= gimme_a_good_port($opt_master_myport + 11);
1144
1132
 
1145
1133
  if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 )
1146
1134
  {
1147
 
    dtr_error("DTR_BUILD_THREAD number results in a port",
 
1135
    mtr_error("MTR_BUILD_THREAD number results in a port",
1148
1136
              "outside 5001 - 32767",
1149
1137
              "($opt_master_myport - $opt_master_myport + 10)");
1150
1138
  }
1173
1161
##############################################################################
1174
1162
 
1175
1163
 
1176
 
sub collect_drizzled_features () {
 
1164
sub collect_mysqld_features () {
1177
1165
  my $found_variable_list_start= 0;
1178
1166
  my $tmpdir= tempdir(CLEANUP => 0); # Directory removed by this function
1179
1167
 
1180
1168
  #
1181
 
  # Execute "drizzled --help" to get a list
 
1169
  # Execute "mysqld --help --verbose" to get a list
1182
1170
  # list of all features and settings
1183
1171
  #
1184
 
  # --no-defaults are to avoid loading
 
1172
  # --no-defaults and --skip-grant-tables are to avoid loading
1185
1173
  # system-wide configs and plugins
1186
1174
  #
1187
 
  my $list= `$exe_drizzled --no-defaults --help`;
 
1175
  # --datadir must exist, mysqld will chdir into it
 
1176
  #
 
1177
  my $list= `$exe_drizzled --no-defaults --datadir=$tmpdir --skip-grant-tables --verbose --help`;
1188
1178
 
1189
1179
  foreach my $line (split('\n', $list))
1190
1180
  {
1193
1183
    {
1194
1184
      # Look for version
1195
1185
      my $exe_name= basename($exe_drizzled);
1196
 
      dtr_verbose("exe_name: $exe_name");
 
1186
      mtr_verbose("exe_name: $exe_name");
1197
1187
      if ( $line =~ /^\S*$exe_name\s\sVer\s([0-9]*)\.([0-9]*)\.([0-9]*)/ )
1198
1188
      {
1199
1189
        #print "Major: $1 Minor: $2 Build: $3\n";
1200
1190
        $drizzle_version_id= $1*10000 + $2*100 + $3;
1201
1191
        #print "drizzle_version_id: $drizzle_version_id\n";
1202
 
        dtr_report("Drizzle Version $1.$2.$3");
 
1192
        mtr_report("Drizzle Version $1.$2.$3");
 
1193
      }
 
1194
    }
 
1195
    else
 
1196
    {
 
1197
      if (!$found_variable_list_start)
 
1198
      {
 
1199
        # Look for start of variables list
 
1200
        if ( $line =~ /[\-]+\s[\-]+/ )
 
1201
        {
 
1202
          $found_variable_list_start= 1;
 
1203
        }
 
1204
      }
 
1205
      else
 
1206
      {
 
1207
        # Put variables into hash
 
1208
        if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ )
 
1209
        {
 
1210
          # print "$1=\"$2\"\n";
 
1211
          $mysqld_variables{$1}= $2;
 
1212
        }
 
1213
        else
 
1214
        {
 
1215
          # The variable list is ended with a blank line
 
1216
          if ( $line =~ /^[\s]*$/ )
 
1217
          {
 
1218
            last;
 
1219
          }
 
1220
          else
 
1221
          {
 
1222
            # Send out a warning, we should fix the variables that has no
 
1223
            # space between variable name and it's value
 
1224
            # or should it be fixed width column parsing? It does not
 
1225
            # look like that in function my_print_variables in my_getopt.c
 
1226
            mtr_warning("Could not parse variable list line : $line");
 
1227
          }
 
1228
        }
1203
1229
      }
1204
1230
    }
1205
1231
  }
1206
1232
  rmtree($tmpdir);
1207
 
  dtr_error("Could not find version of Drizzle") unless $drizzle_version_id;
 
1233
  mtr_error("Could not find version of Drizzle") unless $drizzle_version_id;
 
1234
  mtr_error("Could not find variabes list") unless $found_variable_list_start;
1208
1235
 
1209
1236
}
1210
1237
 
1211
1238
 
1212
1239
sub run_query($$) {
1213
 
  my ($drizzled, $query)= @_;
 
1240
  my ($mysqld, $query)= @_;
1214
1241
 
1215
1242
  my $args;
1216
 
  dtr_init_args(\$args);
 
1243
  mtr_init_args(\$args);
1217
1244
 
1218
 
  dtr_add_arg($args, "--no-defaults");
1219
 
  dtr_add_arg($args, "--skip-stack-trace");
1220
 
  dtr_add_arg($args, "--user=%s", $opt_user);
1221
 
  dtr_add_arg($args, "--port=%d", $drizzled->{'port'});
1222
 
  dtr_add_arg($args, "--silent"); # Tab separated output
1223
 
  dtr_add_arg($args, "-e '%s'", $query);
 
1245
  mtr_add_arg($args, "--no-defaults");
 
1246
  mtr_add_arg($args, "--skip-stack-trace");
 
1247
  mtr_add_arg($args, "--user=%s", $opt_user);
 
1248
  mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
 
1249
  mtr_add_arg($args, "--silent"); # Tab separated output
 
1250
  mtr_add_arg($args, "-e '%s'", $query);
1224
1251
 
1225
1252
  my $cmd= "$exe_drizzle " . join(' ', @$args);
1226
 
  dtr_verbose("cmd: $cmd");
 
1253
  mtr_verbose("cmd: $cmd");
1227
1254
  return `$cmd`;
1228
1255
}
1229
1256
 
1230
1257
 
1231
 
sub collect_drizzled_features_from_running_server ()
 
1258
sub collect_mysqld_features_from_running_server ()
1232
1259
{
1233
 
  my $list= run_query($master->[0], "use drizzle; SHOW VARIABLES");
 
1260
  my $list= run_query($master->[0], "use mysql; SHOW VARIABLES");
1234
1261
 
1235
1262
  foreach my $line (split('\n', $list))
1236
1263
  {
1238
1265
    if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ )
1239
1266
    {
1240
1267
      print "$1=\"$2\"\n";
1241
 
      $drizzled_variables{$1}= $2;
 
1268
      $mysqld_variables{$1}= $2;
1242
1269
    }
1243
1270
  }
1244
1271
}
1256
1283
    $exe_libtool= "../libtool";
1257
1284
    if ($opt_valgrind or $glob_debugger)
1258
1285
    {
1259
 
      dtr_report("Using \"$exe_libtool\" when running valgrind or debugger");
 
1286
      mtr_report("Using \"$exe_libtool\" when running valgrind or debugger");
1260
1287
    }
1261
1288
  }
1262
1289
 
 
1290
# Look for my_print_defaults
 
1291
  $exe_my_print_defaults=
 
1292
    mtr_exe_exists(
 
1293
        "$path_client_bindir/my_print_defaults",
 
1294
        "$glob_basedir/extra/my_print_defaults",
 
1295
        "$glob_builddir/extra/my_print_defaults");
 
1296
 
1263
1297
# Look for perror
1264
1298
  $exe_perror= "perror";
1265
1299
 
1266
1300
# Look for the client binaries
1267
 
  $exe_drizzledump= dtr_exe_exists("$path_client_bindir/drizzledump");
1268
 
  $exe_drizzleimport= dtr_exe_exists("$path_client_bindir/drizzleimport");
1269
 
  $exe_drizzle=          dtr_exe_exists("$path_client_bindir/drizzle");
1270
 
  $exe_drizzleadmin= dtr_exe_exists("$path_client_bindir/drizzleadmin");
 
1301
  $exe_drizzledump= mtr_exe_exists("$path_client_bindir/drizzledump");
 
1302
  $exe_drizzleimport= mtr_exe_exists("$path_client_bindir/drizzleimport");
 
1303
  $exe_drizzle=          mtr_exe_exists("$path_client_bindir/drizzle");
1271
1304
 
1272
1305
  if (!$opt_extern)
1273
1306
  {
1274
1307
# Look for SQL scripts directory
1275
1308
     if ( $drizzle_version_id >= 50100 )
1276
1309
     {
1277
 
         $exe_drizzleslap= dtr_exe_exists("$path_client_bindir/drizzleslap");
 
1310
         $exe_drizzleslap= mtr_exe_exists("$path_client_bindir/drizzleslap");
1278
1311
     }
1279
1312
  }
1280
1313
 
1281
1314
# Look for schema_writer
1282
1315
  {
1283
 
    $exe_schemawriter= dtr_exe_exists("$glob_basedir/drizzled/message/schema_writer",
 
1316
    $exe_schemawriter= mtr_exe_exists("$glob_basedir/drizzled/message/schema_writer",
1284
1317
                                      "$glob_builddir/drizzled/message/schema_writer");
1285
1318
  }
1286
1319
 
1287
1320
# Look for drizzletest executable
1288
1321
  {
1289
 
    $exe_drizzletest= dtr_exe_exists("$path_client_bindir/drizzletest");
 
1322
    $exe_drizzletest= mtr_exe_exists("$path_client_bindir/drizzletest");
1290
1323
  }
1291
1324
 
1292
1325
# Look for drizzle_client_test executable which may _not_ exist in
1293
1326
# some versions, test using it should be skipped
1294
1327
  {
1295
1328
    $exe_drizzle_client_test=
1296
 
      dtr_exe_maybe_exists(
 
1329
      mtr_exe_maybe_exists(
1297
1330
          "$glob_basedir/tests/drizzle_client_test",
1298
1331
          "$glob_basedir/bin/drizzle_client_test");
1299
1332
  }
1301
1334
# Look for bug25714 executable which may _not_ exist in
1302
1335
# some versions, test using it should be skipped
1303
1336
  $exe_bug25714=
1304
 
    dtr_exe_maybe_exists(
 
1337
    mtr_exe_maybe_exists(
1305
1338
        "$glob_basedir/tests/bug25714");
1306
1339
}
1307
1340
 
1308
1341
 
1309
1342
 
1310
 
sub generate_cmdline_drizzledump ($) {
1311
 
  my($drizzled) = @_;
 
1343
sub generate_cmdline_mysqldump ($) {
 
1344
  my($mysqld) = @_;
1312
1345
  return
1313
 
    dtr_native_path($exe_drizzledump) .
 
1346
    mtr_native_path($exe_drizzledump) .
1314
1347
      " --no-defaults -uroot " .
1315
 
      "--port=$drizzled->{'port'} ";
 
1348
      "--port=$mysqld->{'port'} ";
1316
1349
}
1317
1350
 
1318
1351
sub generate_cmdline_drizzle ($) {
1319
 
  my($drizzled) = @_;
 
1352
  my($mysqld) = @_;
1320
1353
  return
1321
 
    dtr_native_path($exe_drizzle) .
1322
 
    " -uroot --port=$drizzled->{'port'} ";
 
1354
    mtr_native_path($exe_drizzle) .
 
1355
    " -uroot --port=$mysqld->{'port'} ";
1323
1356
}
1324
1357
 
1325
 
sub generate_cmdline_drizzleadmin ($) {
1326
 
  my($drizzled) = @_;
1327
 
  return
1328
 
    dtr_native_path($exe_drizzleadmin) .
1329
 
    " -uroot --port=$drizzled->{'port'} ";
1330
 
}
1331
1358
 
1332
1359
##############################################################################
1333
1360
#
1341
1368
  my $exe= $exe_drizzle_client_test;
1342
1369
 
1343
1370
  my $args;
1344
 
  dtr_init_args(\$args);
 
1371
  mtr_init_args(\$args);
1345
1372
  if ( $opt_valgrind_drizzletest )
1346
1373
  {
1347
1374
    valgrind_arguments($args, \$exe);
1348
1375
  }
1349
1376
 
1350
 
  dtr_add_arg($args, "--no-defaults");
1351
 
  dtr_add_arg($args, "--testcase");
1352
 
  dtr_add_arg($args, "--user=root");
1353
 
  dtr_add_arg($args, "--port=$master->[0]->{'port'}");
 
1377
  mtr_add_arg($args, "--no-defaults");
 
1378
  mtr_add_arg($args, "--testcase");
 
1379
  mtr_add_arg($args, "--user=root");
 
1380
  mtr_add_arg($args, "--port=$master->[0]->{'port'}");
1354
1381
 
1355
1382
  if ( $opt_extern || $drizzle_version_id >= 50000 )
1356
1383
  {
1357
 
    dtr_add_arg($args, "--vardir=$opt_vardir")
 
1384
    mtr_add_arg($args, "--vardir=$opt_vardir")
1358
1385
  }
1359
1386
 
1360
1387
  if ( $opt_debug )
1361
1388
  {
1362
 
    dtr_add_arg($args,
 
1389
    mtr_add_arg($args,
1363
1390
      "--debug=d:t:A,$path_vardir_trace/log/drizzle_client_test.trace");
1364
1391
  }
1365
1392
 
1367
1394
}
1368
1395
 
1369
1396
 
1370
 
# Note that some env is setup in spawn/run, in "dtr_process.pl"
 
1397
# Note that some env is setup in spawn/run, in "mtr_process.pl"
1371
1398
 
1372
1399
sub environment_setup () {
1373
1400
 
1406
1433
  my $deb_version;
1407
1434
  if (  $opt_valgrind and -d $debug_libraries_path and
1408
1435
        (! -e '/etc/debian_version' or
1409
 
         ($deb_version= dtr_grab_file('/etc/debian_version')) !~ /^[0-9]+\.[0-9]$/ or
 
1436
         ($deb_version= mtr_grab_file('/etc/debian_version')) !~ /^[0-9]+\.[0-9]$/ or
1410
1437
         $deb_version > 3.1 ) )
1411
1438
  {
1412
1439
    push(@ld_library_paths, $debug_libraries_path);
1416
1443
                                $ENV{'LD_LIBRARY_PATH'} ?
1417
1444
                                split(':', $ENV{'LD_LIBRARY_PATH'}) : (),
1418
1445
                                @ld_library_paths);
1419
 
  dtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}");
 
1446
  mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}");
1420
1447
 
1421
1448
  $ENV{'DYLD_LIBRARY_PATH'}= join(":", @ld_library_paths,
1422
1449
                                  $ENV{'DYLD_LIBRARY_PATH'} ?
1423
1450
                                  split(':', $ENV{'DYLD_LIBRARY_PATH'}) : ());
1424
 
  dtr_debug("DYLD_LIBRARY_PATH: $ENV{'DYLD_LIBRARY_PATH'}");
 
1451
  mtr_debug("DYLD_LIBRARY_PATH: $ENV{'DYLD_LIBRARY_PATH'}");
1425
1452
 
1426
1453
  # The environment variable used for shared libs on AIX
1427
1454
  $ENV{'SHLIB_PATH'}= join(":", @ld_library_paths,
1428
1455
                           $ENV{'SHLIB_PATH'} ?
1429
1456
                           split(':', $ENV{'SHLIB_PATH'}) : ());
1430
 
  dtr_debug("SHLIB_PATH: $ENV{'SHLIB_PATH'}");
 
1457
  mtr_debug("SHLIB_PATH: $ENV{'SHLIB_PATH'}");
1431
1458
 
1432
1459
  # The environment variable used for shared libs on hp-ux
1433
1460
  $ENV{'LIBPATH'}= join(":", @ld_library_paths,
1434
1461
                        $ENV{'LIBPATH'} ?
1435
1462
                        split(':', $ENV{'LIBPATH'}) : ());
1436
 
  dtr_debug("LIBPATH: $ENV{'LIBPATH'}");
 
1463
  mtr_debug("LIBPATH: $ENV{'LIBPATH'}");
1437
1464
 
1438
1465
  # --------------------------------------------------------------------------
1439
1466
  # Also command lines in .opt files may contain env vars
1444
1471
  $ENV{'UMASK_DIR'}=          "0770"; # The octal *string*
1445
1472
  
1446
1473
  #
1447
 
  # drizzle tests can produce output in various character sets
 
1474
  # MySQL tests can produce output in various character sets
1448
1475
  # (especially, ctype_xxx.test). To avoid confusing Perl
1449
1476
  # with output which is incompatible with the current locale
1450
1477
  # settings, we reset the current values of LC_ALL and LC_CTYPE to "C".
1456
1483
  
1457
1484
  $ENV{'LC_COLLATE'}=         "C";
1458
1485
  $ENV{'USE_RUNNING_SERVER'}= $opt_extern;
1459
 
  $ENV{'DRIZZLE_TEST_DIR'}=     collapse_path($glob_drizzle_test_dir);
1460
 
  $ENV{'DRIZZLETEST_VARDIR'}=   $opt_vardir;
 
1486
  $ENV{'DRIZZLE_TEST_DIR'}=     collapse_path($glob_mysql_test_dir);
 
1487
  $ENV{'MYSQLTEST_VARDIR'}=   $opt_vardir;
1461
1488
  $ENV{'TOP_SRCDIR'}= $opt_top_srcdir;
1462
1489
  $ENV{'TOP_BUILDDIR'}= $opt_top_builddir;
1463
1490
  $ENV{'DRIZZLE_TMP_DIR'}=      $opt_tmpdir;
1470
1497
  $ENV{'SLAVE_MYPORT1'}=      $slave->[1]->{'port'};
1471
1498
  $ENV{'SLAVE_MYPORT2'}=      $slave->[2]->{'port'};
1472
1499
  $ENV{'MC_PORT'}=            $opt_memc_myport;
1473
 
  $ENV{'PBMS_PORT'}=            $opt_pbms_myport;
1474
 
  $ENV{'DRIZZLE_TCP_PORT'}=     $drizzled_variables{'drizzle-protocol.port'};
1475
 
 
1476
 
  $ENV{'DTR_BUILD_THREAD'}=      $opt_dtr_build_thread;
1477
 
 
1478
 
  $ENV{'EXE_DRIZZLE'}=          $exe_drizzle;
 
1500
  $ENV{'DRIZZLE_TCP_PORT'}=     $mysqld_variables{'drizzle-protocol.port'};
 
1501
 
 
1502
  $ENV{'MTR_BUILD_THREAD'}=      $opt_mtr_build_thread;
 
1503
 
 
1504
  $ENV{'EXE_MYSQL'}=          $exe_drizzle;
1479
1505
 
1480
1506
 
1481
1507
  # ----------------------------------------------------
1482
1508
  # Setup env to childs can execute myqldump
1483
1509
  # ----------------------------------------------------
1484
 
  my $cmdline_drizzleadmin= generate_cmdline_drizzleadmin($master->[0]);
1485
 
  my $cmdline_drizzledump= generate_cmdline_drizzledump($master->[0]);
1486
 
  my $cmdline_drizzledumpslave= generate_cmdline_drizzledump($slave->[0]);
1487
 
  my $cmdline_drizzledump_secondary= dtr_native_path($exe_drizzledump) .
 
1510
  my $cmdline_mysqldump= generate_cmdline_mysqldump($master->[0]);
 
1511
  my $cmdline_mysqldumpslave= generate_cmdline_mysqldump($slave->[0]);
 
1512
  my $cmdline_mysqldump_secondary= mtr_native_path($exe_drizzledump) .
1488
1513
       " --no-defaults -uroot " .
1489
1514
       " --port=$master->[0]->{'secondary_port'} ";
1490
1515
 
1491
1516
  if ( $opt_debug )
1492
1517
  {
1493
 
    $cmdline_drizzledump .=
1494
 
      " --debug=d:t:A,$path_vardir_trace/log/drizzledump-master.trace";
1495
 
    $cmdline_drizzledumpslave .=
1496
 
      " --debug=d:t:A,$path_vardir_trace/log/drizzledump-slave.trace";
1497
 
    $cmdline_drizzledump_secondary .=
1498
 
      " --debug=d:t:A,$path_vardir_trace/log/drizzledump-drizzle.trace";
 
1518
    $cmdline_mysqldump .=
 
1519
      " --debug=d:t:A,$path_vardir_trace/log/mysqldump-master.trace";
 
1520
    $cmdline_mysqldumpslave .=
 
1521
      " --debug=d:t:A,$path_vardir_trace/log/mysqldump-slave.trace";
 
1522
    $cmdline_mysqldump_secondary .=
 
1523
      " --debug=d:t:A,$path_vardir_trace/log/mysqldump-mysql.trace";
1499
1524
  }
1500
 
  $ENV{'DRIZZLE_ADMIN'}= $cmdline_drizzleadmin;
1501
 
  $ENV{'DRIZZLE_DUMP'}= $cmdline_drizzledump;
1502
 
  $ENV{'DRIZZLE_DUMP_SLAVE'}= $cmdline_drizzledumpslave;
1503
 
  $ENV{'DRIZZLE_DUMP_SECONDARY'}= $cmdline_drizzledump_secondary;
 
1525
  $ENV{'DRIZZLE_DUMP'}= $cmdline_mysqldump;
 
1526
  $ENV{'DRIZZLE_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
 
1527
  $ENV{'DRIZZLE_DUMP_SECONDARY'}= $cmdline_mysqldump_secondary;
1504
1528
 
1505
1529
  # ----------------------------------------------------
1506
1530
  # Setup env so we can execute drizzle client
1507
1531
  # ----------------------------------------------------
1508
 
  #my $cmdline_drizzle = generate_cmdline_drizzle($master->[0]);
1509
 
  #$ENV{'DRIZZLE'}= $cmdline_drizzle;
 
1532
  my $cmdline_drizzle = generate_cmdline_drizzle($master->[0]);
 
1533
  $ENV{'DRIZZLE'}= $cmdline_drizzle;
1510
1534
 
1511
1535
  # ----------------------------------------------------
1512
 
  # Setup env so childs can execute drizzleslap
 
1536
  # Setup env so childs can execute mysqlslap
1513
1537
  # ----------------------------------------------------
1514
1538
  if ( $exe_drizzleslap )
1515
1539
  {
1516
 
    my $cmdline_drizzleslap;
1517
 
 
1518
 
    if ( $opt_valgrind_drizzleslap )
1519
 
    {
1520
 
      $cmdline_drizzleslap= "$glob_basedir/libtool --mode=execute valgrind --log-file=$opt_vardir/log/drizzleslap-valgrind.log ";
1521
 
    }
1522
 
    $cmdline_drizzleslap .=
1523
 
      dtr_native_path($exe_drizzleslap) .
 
1540
    my $cmdline_drizzleslap=
 
1541
      mtr_native_path($exe_drizzleslap) .
1524
1542
      " -uroot " .
1525
1543
      "--port=$master->[0]->{'port'} ";
1526
1544
    my $cmdline_drizzleslap_secondary=
1527
 
      dtr_native_path($exe_drizzleslap) .
 
1545
      mtr_native_path($exe_drizzleslap) .
1528
1546
      " -uroot " .
1529
1547
      " --port=$master->[0]->{'secondary_port'} ";
1530
1548
 
1542
1560
 
1543
1561
 
1544
1562
  # ----------------------------------------------------
1545
 
  # Setup env so childs can execute drizzleimport
 
1563
  # Setup env so childs can execute mysqlimport
1546
1564
  # ----------------------------------------------------
1547
 
  my $cmdline_drizzleimport=
1548
 
    dtr_native_path($exe_drizzleimport) .
 
1565
  my $cmdline_mysqlimport=
 
1566
    mtr_native_path($exe_drizzleimport) .
1549
1567
    " -uroot " .
1550
1568
    "--port=$master->[0]->{'port'} ";
1551
1569
 
1552
1570
  if ( $opt_debug )
1553
1571
  {
1554
 
    $cmdline_drizzleimport .=
1555
 
      " --debug=d:t:A,$path_vardir_trace/log/drizzleimport.trace";
 
1572
    $cmdline_mysqlimport .=
 
1573
      " --debug=d:t:A,$path_vardir_trace/log/mysqlimport.trace";
1556
1574
  }
1557
 
  $ENV{'DRIZZLE_IMPORT'}= $cmdline_drizzleimport;
1558
 
 
1559
 
 
1560
 
  # ----------------------------------------------------
1561
 
  # Setup env so childs can execute drizzle
1562
 
  # ----------------------------------------------------
1563
 
  my $cmdline_drizzle=
1564
 
    dtr_native_path($exe_drizzle) .
 
1575
  $ENV{'DRIZZLE_IMPORT'}= $cmdline_mysqlimport;
 
1576
 
 
1577
 
 
1578
  # ----------------------------------------------------
 
1579
  # Setup env so childs can execute mysql
 
1580
  # ----------------------------------------------------
 
1581
  my $cmdline_mysql=
 
1582
    mtr_native_path($exe_drizzle) .
1565
1583
    " --no-defaults --host=localhost  --user=root --password= " .
1566
1584
    "--port=$master->[0]->{'port'} ";
1567
1585
  my $cmdline_drizzle_secondary=
1568
 
    dtr_native_path($exe_drizzle) .
 
1586
    mtr_native_path($exe_drizzle) .
1569
1587
    " --no-defaults --host=localhost  --user=root --password= " .
1570
1588
    " --port=$master->[0]->{'secondary_port'} ";
1571
1589
 
1572
 
  $ENV{'DRIZZLE'}= $cmdline_drizzle;
 
1590
  $ENV{'MYSQL'}= $cmdline_mysql;
1573
1591
  $ENV{'DRIZZLE_SECONDARY'}= $cmdline_drizzle_secondary;
1574
1592
 
1575
1593
  # ----------------------------------------------------
1584
1602
 
1585
1603
 
1586
1604
  # ----------------------------------------------------
1587
 
  # Setup env so childs can execute drizzle_fix_system_tables
 
1605
  # Setup env so childs can execute mysql_fix_system_tables
1588
1606
  # ----------------------------------------------------
1589
1607
  #if ( !$opt_extern)
1590
1608
  if ( 0 )
1591
1609
  {
1592
 
    my $cmdline_drizzle_fix_system_tables=
 
1610
    my $cmdline_mysql_fix_system_tables=
1593
1611
      "$exe_drizzle_fix_system_tables --no-defaults --host=localhost " .
1594
1612
      "--user=root --password= " .
1595
1613
      "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
1596
1614
      "--port=$master->[0]->{'port'} ";
1597
 
    $ENV{'DRIZZLE_FIX_SYSTEM_TABLES'}=  $cmdline_drizzle_fix_system_tables;
 
1615
    $ENV{'DRIZZLE_FIX_SYSTEM_TABLES'}=  $cmdline_mysql_fix_system_tables;
1598
1616
 
1599
1617
  }
1600
1618
 
1601
1619
  # ----------------------------------------------------
 
1620
  # Setup env so childs can execute my_print_defaults
 
1621
  # ----------------------------------------------------
 
1622
  $ENV{'DRIZZLE_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults);
 
1623
 
 
1624
  # ----------------------------------------------------
1602
1625
  # Setup env so childs can shutdown the server
1603
1626
  # ----------------------------------------------------
1604
 
  $ENV{'DRIZZLED_SHUTDOWN'}= dtr_native_path($exe_drizzle);
 
1627
  $ENV{'DRIZZLED_SHUTDOWN'}= mtr_native_path($exe_drizzle);
1605
1628
 
1606
1629
  # ----------------------------------------------------
1607
1630
  # Setup env so childs can execute perror  
1608
1631
  # ----------------------------------------------------
1609
 
  $ENV{'MY_PERROR'}= dtr_native_path($exe_perror);
 
1632
  $ENV{'MY_PERROR'}= mtr_native_path($exe_perror);
1610
1633
 
1611
1634
  # ----------------------------------------------------
1612
 
  # Add the path where drizzled will find ha_example.so
 
1635
  # Add the path where mysqld will find ha_example.so
1613
1636
  # ----------------------------------------------------
1614
1637
  $ENV{'EXAMPLE_PLUGIN'}=
1615
1638
    ($lib_example_plugin ? basename($lib_example_plugin) : "");
1617
1640
    ($lib_example_plugin ? "--plugin_dir=" . dirname($lib_example_plugin) : "");
1618
1641
 
1619
1642
  # ----------------------------------------------------
 
1643
  # Setup env so childs can execute myisampack and myisamchk
 
1644
  # ----------------------------------------------------
 
1645
#  $ENV{'MYISAMCHK'}= mtr_native_path(mtr_exe_exists(
 
1646
#                       "$path_client_bindir/myisamchk",
 
1647
#                       "$glob_basedir/storage/myisam/myisamchk",
 
1648
#                       "$glob_basedir/myisam/myisamchk"));
 
1649
#  $ENV{'MYISAMPACK'}= mtr_native_path(mtr_exe_exists(
 
1650
#                        "$path_client_bindir/myisampack",
 
1651
#                        "$glob_basedir/storage/myisam/myisampack",
 
1652
#                        "$glob_basedir/myisam/myisampack"));
 
1653
 
 
1654
  # ----------------------------------------------------
1620
1655
  # We are nice and report a bit about our settings
1621
1656
  # ----------------------------------------------------
1622
1657
  if (!$opt_extern)
1623
1658
  {
1624
 
    print "Using DTR_BUILD_THREAD      = $ENV{DTR_BUILD_THREAD}\n";
 
1659
    print "Using MTR_BUILD_THREAD      = $ENV{MTR_BUILD_THREAD}\n";
1625
1660
    print "Using MASTER_MYPORT         = $ENV{MASTER_MYPORT}\n";
1626
1661
    print "Using MASTER_MYPORT1        = $ENV{MASTER_MYPORT1}\n";
1627
1662
    print "Using SLAVE_MYPORT          = $ENV{SLAVE_MYPORT}\n";
1628
1663
    print "Using SLAVE_MYPORT1         = $ENV{SLAVE_MYPORT1}\n";
1629
1664
    print "Using SLAVE_MYPORT2         = $ENV{SLAVE_MYPORT2}\n";
1630
1665
    print "Using MC_PORT               = $ENV{MC_PORT}\n";
1631
 
    print "Using PBMS_PORT             = $ENV{PBMS_PORT}\n";
1632
1666
  }
1633
1667
 
1634
1668
  # Create an environment variable to make it possible
1652
1686
 
1653
1687
sub handle_int_signal () {
1654
1688
  $SIG{INT}= 'DEFAULT';         # If we get a ^C again, we die...
1655
 
  dtr_warning("got INT signal, cleaning up.....");
 
1689
  mtr_warning("got INT signal, cleaning up.....");
1656
1690
  stop_all_servers();
1657
 
  dtr_error("We die from ^C signal from user");
 
1691
  mtr_error("We die from ^C signal from user");
1658
1692
}
1659
1693
 
1660
1694
 
1666
1700
 
1667
1701
sub kill_running_servers () {
1668
1702
  {
1669
 
    # Ensure that no old drizzled test servers are running
 
1703
    # Ensure that no old mysqld test servers are running
1670
1704
    # This is different from terminating processes we have
1671
1705
    # started from this run of the script, this is terminating
1672
1706
    # leftovers from previous runs.
1673
 
    dtr_kill_leftovers();
 
1707
    mtr_kill_leftovers();
1674
1708
   }
1675
1709
}
1676
1710
 
1680
1714
#
1681
1715
sub remove_stale_vardir () {
1682
1716
 
1683
 
  dtr_report("Removing Stale Files");
 
1717
  mtr_report("Removing Stale Files");
1684
1718
 
1685
1719
  # Safety!
1686
 
  dtr_error("No, don't remove the vardir when running with --extern")
 
1720
  mtr_error("No, don't remove the vardir when running with --extern")
1687
1721
    if $opt_extern;
1688
1722
 
1689
 
  dtr_verbose("opt_vardir: $opt_vardir");
 
1723
  mtr_verbose("opt_vardir: $opt_vardir");
1690
1724
  if ( $opt_vardir eq $default_vardir )
1691
1725
  {
1692
1726
    #
1693
 
    # Running with "var" in drizzle-test dir
 
1727
    # Running with "var" in mysql-test dir
1694
1728
    #
1695
1729
    if ( -l $opt_vardir)
1696
1730
    {
1699
1733
      if ( $opt_mem and readlink($opt_vardir) eq $opt_mem )
1700
1734
      {
1701
1735
        # Remove the directory which the link points at
1702
 
        dtr_verbose("Removing " . readlink($opt_vardir));
1703
 
        dtr_rmtree(readlink($opt_vardir));
 
1736
        mtr_verbose("Removing " . readlink($opt_vardir));
 
1737
        mtr_rmtree(readlink($opt_vardir));
1704
1738
 
1705
1739
        # Remove the "var" symlink
1706
 
        dtr_verbose("unlink($opt_vardir)");
 
1740
        mtr_verbose("unlink($opt_vardir)");
1707
1741
        unlink($opt_vardir);
1708
1742
      }
1709
1743
      elsif ( $opt_mem )
1710
1744
      {
1711
1745
        # Just remove the "var" symlink
1712
 
        dtr_report("WARNING: Removing '$opt_vardir' symlink it's wrong");
 
1746
        mtr_report("WARNING: Removing '$opt_vardir' symlink it's wrong");
1713
1747
 
1714
 
        dtr_verbose("unlink($opt_vardir)");
 
1748
        mtr_verbose("unlink($opt_vardir)");
1715
1749
        unlink($opt_vardir);
1716
1750
      }
1717
1751
      else
1718
1752
      {
1719
 
        # Some users creates a soft link in drizzle-test/var to another area
 
1753
        # Some users creates a soft link in mysql-test/var to another area
1720
1754
        # - allow it, but remove all files in it
1721
1755
 
1722
 
        dtr_report("WARNING: Using the 'drizzle-test/var' symlink");
 
1756
        mtr_report("WARNING: Using the 'mysql-test/var' symlink");
1723
1757
 
1724
1758
        # Make sure the directory where it points exist
1725
 
        dtr_error("The destination for symlink $opt_vardir does not exist")
 
1759
        mtr_error("The destination for symlink $opt_vardir does not exist")
1726
1760
          if ! -d readlink($opt_vardir);
1727
1761
 
1728
1762
        foreach my $bin ( glob("$opt_vardir/*") )
1729
1763
        {
1730
 
          dtr_verbose("Removing bin $bin");
1731
 
          dtr_rmtree($bin);
 
1764
          mtr_verbose("Removing bin $bin");
 
1765
          mtr_rmtree($bin);
1732
1766
        }
1733
1767
      }
1734
1768
    }
1735
1769
    else
1736
1770
    {
1737
1771
      # Remove the entire "var" dir
1738
 
      dtr_verbose("Removing $opt_vardir/");
1739
 
      dtr_rmtree("$opt_vardir/");
 
1772
      mtr_verbose("Removing $opt_vardir/");
 
1773
      mtr_rmtree("$opt_vardir/");
1740
1774
    }
1741
1775
 
1742
1776
    if ( $opt_mem )
1744
1778
      # A symlink from var/ to $opt_mem will be set up
1745
1779
      # remove the $opt_mem dir to assure the symlink
1746
1780
      # won't point at an old directory
1747
 
      dtr_verbose("Removing $opt_mem");
1748
 
      dtr_rmtree($opt_mem);
 
1781
      mtr_verbose("Removing $opt_mem");
 
1782
      mtr_rmtree($opt_mem);
1749
1783
    }
1750
1784
 
1751
1785
  }
1755
1789
    # Running with "var" in some other place
1756
1790
    #
1757
1791
 
1758
 
    # Remove the var/ dir in drizzle-test dir if any
 
1792
    # Remove the var/ dir in mysql-test dir if any
1759
1793
    # this could be an old symlink that shouldn't be there
1760
 
    dtr_verbose("Removing $default_vardir");
1761
 
    dtr_rmtree($default_vardir);
 
1794
    mtr_verbose("Removing $default_vardir");
 
1795
    mtr_rmtree($default_vardir);
1762
1796
 
1763
1797
    # Remove the "var" dir
1764
 
    dtr_verbose("Removing $opt_vardir/");
1765
 
    dtr_rmtree("$opt_vardir/");
 
1798
    mtr_verbose("Removing $opt_vardir/");
 
1799
    mtr_rmtree("$opt_vardir/");
1766
1800
  }
1767
1801
}
1768
1802
 
1770
1804
# Create var and the directories needed in var
1771
1805
#
1772
1806
sub setup_vardir() {
1773
 
  dtr_report("Creating Directories");
 
1807
  mtr_report("Creating Directories");
1774
1808
 
1775
1809
  if ( $opt_vardir eq $default_vardir )
1776
1810
  {
1777
1811
    #
1778
 
    # Running with "var" in drizzle-test dir
 
1812
    # Running with "var" in mysql-test dir
1779
1813
    #
1780
1814
    if ( -l $opt_vardir )
1781
1815
    {
1782
1816
      #  it's a symlink
1783
1817
 
1784
1818
      # Make sure the directory where it points exist
1785
 
      dtr_error("The destination for symlink $opt_vardir does not exist")
 
1819
      mtr_error("The destination for symlink $opt_vardir does not exist")
1786
1820
        if ! -d readlink($opt_vardir);
1787
1821
    }
1788
1822
    elsif ( $opt_mem )
1789
1823
    {
1790
1824
      # Runinng with "var" as a link to some "memory" location, normally tmpfs
1791
 
      dtr_verbose("Creating $opt_mem");
 
1825
      mtr_verbose("Creating $opt_mem");
1792
1826
      mkpath($opt_mem);
1793
1827
 
1794
 
      dtr_report("Symlinking 'var' to '$opt_mem'");
 
1828
      mtr_report("Symlinking 'var' to '$opt_mem'");
1795
1829
      symlink($opt_mem, $opt_vardir);
1796
1830
    }
1797
1831
  }
1798
1832
 
1799
1833
  if ( ! -d $opt_vardir )
1800
1834
  {
1801
 
    dtr_verbose("Creating $opt_vardir");
 
1835
    mtr_verbose("Creating $opt_vardir");
1802
1836
    mkpath($opt_vardir);
1803
1837
  }
1804
1838
 
1805
1839
  # Ensure a proper error message if vardir couldn't be created
1806
1840
  unless ( -d $opt_vardir and -w $opt_vardir )
1807
1841
  {
1808
 
    dtr_error("Writable 'var' directory is needed, use the " .
 
1842
    mtr_error("Writable 'var' directory is needed, use the " .
1809
1843
              "'--vardir=<path>' option");
1810
1844
  }
1811
1845
 
1817
1851
  # Create new data dirs
1818
1852
  foreach my $data_dir (@data_dir_lst)
1819
1853
  {
1820
 
    mkpath("$data_dir/local/mysql");
1821
 
    system("$exe_schemawriter mysql $data_dir/local/mysql/db.opt");
 
1854
    mkpath("$data_dir/mysql");
 
1855
    system("$exe_schemawriter mysql $data_dir/mysql/db.opt");
1822
1856
 
1823
 
    mkpath("$data_dir/local/test");
1824
 
    system("$exe_schemawriter test $data_dir/local/test/db.opt");
 
1857
    mkpath("$data_dir/test");
 
1858
    system("$exe_schemawriter test $data_dir/test/db.opt");
1825
1859
  }
1826
1860
 
1827
1861
  # Make a link std_data_ln in var/ that points to std_data
1828
 
  symlink(collapse_path("$glob_drizzle_test_dir/std_data"),
 
1862
  symlink(collapse_path("$glob_mysql_test_dir/std_data"),
1829
1863
          "$opt_vardir/std_data_ln");
1830
1864
 
1831
 
  symlink(collapse_path("$glob_suite_path/filesystem_engine/tests/t"),
1832
 
          "$opt_vardir/filesystem_ln");
1833
 
 
1834
1865
  # Remove old log files
1835
1866
  foreach my $name (glob("r/*.progress r/*.log r/*.warnings"))
1836
1867
  {
1838
1869
  }
1839
1870
  system("chmod -R ugo+r $opt_vardir");
1840
1871
  system("chmod -R ugo+r $opt_vardir/std_data_ln/*");
1841
 
  system("chmod -R ugo+rw $opt_vardir/filesystem_ln/*");
1842
 
  system("chmod -R ugo+w $glob_suite_path/filesystem_engine/tests/t");
1843
1872
}
1844
1873
 
1845
1874
 
1847
1876
  # Check if running as root
1848
1877
  # i.e a file can be read regardless what mode we set it to
1849
1878
  my $test_file= "$opt_vardir/test_running_as_root.txt";
1850
 
  dtr_tofile($test_file, "Drizzle");
 
1879
  mtr_tofile($test_file, "MySQL");
1851
1880
  chmod(oct("0000"), $test_file);
1852
1881
 
1853
1882
  my $result="";
1863
1892
  my $file_mode= (stat($test_file))[2] & 07777;
1864
1893
 
1865
1894
  $ENV{'DRIZZLE_TEST_ROOT'}= "NO";
1866
 
  dtr_verbose("result: $result, file_mode: $file_mode");
1867
 
  if ($result eq "Drizzle" && $file_mode == 0)
 
1895
  mtr_verbose("result: $result, file_mode: $file_mode");
 
1896
  if ($result eq "MySQL" && $file_mode == 0)
1868
1897
  {
1869
 
    dtr_warning("running this script as _root_ will cause some " .
 
1898
    mtr_warning("running this script as _root_ will cause some " .
1870
1899
                "tests to be skipped");
1871
1900
    $ENV{'DRIZZLE_TEST_ROOT'}= "YES";
1872
1901
  }
1878
1907
 
1879
1908
 
1880
1909
sub check_debug_support ($) {
1881
 
  my $drizzled_variables= shift;
 
1910
  my $mysqld_variables= shift;
1882
1911
 
1883
 
  if ( ! $drizzled_variables->{'debug'} )
 
1912
  if ( ! $mysqld_variables->{'debug'} )
1884
1913
  {
1885
 
    #dtr_report("Binaries are not debug compiled");
 
1914
    #mtr_report("Binaries are not debug compiled");
1886
1915
    $debug_compiled_binaries= 0;
1887
1916
 
1888
1917
    if ( $opt_debug )
1889
1918
    {
1890
 
      dtr_error("Can't use --debug, binaries does not support it");
 
1919
      mtr_error("Can't use --debug, binaries does not support it");
1891
1920
    }
1892
1921
    return;
1893
1922
  }
1894
 
  dtr_report("Binaries are debug compiled");
 
1923
  mtr_report("Binaries are debug compiled");
1895
1924
  $debug_compiled_binaries= 1;
1896
1925
}
1897
1926
 
1908
1937
  my $args;
1909
1938
 
1910
1939
  {
1911
 
    drizzled_start($master->[0],[],[]);
 
1940
    mysqld_start($master->[0],[],[]);
1912
1941
    if ( ! $master->[0]->{'pid'} )
1913
1942
    {
1914
 
      dtr_error("Can't start the drizzled server");
 
1943
      mtr_error("Can't start the mysqld server");
1915
1944
    }
1916
1945
  }
1917
1946
 
1918
 
  dtr_init_args(\$args);
 
1947
  mtr_init_args(\$args);
1919
1948
 
1920
 
  dtr_add_arg($args, "--user=%s", $opt_user);
 
1949
  mtr_add_arg($args, "--user=%s", $opt_user);
1921
1950
 
1922
1951
  if ( $opt_small_bench )
1923
1952
  {
1924
 
    dtr_add_arg($args, "--small-test");
1925
 
    dtr_add_arg($args, "--small-tables");
 
1953
    mtr_add_arg($args, "--small-test");
 
1954
    mtr_add_arg($args, "--small-tables");
1926
1955
  }
1927
1956
 
1928
 
  chdir($glob_drizzle_bench_dir)
1929
 
    or dtr_error("Couldn't chdir to '$glob_drizzle_bench_dir': $!");
 
1957
  chdir($glob_mysql_bench_dir)
 
1958
    or mtr_error("Couldn't chdir to '$glob_mysql_bench_dir': $!");
1930
1959
 
1931
1960
  if ( ! $benchmark )
1932
1961
  {
1933
 
    dtr_run("$glob_drizzle_bench_dir/run-all-tests", $args, "", "", "", "");
 
1962
    mtr_run("$glob_mysql_bench_dir/run-all-tests", $args, "", "", "", "");
1934
1963
    # FIXME check result code?!
1935
1964
  }
1936
1965
  elsif ( -x $benchmark )
1937
1966
  {
1938
 
    dtr_run("$glob_drizzle_bench_dir/$benchmark", $args, "", "", "", "");
 
1967
    mtr_run("$glob_mysql_bench_dir/$benchmark", $args, "", "", "", "");
1939
1968
    # FIXME check result code?!
1940
1969
  }
1941
1970
  else
1942
1971
  {
1943
 
    dtr_error("Benchmark $benchmark not found");
 
1972
    mtr_error("Benchmark $benchmark not found");
1944
1973
  }
1945
1974
 
1946
 
  chdir($glob_drizzle_test_dir);          # Go back
 
1975
  chdir($glob_mysql_test_dir);          # Go back
1947
1976
 
1948
1977
  {
1949
1978
    stop_masters();
1960
1989
sub run_tests () {
1961
1990
  my ($tests)= @_;
1962
1991
 
1963
 
  dtr_print_thick_line();
1964
 
 
1965
 
  dtr_timer_start($glob_timers,"suite", 60 * $opt_suite_timeout);
1966
 
 
1967
 
  dtr_report_tests_not_skipped_though_disabled($tests);
1968
 
 
1969
 
  dtr_print_header();
 
1992
  mtr_print_thick_line();
 
1993
 
 
1994
  mtr_timer_start($glob_timers,"suite", 60 * $opt_suite_timeout);
 
1995
 
 
1996
  mtr_report_tests_not_skipped_though_disabled($tests);
 
1997
 
 
1998
  mtr_print_header();
1970
1999
 
1971
2000
  foreach my $tinfo ( @$tests )
1972
2001
  {
1977
2006
          next;
1978
2007
        }
1979
2008
 
1980
 
      dtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout);
 
2009
      mtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout);
1981
2010
      run_testcase($tinfo);
1982
 
      dtr_timer_stop($glob_timers,"testcase");
 
2011
      mtr_timer_stop($glob_timers,"testcase");
1983
2012
    }
1984
2013
  }
1985
2014
 
1986
 
  dtr_print_line();
 
2015
  mtr_print_line();
1987
2016
 
1988
2017
  if ( ! $glob_debugger and
1989
2018
       ! $opt_extern )
2000
2029
    gprof_collect(); # collect coverage information
2001
2030
  }
2002
2031
 
2003
 
  dtr_report_stats($tests);
 
2032
  mtr_report_stats($tests);
2004
2033
 
2005
 
  dtr_timer_stop($glob_timers,"suite");
 
2034
  mtr_timer_stop($glob_timers,"suite");
2006
2035
}
2007
2036
 
2008
2037
 
2022
2051
    # vardir does not already exist it should be created
2023
2052
    if ( ! -d $opt_vardir )
2024
2053
    {
2025
 
      dtr_report("Creating '$opt_vardir'");
 
2054
      mtr_report("Creating '$opt_vardir'");
2026
2055
      setup_vardir();
2027
2056
    }
2028
2057
    else
2029
2058
    {
2030
 
      dtr_verbose("No need to create '$opt_vardir' it already exists");
 
2059
      mtr_verbose("No need to create '$opt_vardir' it already exists");
2031
2060
    }
2032
2061
  }
2033
2062
  else
2039
2068
      remove_stale_vardir();
2040
2069
      setup_vardir();
2041
2070
 
2042
 
      drizzle_install_db();
 
2071
      mysql_install_db();
2043
2072
      if ( $opt_force )
2044
2073
      {
2045
2074
        # Save a snapshot of the freshly installed db
2050
2079
  }
2051
2080
  check_running_as_root();
2052
2081
 
2053
 
  dtr_log_init("$opt_vardir/log/drizzle-test-run.log");
 
2082
  mtr_log_init("$opt_vardir/log/drizzle-test-run.log");
2054
2083
 
2055
2084
}
2056
2085
 
2057
 
sub drizzle_install_db () {
 
2086
sub mysql_install_db () {
2058
2087
 
2059
2088
  if ($max_master_num > 1)
2060
2089
  {
2061
 
    copy_install_db('master', $master->[1]->{'path_myddir'} . "/local");
 
2090
    copy_install_db('master', $master->[1]->{'path_myddir'});
2062
2091
  }
2063
2092
 
2064
2093
  # Install the number of slave databses needed
2075
2104
  my $type=      shift;
2076
2105
  my $data_dir=  shift;
2077
2106
 
2078
 
  dtr_report("Installing \u$type Database");
 
2107
  mtr_report("Installing \u$type Database");
2079
2108
 
2080
2109
  # Just copy the installed db from first master
2081
 
  dtr_copy_dir($master->[0]->{'path_myddir'}, $data_dir);
 
2110
  mtr_copy_dir($master->[0]->{'path_myddir'}, $data_dir);
2082
2111
 
2083
2112
}
2084
2113
 
2096
2125
    {
2097
2126
      my $data_dir= $slave->[$idx]->{'path_myddir'};
2098
2127
      my $name= basename($data_dir);
2099
 
      dtr_rmtree($data_dir);
2100
 
      dtr_copy_dir("$path_snapshot/$name", $data_dir);
 
2128
      mtr_rmtree($data_dir);
 
2129
      mtr_copy_dir("$path_snapshot/$name", $data_dir);
2101
2130
    }
2102
2131
  }
2103
2132
}
2116
2145
 
2117
2146
  if ( $tinfo->{'skip'} )
2118
2147
  {
2119
 
    dtr_report_test_name($tinfo);
2120
 
    dtr_report_test_skipped($tinfo);
 
2148
    mtr_report_test_name($tinfo);
 
2149
    mtr_report_test_skipped($tinfo);
2121
2150
    return 1;
2122
2151
  }
2123
2152
 
2131
2160
  my $args;
2132
2161
 
2133
2162
  # Remove old files produced by drizzletest
2134
 
  my $base_file= dtr_match_extension($tinfo->{'result_file'},
 
2163
  my $base_file= mtr_match_extension($tinfo->{'result_file'},
2135
2164
                                    "result"); # Trim extension
2136
2165
  unlink("$base_file.reject");
2137
2166
  unlink("$base_file.progress");
2145
2174
  my $tinfo= shift;
2146
2175
 
2147
2176
  # Save info from this testcase run to drizzletest.log
2148
 
  dtr_appendfile_to_file($path_current_test_log, $path_drizzletest_log)
 
2177
  mtr_appendfile_to_file($path_current_test_log, $path_drizzletest_log)
2149
2178
    if -f $path_current_test_log;
2150
 
  dtr_appendfile_to_file($path_timefile, $path_drizzletest_log)
 
2179
  mtr_appendfile_to_file($path_timefile, $path_drizzletest_log)
2151
2180
    if -f $path_timefile;
2152
2181
}
2153
2182
 
2159
2188
  # Write a marker to all log files
2160
2189
 
2161
2190
  # The file indicating current test name
2162
 
  dtr_tonewfile($path_current_test_log, $log_msg);
 
2191
  mtr_tonewfile($path_current_test_log, $log_msg);
2163
2192
 
2164
 
  # each drizzled's .err file
2165
 
  foreach my $drizzled (@{$master}, @{$slave})
 
2193
  # each mysqld's .err file
 
2194
  foreach my $mysqld (@{$master}, @{$slave})
2166
2195
  {
2167
 
    dtr_tofile($drizzled->{path_myerr}, $log_msg);
 
2196
    mtr_tofile($mysqld->{path_myerr}, $log_msg);
2168
2197
  }
2169
2198
 
2170
2199
}
2192
2221
 
2193
2222
  if ( ! $reason )
2194
2223
  {
2195
 
    dtr_warning("Could not find reason for skipping test in $path_timefile");
 
2224
    mtr_warning("Could not find reason for skipping test in $path_timefile");
2196
2225
    $reason= "Detected by testcase(reason unknown) ";
2197
2226
  }
2198
2227
  $tinfo->{'comment'}= $reason;
2212
2241
 
2213
2242
# We don't start and kill the servers for each testcase. But some
2214
2243
# testcases needs a restart, because they specify options to start
2215
 
# drizzled with. After that testcase, we need to restart again, to set
 
2244
# mysqld with. After that testcase, we need to restart again, to set
2216
2245
# back the normal options.
2217
2246
 
2218
2247
sub run_testcase ($) {
2223
2252
  # -------------------------------------------------------
2224
2253
 
2225
2254
  $ENV{'TZ'}= $tinfo->{'timezone'};
2226
 
  dtr_verbose("Setting timezone: $tinfo->{'timezone'}");
 
2255
  mtr_verbose("Setting timezone: $tinfo->{'timezone'}");
2227
2256
 
2228
2257
  my $master_restart= run_testcase_need_master_restart($tinfo);
2229
2258
  my $slave_restart= run_testcase_need_slave_restart($tinfo);
2233
2262
    # Can't restart a running server that may be in use
2234
2263
    if ( $opt_extern )
2235
2264
    {
2236
 
      dtr_report_test_name($tinfo);
 
2265
      mtr_report_test_name($tinfo);
2237
2266
      $tinfo->{comment}= "Can't restart a running server";
2238
 
      dtr_report_test_skipped($tinfo);
 
2267
      mtr_report_test_skipped($tinfo);
2239
2268
      return;
2240
2269
    }
2241
2270
 
2245
2274
  # Write to all log files to indicate start of testcase
2246
2275
  run_testcase_mark_logs($tinfo, "CURRENT_TEST: $tinfo->{name}\n");
2247
2276
 
2248
 
  my $died= dtr_record_dead_children();
 
2277
  my $died= mtr_record_dead_children();
2249
2278
  if ($died or $master_restart or $slave_restart)
2250
2279
  {
2251
2280
    if (run_testcase_start_servers($tinfo))
2252
2281
    {
2253
 
      dtr_report_test_name($tinfo);
 
2282
      mtr_report_test_name($tinfo);
2254
2283
      report_failure_and_restart($tinfo);
2255
2284
      return 1;
2256
2285
    }
2261
2290
  # ----------------------------------------------------------------------
2262
2291
  if ( $opt_start_and_exit or $opt_start_dirty )
2263
2292
  {
2264
 
    dtr_timer_stop_all($glob_timers);
2265
 
    dtr_report("\nServers started, exiting");
 
2293
    mtr_timer_stop_all($glob_timers);
 
2294
    mtr_report("\nServers started, exiting");
2266
2295
    exit(0);
2267
2296
  }
2268
2297
 
2270
2299
    do_before_run_drizzletest($tinfo);
2271
2300
 
2272
2301
    my $res= run_drizzletest($tinfo);
2273
 
    dtr_report_test_name($tinfo);
 
2302
    mtr_report_test_name($tinfo);
2274
2303
 
2275
2304
    do_after_run_drizzletest($tinfo);
2276
2305
 
2277
2306
    if ( $res == 0 )
2278
2307
    {
2279
 
      dtr_report_test_passed($tinfo);
 
2308
      mtr_report_test_passed($tinfo);
2280
2309
    }
2281
2310
    elsif ( $res == 62 )
2282
2311
    {
2284
2313
 
2285
2314
      # Try to get reason from drizzletest.log
2286
2315
      find_testcase_skipped_reason($tinfo);
2287
 
      dtr_report_test_skipped($tinfo);
 
2316
      mtr_report_test_skipped($tinfo);
2288
2317
    }
2289
2318
    elsif ( $res == 63 )
2290
2319
    {
2320
2349
#
2321
2350
sub save_installed_db () {
2322
2351
 
2323
 
  dtr_report("Saving snapshot of installed databases");
2324
 
  dtr_rmtree($path_snapshot);
 
2352
  mtr_report("Saving snapshot of installed databases");
 
2353
  mtr_rmtree($path_snapshot);
2325
2354
 
2326
2355
  foreach my $data_dir (@data_dir_lst)
2327
2356
  {
2328
2357
    my $name= basename($data_dir);
2329
 
    dtr_copy_dir("$data_dir", "$path_snapshot/$name");
 
2358
    mtr_copy_dir("$data_dir", "$path_snapshot/$name");
2330
2359
  }
2331
2360
}
2332
2361
 
2345
2374
  {
2346
2375
    last if $opt_max_save_core > 0 && $num_saved_cores >= $opt_max_save_core;
2347
2376
    my $core_name= basename($core_file);
2348
 
    dtr_report("Saving $core_name");
 
2377
    mtr_report("Saving $core_name");
2349
2378
    mkdir($save_name) if ! -d $save_name;
2350
2379
    rename("$core_file", "$save_name/$core_name");
2351
2380
    ++$num_saved_cores;
2362
2391
 
2363
2392
  if ( -d $path_snapshot)
2364
2393
  {
2365
 
    dtr_report("Restoring snapshot of databases");
 
2394
    mtr_report("Restoring snapshot of databases");
2366
2395
 
2367
2396
    foreach my $data_dir (@data_dir_lst)
2368
2397
    {
2369
2398
      my $name= basename($data_dir);
2370
2399
      save_files_before_restore($test_name, $data_dir);
2371
 
      dtr_rmtree("$data_dir");
2372
 
      dtr_copy_dir("$path_snapshot/$name", "$data_dir");
 
2400
      mtr_rmtree("$data_dir");
 
2401
      mtr_copy_dir("$path_snapshot/$name", "$data_dir");
2373
2402
    }
2374
2403
  }
2375
2404
  else
2376
2405
  {
2377
2406
    # No snapshot existed
2378
 
    dtr_error("No snapshot existed");
 
2407
    mtr_error("No snapshot existed");
2379
2408
  }
2380
2409
}
2381
2410
 
2382
2411
sub report_failure_and_restart ($) {
2383
2412
  my $tinfo= shift;
2384
2413
 
2385
 
  dtr_report_test_failed($tinfo);
 
2414
  mtr_report_test_failed($tinfo);
2386
2415
  print "\n";
2387
2416
  if ( $opt_force )
2388
2417
  {
2391
2420
 
2392
2421
    # Restore the snapshot of the installed test db
2393
2422
    restore_installed_db($tinfo->{'name'});
2394
 
    dtr_report("Resuming Tests\n");
 
2423
    mtr_report("Resuming Tests\n");
2395
2424
    return;
2396
2425
  }
2397
2426
 
2398
2427
  my $test_mode= join(" ", @::glob_test_mode) || "default";
2399
 
  dtr_report("Aborting: $tinfo->{'name'} failed in $test_mode mode. ");
2400
 
  dtr_report("To continue, re-run with '--force'.");
 
2428
  mtr_report("Aborting: $tinfo->{'name'} failed in $test_mode mode. ");
 
2429
  mtr_report("To continue, re-run with '--force'.");
2401
2430
  if ( ! $glob_debugger and
2402
2431
       ! $opt_extern )
2403
2432
  {
2404
2433
    stop_all_servers();
2405
2434
  }
2406
 
  dtr_exit(1);
 
2435
  mtr_exit(1);
2407
2436
 
2408
2437
}
2409
2438
 
2415
2444
  # Run master initialization shell script if one exists
2416
2445
  if ( $init_script )
2417
2446
  {
2418
 
    my $ret= dtr_run("/bin/sh", [$init_script], "", "", "", "");
 
2447
    my $ret= mtr_run("/bin/sh", [$init_script], "", "", "", "");
2419
2448
    if ( $ret != 0 )
2420
2449
    {
2421
2450
      # FIXME rewrite those scripts to return 0 if successful
2422
 
      # dtr_warning("$init_script exited with code $ret");
 
2451
      # mtr_warning("$init_script exited with code $ret");
2423
2452
    }
2424
2453
  }
2425
2454
}
2478
2507
  # Run slave initialization shell script if one exists
2479
2508
  if ( $init_script )
2480
2509
  {
2481
 
    my $ret= dtr_run("/bin/sh", [$init_script], "", "", "", "");
 
2510
    my $ret= mtr_run("/bin/sh", [$init_script], "", "", "", "");
2482
2511
    if ( $ret != 0 )
2483
2512
    {
2484
2513
      # FIXME rewrite those scripts to return 0 if successful
2485
 
      # dtr_warning("$init_script exited with code $ret");
 
2514
      # mtr_warning("$init_script exited with code $ret");
2486
2515
    }
2487
2516
  }
2488
2517
 
2493
2522
}
2494
2523
 
2495
2524
 
2496
 
sub drizzled_arguments ($$$$) {
 
2525
sub mysqld_arguments ($$$$) {
2497
2526
  my $args=              shift;
2498
 
  my $drizzled=            shift;
 
2527
  my $mysqld=            shift;
2499
2528
  my $extra_opt=         shift;
2500
2529
  my $slave_master_info= shift;
2501
2530
 
2502
 
  my $idx= $drizzled->{'idx'};
 
2531
  my $idx= $mysqld->{'idx'};
2503
2532
  my $sidx= "";                 # Index as string, 0 is empty string
2504
2533
  if ( $idx> 0 )
2505
2534
  {
2508
2537
 
2509
2538
  my $prefix= "";               # If drizzletest server arg
2510
2539
 
2511
 
  dtr_add_arg($args, "%s--no-defaults", $prefix);
 
2540
  mtr_add_arg($args, "%s--no-defaults", $prefix);
 
2541
 
 
2542
  $path_my_basedir= collapse_path($path_my_basedir);
 
2543
  mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir);
2512
2544
 
2513
2545
  if ($opt_engine)
2514
2546
  {
2515
 
    dtr_add_arg($args, "%s--default-storage-engine=%s", $prefix, $opt_engine);
 
2547
    mtr_add_arg($args, "%s--default-storage-engine=%s", $prefix, $opt_engine);
2516
2548
  }
2517
2549
 
2518
2550
  if ( $drizzle_version_id >= 50036)
2519
2551
  {
2520
 
    # By default, prevent the started drizzled to access files outside of vardir
2521
 
    dtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir);
 
2552
    # By default, prevent the started mysqld to access files outside of vardir
 
2553
    mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir);
2522
2554
  }
2523
2555
 
2524
 
  dtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
 
2556
  mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
2525
2557
 
2526
2558
  # Increase default connect_timeout to avoid intermittent
2527
2559
  # disconnects when test servers are put under load
2528
2560
  # see BUG#28359
2529
 
  dtr_add_arg($args, "%s--mysql-protocol.connect-timeout=60", $prefix);
2530
 
 
2531
 
 
2532
 
  # When drizzled is run by a root user(euid is 0), it will fail
 
2561
  mtr_add_arg($args, "%s--mysql-protocol.connect-timeout=60", $prefix);
 
2562
 
 
2563
 
 
2564
  # When mysqld is run by a root user(euid is 0), it will fail
2533
2565
  # to start unless we specify what user to run as, see BUG#30630
2534
2566
  my $euid= $>;
2535
 
  if (grep(/^--user/, @$extra_opt, @opt_extra_drizzled_opt) == 0) {
2536
 
    dtr_add_arg($args, "%s--user=root", $prefix);
 
2567
  if (grep(/^--user/, @$extra_opt, @opt_extra_mysqld_opt) == 0) {
 
2568
    mtr_add_arg($args, "%s--user=root", $prefix);
2537
2569
  }
2538
2570
 
2539
 
  dtr_add_arg($args, "%s--pid-file=%s", $prefix,
2540
 
              $drizzled->{'path_pid'});
2541
 
 
2542
 
  dtr_add_arg($args, "%s--mysql-protocol.port=%d", $prefix,
2543
 
              $drizzled->{'port'});
2544
 
 
2545
 
  dtr_add_arg($args, "%s--drizzle-protocol.port=%d", $prefix,
2546
 
              $drizzled->{'secondary_port'});
2547
 
 
2548
 
  dtr_add_arg($args, "%s--datadir=%s", $prefix,
2549
 
              $drizzled->{'path_myddir'});
2550
 
 
2551
 
  dtr_add_arg($args, "%s--mysql-unix-socket-protocol.path=%s", $prefix,
2552
 
              $drizzled->{'path_sock'});
 
2571
  mtr_add_arg($args, "%s--pid-file=%s", $prefix,
 
2572
              $mysqld->{'path_pid'});
 
2573
 
 
2574
  mtr_add_arg($args, "%s--mysql-protocol.port=%d", $prefix,
 
2575
              $mysqld->{'port'});
 
2576
 
 
2577
  mtr_add_arg($args, "%s--drizzle-protocol.port=%d", $prefix,
 
2578
              $mysqld->{'secondary_port'});
 
2579
 
 
2580
  mtr_add_arg($args, "%s--datadir=%s", $prefix,
 
2581
              $mysqld->{'path_myddir'});
2553
2582
 
2554
2583
  # Check if "extra_opt" contains --skip-log-bin
2555
 
  if ( $drizzled->{'type'} eq 'master' )
 
2584
  if ( $mysqld->{'type'} eq 'master' )
2556
2585
  {
2557
 
    dtr_add_arg($args, "%s--server-id=%d", $prefix,
 
2586
    mtr_add_arg($args, "%s--server-id=%d", $prefix,
2558
2587
               $idx > 0 ? $idx + 101 : 1);
2559
2588
 
2560
 
    dtr_add_arg($args,
2561
 
      "%s--innodb.data-file-path=ibdata1:20M:autoextend", $prefix);
 
2589
    mtr_add_arg($args,
 
2590
      "%s--loose-innodb_data_file_path=ibdata1:20M:autoextend", $prefix);
 
2591
 
 
2592
    mtr_add_arg($args, "%s--loose-innodb-lock-wait-timeout=5", $prefix);
2562
2593
 
2563
2594
  }
2564
2595
  else
2565
2596
  {
2566
 
    dtr_error("unknown drizzled type")
2567
 
      unless $drizzled->{'type'} eq 'slave';
 
2597
    mtr_error("unknown mysqld type")
 
2598
      unless $mysqld->{'type'} eq 'slave';
2568
2599
 
2569
2600
    # Directory where slaves find the dumps generated by "load data"
2570
2601
    # on the server. The path need to have constant length otherwise
2575
2606
    {
2576
2607
      foreach my $arg ( @$slave_master_info )
2577
2608
      {
2578
 
        dtr_add_arg($args, "%s%s", $prefix, $arg);
 
2609
        mtr_add_arg($args, "%s%s", $prefix, $arg);
2579
2610
      }
2580
2611
    }
2581
2612
    else
2582
2613
    {
2583
2614
      my $slave_server_id=  2 + $idx;
2584
2615
      my $slave_rpl_rank= $slave_server_id;
2585
 
      dtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id);
 
2616
      mtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id);
2586
2617
    }
2587
2618
  } # end slave
2588
2619
 
2589
2620
  if ( $opt_debug )
2590
2621
  {
2591
 
    dtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/%s%s.trace",
2592
 
                $prefix, $path_vardir_trace, $drizzled->{'type'}, $sidx);
 
2622
    mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/%s%s.trace",
 
2623
                $prefix, $path_vardir_trace, $mysqld->{'type'}, $sidx);
2593
2624
  }
2594
2625
 
2595
 
  dtr_add_arg($args, "%s--sort-buffer-size=256K", $prefix);
2596
 
  dtr_add_arg($args, "%s--max-heap-table-size=1M", $prefix);
 
2626
  mtr_add_arg($args, "%s--myisam_key_cache_size=1M", $prefix);
 
2627
  mtr_add_arg($args, "%s--sort_buffer=256K", $prefix);
 
2628
  mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix);
2597
2629
 
2598
2630
  if ( $opt_warnings )
2599
2631
  {
2600
 
    dtr_add_arg($args, "%s--log-warnings", $prefix);
 
2632
    mtr_add_arg($args, "%s--log-warnings", $prefix);
2601
2633
  }
2602
2634
 
2603
 
  # Indicate to "drizzled" it will be debugged in debugger
 
2635
  # Indicate to "mysqld" it will be debugged in debugger
2604
2636
  if ( $glob_debugger )
2605
2637
  {
2606
 
    dtr_add_arg($args, "%s--gdb", $prefix);
 
2638
    mtr_add_arg($args, "%s--gdb", $prefix);
2607
2639
  }
2608
2640
 
2609
2641
  my $found_skip_core= 0;
2610
 
  foreach my $arg ( @opt_extra_drizzled_opt, @$extra_opt )
 
2642
  foreach my $arg ( @opt_extra_mysqld_opt, @$extra_opt )
2611
2643
  {
2612
2644
    # Allow --skip-core-file to be set in <testname>-[master|slave].opt file
2613
2645
    if ($arg eq "--skip-core-file")
2616
2648
    }
2617
2649
    else
2618
2650
    {
2619
 
      dtr_add_arg($args, "%s%s", $prefix, $arg);
 
2651
      mtr_add_arg($args, "%s%s", $prefix, $arg);
2620
2652
    }
2621
2653
  }
2622
2654
  if ( !$found_skip_core )
2623
2655
  {
2624
 
    dtr_add_arg($args, "%s%s", $prefix, "--core-file");
 
2656
    mtr_add_arg($args, "%s%s", $prefix, "--core-file");
2625
2657
  }
2626
2658
 
2627
2659
  return $args;
2630
2662
 
2631
2663
##############################################################################
2632
2664
#
2633
 
#  Start drizzled and return the PID
 
2665
#  Start mysqld and return the PID
2634
2666
#
2635
2667
##############################################################################
2636
2668
 
2637
 
sub drizzled_start ($$$) {
2638
 
  my $drizzled=            shift;
 
2669
sub mysqld_start ($$$) {
 
2670
  my $mysqld=            shift;
2639
2671
  my $extra_opt=         shift;
2640
2672
  my $slave_master_info= shift;
2641
2673
 
2644
2676
  my $pid= -1;
2645
2677
  my $wait_for_pid_file= 1;
2646
2678
 
2647
 
  my $type= $drizzled->{'type'};
2648
 
  my $idx= $drizzled->{'idx'};
 
2679
  my $type= $mysqld->{'type'};
 
2680
  my $idx= $mysqld->{'idx'};
2649
2681
 
2650
2682
  if ( $type eq 'master' )
2651
2683
  {
2652
 
    $exe= $exe_master_drizzled;
 
2684
    $exe= $exe_master_mysqld;
2653
2685
  }
2654
2686
  elsif ( $type eq 'slave' )
2655
2687
  {
2656
 
    $exe= $exe_slave_drizzled;
 
2688
    $exe= $exe_slave_mysqld;
2657
2689
  }
2658
2690
  else
2659
2691
  {
2660
 
    dtr_error("Unknown 'type' \"$type\" passed to drizzled_start");
 
2692
    mtr_error("Unknown 'type' \"$type\" passed to mysqld_start");
2661
2693
  }
2662
2694
 
2663
 
  dtr_init_args(\$args);
 
2695
  mtr_init_args(\$args);
2664
2696
 
2665
 
  if ( $opt_valgrind_drizzled )
 
2697
  if ( $opt_valgrind_mysqld )
2666
2698
  {
2667
2699
    valgrind_arguments($args, \$exe);
2668
2700
  }
2669
2701
 
2670
 
  drizzled_arguments($args,$drizzled,$extra_opt,$slave_master_info);
 
2702
  mysqld_arguments($args,$mysqld,$extra_opt,$slave_master_info);
2671
2703
 
2672
2704
  if ( $opt_gdb || $opt_manual_gdb)
2673
2705
  {
2688
2720
  elsif ( $opt_manual_debug )
2689
2721
  {
2690
2722
     print "\nStart $type in your debugger\n" .
2691
 
           "dir: $glob_drizzle_test_dir\n" .
 
2723
           "dir: $glob_mysql_test_dir\n" .
2692
2724
           "exe: $exe\n" .
2693
2725
           "args:  " . join(" ", @$args)  . "\n\n" .
2694
2726
           "Waiting ....\n";
2703
2735
  }
2704
2736
 
2705
2737
  # Remove the pidfile
2706
 
  unlink($drizzled->{'path_pid'});
 
2738
  unlink($mysqld->{'path_pid'});
2707
2739
 
2708
2740
  if ( defined $exe )
2709
2741
  {
2710
 
    dtr_verbose("running Drizzle with: $exe @$args");
2711
 
    $pid= dtr_spawn($exe, $args, "",
2712
 
                    $drizzled->{'path_myerr'},
2713
 
                    $drizzled->{'path_myerr'},
 
2742
    mtr_verbose("running Drizzle with: $exe @$args");
 
2743
    $pid= mtr_spawn($exe, $args, "",
 
2744
                    $mysqld->{'path_myerr'},
 
2745
                    $mysqld->{'path_myerr'},
2714
2746
                    "",
2715
2747
                    { append_log_file => 1 });
2716
2748
  }
2717
2749
 
2718
2750
 
2719
 
  if ( $wait_for_pid_file && !sleep_until_file_created($drizzled->{'path_pid'},
2720
 
                                                       $drizzled->{'start_timeout'},
 
2751
  if ( $wait_for_pid_file && !sleep_until_file_created($mysqld->{'path_pid'},
 
2752
                                                       $mysqld->{'start_timeout'},
2721
2753
                                                       $pid))
2722
2754
  {
2723
2755
 
2724
 
    dtr_error("Failed to start drizzled $drizzled->{'type'}");
 
2756
    mtr_error("Failed to start mysqld $mysqld->{'type'}");
2725
2757
  }
2726
2758
 
2727
2759
 
2728
2760
  # Remember pid of the started process
2729
 
  $drizzled->{'pid'}= $pid;
 
2761
  $mysqld->{'pid'}= $pid;
2730
2762
 
2731
2763
  # Remember options used when starting
2732
 
  $drizzled->{'start_opts'}= $extra_opt;
2733
 
  $drizzled->{'start_slave_master_info'}= $slave_master_info;
 
2764
  $mysqld->{'start_opts'}= $extra_opt;
 
2765
  $mysqld->{'start_slave_master_info'}= $slave_master_info;
2734
2766
 
2735
 
  dtr_verbose("drizzled pid: $pid");
 
2767
  mtr_verbose("mysqld pid: $pid");
2736
2768
  return $pid;
2737
2769
}
2738
2770
 
2739
2771
 
2740
2772
sub stop_all_servers () {
2741
2773
 
2742
 
  dtr_report("Stopping All Servers");
 
2774
  mtr_report("Stopping All Servers");
2743
2775
 
2744
2776
  my %admin_pids; # hash of admin processes that requests shutdown
2745
2777
  my @kill_pids;  # list of processes to shutdown/kill
2746
2778
  my $pid;
2747
2779
 
2748
2780
  # Start shutdown of all started masters
2749
 
  foreach my $drizzled (@{$slave}, @{$master})
 
2781
  foreach my $mysqld (@{$slave}, @{$master})
2750
2782
  {
2751
 
    if ( $drizzled->{'pid'} )
 
2783
    if ( $mysqld->{'pid'} )
2752
2784
    {
2753
 
      $pid= dtr_server_shutdown($drizzled);
 
2785
      $pid= mtr_server_shutdown($mysqld);
2754
2786
      $admin_pids{$pid}= 1;
2755
2787
 
2756
2788
      push(@kill_pids,{
2757
 
                       pid      => $drizzled->{'pid'},
2758
 
                       real_pid => $drizzled->{'real_pid'},
2759
 
                       pidfile  => $drizzled->{'path_pid'},
2760
 
                       sockfile => $drizzled->{'path_sock'},
2761
 
                       port     => $drizzled->{'port'},
2762
 
                       errfile  => $drizzled->{'path_myerr'},
 
2789
                       pid      => $mysqld->{'pid'},
 
2790
                       real_pid => $mysqld->{'real_pid'},
 
2791
                       pidfile  => $mysqld->{'path_pid'},
 
2792
                       sockfile => $mysqld->{'path_sock'},
 
2793
                       port     => $mysqld->{'port'},
 
2794
                       errfile  => $mysqld->{'path_myerr'},
2763
2795
                      });
2764
2796
 
2765
 
      $drizzled->{'pid'}= 0; # Assume we are done with it
 
2797
      $mysqld->{'pid'}= 0; # Assume we are done with it
2766
2798
    }
2767
2799
  }
2768
2800
 
2769
2801
  # Wait blocking until all shutdown processes has completed
2770
 
  dtr_wait_blocking(\%admin_pids);
 
2802
  mtr_wait_blocking(\%admin_pids);
2771
2803
 
2772
2804
  # Make sure that process has shutdown else try to kill them
2773
 
  dtr_check_stop_servers(\@kill_pids);
 
2805
  mtr_check_stop_servers(\@kill_pids);
2774
2806
}
2775
2807
 
2776
2808
 
2784
2816
  if ( $tinfo->{'master_sh'} )
2785
2817
  {
2786
2818
    $do_restart= 1;           # Always restart if script to run
2787
 
    dtr_verbose("Restart master: Always restart if script to run");
 
2819
    mtr_verbose("Restart master: Always restart if script to run");
2788
2820
  }
2789
2821
  if ( $tinfo->{'force_restart'} )
2790
2822
  {
2791
2823
    $do_restart= 1; # Always restart if --force-restart in -opt file
2792
 
    dtr_verbose("Restart master: Restart forced with --force-restart");
 
2824
    mtr_verbose("Restart master: Restart forced with --force-restart");
2793
2825
  }
2794
2826
  elsif( $tinfo->{'component_id'} eq 'im' )
2795
2827
  {
2796
2828
    $do_restart= 1;
2797
 
    dtr_verbose("Restart master: Always restart for im tests");
 
2829
    mtr_verbose("Restart master: Always restart for im tests");
2798
2830
  }
2799
2831
  elsif ( $master->[0]->{'running_master_options'} and
2800
2832
          $master->[0]->{'running_master_options'}->{'timezone'} ne
2801
2833
          $tinfo->{'timezone'})
2802
2834
  {
2803
2835
    $do_restart= 1;
2804
 
    dtr_verbose("Restart master: Different timezone");
 
2836
    mtr_verbose("Restart master: Different timezone");
2805
2837
  }
2806
2838
  # Check that running master was started with same options
2807
2839
  # as the current test requires
2808
 
  elsif (! dtr_same_opts($master->[0]->{'start_opts'},
 
2840
  elsif (! mtr_same_opts($master->[0]->{'start_opts'},
2809
2841
                         $tinfo->{'master_opt'}) )
2810
2842
  {
2811
2843
    # Chech that diff is binlog format only
2812
 
    my $diff_opts= dtr_diff_opts($master->[0]->{'start_opts'},$tinfo->{'master_opt'});
 
2844
    my $diff_opts= mtr_diff_opts($master->[0]->{'start_opts'},$tinfo->{'master_opt'});
2813
2845
    if (scalar(@$diff_opts) eq 2) 
2814
2846
    {
2815
2847
      $do_restart= 1;
2817
2849
    else
2818
2850
    {
2819
2851
      $do_restart= 1;
2820
 
      dtr_verbose("Restart master: running with different options '" .
 
2852
      mtr_verbose("Restart master: running with different options '" .
2821
2853
                 join(" ", @{$tinfo->{'master_opt'}}) . "' != '" .
2822
2854
                join(" ", @{$master->[0]->{'start_opts'}}) . "'" );
2823
2855
    }
2827
2859
    if ( $opt_extern )
2828
2860
    {
2829
2861
      $do_restart= 0;
2830
 
      dtr_verbose("No restart: using extern master");
 
2862
      mtr_verbose("No restart: using extern master");
2831
2863
    }
2832
2864
    else
2833
2865
    {
2834
2866
      $do_restart= 1;
2835
 
      dtr_verbose("Restart master: master is not started");
 
2867
      mtr_verbose("Restart master: master is not started");
2836
2868
    }
2837
2869
  }
2838
2870
  return $do_restart;
2847
2879
 
2848
2880
  if ( $max_slave_num == 0)
2849
2881
  {
2850
 
    dtr_verbose("Skip slave restart: No testcase use slaves");
 
2882
    mtr_verbose("Skip slave restart: No testcase use slaves");
2851
2883
  }
2852
2884
  else
2853
2885
  {
2854
2886
 
2855
2887
    # Check if any slave is currently started
2856
2888
    my $any_slave_started= 0;
2857
 
    foreach my $drizzled (@{$slave})
 
2889
    foreach my $mysqld (@{$slave})
2858
2890
    {
2859
 
      if ( $drizzled->{'pid'} )
 
2891
      if ( $mysqld->{'pid'} )
2860
2892
      {
2861
2893
        $any_slave_started= 1;
2862
2894
        last;
2865
2897
 
2866
2898
    if ($any_slave_started)
2867
2899
    {
2868
 
      dtr_verbose("Restart slave: Slave is started, always restart");
 
2900
      mtr_verbose("Restart slave: Slave is started, always restart");
2869
2901
      $do_slave_restart= 1;
2870
2902
    }
2871
2903
    elsif ( $tinfo->{'slave_num'} )
2872
2904
    {
2873
 
      dtr_verbose("Restart slave: Test need slave");
 
2905
      mtr_verbose("Restart slave: Test need slave");
2874
2906
      $do_slave_restart= 1;
2875
2907
    }
2876
2908
  }
2904
2936
    delete $master->[0]->{'running_master_options'}; # Forget history
2905
2937
 
2906
2938
    # Start shutdown of all started masters
2907
 
    foreach my $drizzled (@{$master})
 
2939
    foreach my $mysqld (@{$master})
2908
2940
    {
2909
 
      if ( $drizzled->{'pid'} )
 
2941
      if ( $mysqld->{'pid'} )
2910
2942
      {
2911
 
        $pid= dtr_server_shutdown($drizzled);
 
2943
        $pid= mtr_server_shutdown($mysqld);
2912
2944
 
2913
2945
        $admin_pids{$pid}= 1;
2914
2946
 
2915
2947
        push(@kill_pids,{
2916
 
              pid      => $drizzled->{'pid'},
2917
 
              real_pid => $drizzled->{'real_pid'},
2918
 
              pidfile  => $drizzled->{'path_pid'},
2919
 
              sockfile => $drizzled->{'path_sock'},
2920
 
              port     => $drizzled->{'port'},
2921
 
              errfile   => $drizzled->{'path_myerr'},
 
2948
              pid      => $mysqld->{'pid'},
 
2949
              real_pid => $mysqld->{'real_pid'},
 
2950
              pidfile  => $mysqld->{'path_pid'},
 
2951
              sockfile => $mysqld->{'path_sock'},
 
2952
              port     => $mysqld->{'port'},
 
2953
              errfile   => $mysqld->{'path_myerr'},
2922
2954
        });
2923
2955
 
2924
 
        $drizzled->{'pid'}= 0; # Assume we are done with it
 
2956
        $mysqld->{'pid'}= 0; # Assume we are done with it
2925
2957
      }
2926
2958
    }
2927
2959
  }
2932
2964
    delete $slave->[0]->{'running_slave_options'}; # Forget history
2933
2965
 
2934
2966
    # Start shutdown of all started slaves
2935
 
    foreach my $drizzled (@{$slave})
 
2967
    foreach my $mysqld (@{$slave})
2936
2968
    {
2937
 
      if ( $drizzled->{'pid'} )
 
2969
      if ( $mysqld->{'pid'} )
2938
2970
      {
2939
 
        $pid= dtr_server_shutdown($drizzled);
 
2971
        $pid= mtr_server_shutdown($mysqld);
2940
2972
 
2941
2973
        $admin_pids{$pid}= 1;
2942
2974
 
2943
2975
        push(@kill_pids,{
2944
 
              pid      => $drizzled->{'pid'},
2945
 
              real_pid => $drizzled->{'real_pid'},
2946
 
              pidfile  => $drizzled->{'path_pid'},
2947
 
              sockfile => $drizzled->{'path_sock'},
2948
 
              port     => $drizzled->{'port'},
2949
 
              errfile  => $drizzled->{'path_myerr'},
 
2976
              pid      => $mysqld->{'pid'},
 
2977
              real_pid => $mysqld->{'real_pid'},
 
2978
              pidfile  => $mysqld->{'path_pid'},
 
2979
              sockfile => $mysqld->{'path_sock'},
 
2980
              port     => $mysqld->{'port'},
 
2981
              errfile  => $mysqld->{'path_myerr'},
2950
2982
        });
2951
2983
 
2952
 
        $drizzled->{'pid'}= 0; # Assume we are done with it
 
2984
        $mysqld->{'pid'}= 0; # Assume we are done with it
2953
2985
      }
2954
2986
    }
2955
2987
  }
2960
2992
  # ----------------------------------------------------------------------
2961
2993
 
2962
2994
  # Wait blocking until all shutdown processes has completed
2963
 
  dtr_wait_blocking(\%admin_pids);
 
2995
  mtr_wait_blocking(\%admin_pids);
2964
2996
 
2965
2997
 
2966
2998
  # Make sure that process has shutdown else try to kill them
2967
 
  dtr_check_stop_servers(\@kill_pids);
 
2999
  mtr_check_stop_servers(\@kill_pids);
2968
3000
}
2969
3001
 
2970
3002
 
2982
3014
  my $tinfo= shift;
2983
3015
  my $tname= $tinfo->{'name'};
2984
3016
 
2985
 
  if ( $tinfo->{'component_id'} eq 'drizzled' )
 
3017
  if ( $tinfo->{'component_id'} eq 'mysqld' )
2986
3018
  {
2987
3019
    if ( !$master->[0]->{'pid'} )
2988
3020
    {
2989
 
      # Master drizzled is not started
 
3021
      # Master mysqld is not started
2990
3022
      do_before_start_master($tinfo);
2991
3023
 
2992
 
      drizzled_start($master->[0],$tinfo->{'master_opt'},[]);
 
3024
      mysqld_start($master->[0],$tinfo->{'master_opt'},[]);
2993
3025
 
2994
3026
    }
2995
3027
 
3010
3042
    {
3011
3043
      if ( ! $slave->[$idx]->{'pid'} )
3012
3044
      {
3013
 
        drizzled_start($slave->[$idx],$tinfo->{'slave_opt'},
 
3045
        mysqld_start($slave->[$idx],$tinfo->{'slave_opt'},
3014
3046
                     $tinfo->{'slave_mi'});
3015
3047
 
3016
3048
      }
3020
3052
    $slave->[0]->{'running_slave_options'}= $tinfo;
3021
3053
  }
3022
3054
 
3023
 
  # Wait for drizzled's to start
3024
 
  foreach my $drizzled (@{$master},@{$slave})
 
3055
  # Wait for mysqld's to start
 
3056
  foreach my $mysqld (@{$master},@{$slave})
3025
3057
  {
3026
3058
 
3027
 
    next if !$drizzled->{'pid'};
 
3059
    next if !$mysqld->{'pid'};
3028
3060
 
3029
 
    if (drizzled_wait_started($drizzled))
 
3061
    if (mysqld_wait_started($mysqld))
3030
3062
    {
3031
3063
      # failed to start
3032
3064
      $tinfo->{'comment'}=
3033
 
        "Failed to start $drizzled->{'type'} drizzled $drizzled->{'idx'}";
 
3065
        "Failed to start $mysqld->{'type'} mysqld $mysqld->{'idx'}";
3034
3066
      return 1;
3035
3067
    }
3036
3068
  }
3049
3081
sub run_check_testcase ($$) {
3050
3082
 
3051
3083
  my $mode=     shift;
3052
 
  my $drizzled=   shift;
 
3084
  my $mysqld=   shift;
3053
3085
 
3054
 
  my $name= "check-" . $drizzled->{'type'} . $drizzled->{'idx'};
 
3086
  my $name= "check-" . $mysqld->{'type'} . $mysqld->{'idx'};
3055
3087
 
3056
3088
  my $args;
3057
 
  dtr_init_args(\$args);
3058
 
 
3059
 
  dtr_add_arg($args, "--no-defaults");
3060
 
  dtr_add_arg($args, "--silent");
3061
 
  dtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
3062
 
 
3063
 
  dtr_add_arg($args, "--port=%d", $drizzled->{'port'});
3064
 
  dtr_add_arg($args, "--database=test");
3065
 
  dtr_add_arg($args, "--user=%s", $opt_user);
3066
 
  dtr_add_arg($args, "--password=");
3067
 
 
3068
 
  dtr_add_arg($args, "-R");
3069
 
  dtr_add_arg($args, "$opt_vardir/tmp/$name.result");
 
3089
  mtr_init_args(\$args);
 
3090
 
 
3091
  mtr_add_arg($args, "--no-defaults");
 
3092
  mtr_add_arg($args, "--silent");
 
3093
  mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
 
3094
 
 
3095
  mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
 
3096
  mtr_add_arg($args, "--database=test");
 
3097
  mtr_add_arg($args, "--user=%s", $opt_user);
 
3098
  mtr_add_arg($args, "--password=");
 
3099
 
 
3100
  mtr_add_arg($args, "-R");
 
3101
  mtr_add_arg($args, "$opt_vardir/tmp/$name.result");
3070
3102
 
3071
3103
  if ( $mode eq "before" )
3072
3104
  {
3073
 
    dtr_add_arg($args, "--record");
 
3105
    mtr_add_arg($args, "--record");
3074
3106
  }
3075
3107
 
3076
3108
  if ( $opt_testdir )
3077
3109
  {
3078
 
    dtr_add_arg($args, "--testdir=%s", $opt_testdir);
 
3110
    mtr_add_arg($args, "--testdir=%s", $opt_testdir);
3079
3111
  }
3080
3112
 
3081
 
  my $res = dtr_run_test($exe_drizzletest,$args,
 
3113
  my $res = mtr_run_test($exe_drizzletest,$args,
3082
3114
                "include/check-testcase.test", "", "", "");
3083
3115
 
3084
3116
  if ( $res == 1  and $mode eq "after")
3085
3117
  {
3086
 
    dtr_run("diff",["-u",
 
3118
    mtr_run("diff",["-u",
3087
3119
                    "$opt_vardir/tmp/$name.result",
3088
3120
                    "$opt_vardir/tmp/$name.reject"],
3089
3121
            "", "", "", "");
3090
3122
  }
3091
3123
  elsif ( $res )
3092
3124
  {
3093
 
    dtr_error("Could not execute 'check-testcase' $mode testcase");
 
3125
    mtr_error("Could not execute 'check-testcase' $mode testcase");
3094
3126
  }
3095
3127
  return $res;
3096
3128
}
3105
3137
  my $args;
3106
3138
 
3107
3139
  {
3108
 
    drizzled_start($master->[0],[],[]);
 
3140
    mysqld_start($master->[0],[],[]);
3109
3141
    if ( ! $master->[0]->{'pid'} )
3110
3142
    {
3111
 
      dtr_error("Can't start the drizzled server");
 
3143
      mtr_error("Can't start the mysqld server");
3112
3144
    }
3113
 
    drizzled_wait_started($master->[0]);
 
3145
    mysqld_wait_started($master->[0]);
3114
3146
  }
3115
3147
 
3116
3148
  my $tinfo = {};
3117
3149
  $tinfo->{'name'} = 'report features';
3118
3150
  $tinfo->{'result_file'} = undef;
3119
 
  $tinfo->{'component_id'} = 'drizzled';
 
3151
  $tinfo->{'component_id'} = 'mysqld';
3120
3152
  $tinfo->{'path'} = 'include/report-features.test';
3121
3153
  $tinfo->{'timezone'}=  "GMT-3";
3122
3154
  $tinfo->{'slave_num'} = 0;
3137
3169
  my $exe= $exe_drizzletest;
3138
3170
  my $args;
3139
3171
 
3140
 
  dtr_init_args(\$args);
 
3172
  mtr_init_args(\$args);
3141
3173
 
3142
 
  dtr_add_arg($args, "--no-defaults");
3143
 
  dtr_add_arg($args, "--silent");
3144
 
  dtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
3145
 
  dtr_add_arg($args, "--logdir=%s/log", $opt_vardir);
 
3174
  mtr_add_arg($args, "--no-defaults");
 
3175
  mtr_add_arg($args, "--silent");
 
3176
  mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
 
3177
  mtr_add_arg($args, "--logdir=%s/log", $opt_vardir);
3146
3178
 
3147
3179
  # Log line number and time  for each line in .test file
3148
 
  dtr_add_arg($args, "--mark-progress")
 
3180
  mtr_add_arg($args, "--mark-progress")
3149
3181
    if $opt_mark_progress;
3150
3182
 
3151
3183
  {
3152
 
    dtr_add_arg($args, "--port=%d", $master->[0]->{'port'});
3153
 
    dtr_add_arg($args, "--database=test");
3154
 
    dtr_add_arg($args, "--user=%s", $opt_user);
3155
 
    dtr_add_arg($args, "--password=");
 
3184
    mtr_add_arg($args, "--port=%d", $master->[0]->{'port'});
 
3185
    mtr_add_arg($args, "--database=test");
 
3186
    mtr_add_arg($args, "--user=%s", $opt_user);
 
3187
    mtr_add_arg($args, "--password=");
3156
3188
  }
3157
3189
 
3158
3190
  if ( $opt_strace_client )
3159
3191
  {
3160
3192
    $exe=  "strace";            # FIXME there are ktrace, ....
3161
 
    dtr_add_arg($args, "-o");
3162
 
    dtr_add_arg($args, "%s/log/drizzletest.strace", $opt_vardir);
3163
 
    dtr_add_arg($args, "$exe_drizzletest");
 
3193
    mtr_add_arg($args, "-o");
 
3194
    mtr_add_arg($args, "%s/log/drizzletest.strace", $opt_vardir);
 
3195
    mtr_add_arg($args, "$exe_drizzletest");
3164
3196
  }
3165
3197
 
3166
3198
  if ( $opt_timer )
3167
3199
  {
3168
 
    dtr_add_arg($args, "--timer-file=%s/log/timer", $opt_vardir);
 
3200
    mtr_add_arg($args, "--timer-file=%s/log/timer", $opt_vardir);
3169
3201
  }
3170
3202
 
3171
3203
  if ( $opt_compress )
3172
3204
  {
3173
 
    dtr_add_arg($args, "--compress");
 
3205
    mtr_add_arg($args, "--compress");
3174
3206
  }
3175
3207
 
3176
3208
  if ( $opt_sleep )
3177
3209
  {
3178
 
    dtr_add_arg($args, "--sleep=%d", $opt_sleep);
 
3210
    mtr_add_arg($args, "--sleep=%d", $opt_sleep);
3179
3211
  }
3180
3212
 
3181
3213
  if ( $opt_debug )
3182
3214
  {
3183
 
    dtr_add_arg($args, "--debug=d:t:A,%s/log/drizzletest.trace",
 
3215
    mtr_add_arg($args, "--debug=d:t:A,%s/log/drizzletest.trace",
3184
3216
                $path_vardir_trace);
3185
3217
  }
3186
3218
 
3187
3219
  if ( $opt_testdir )
3188
3220
  {
3189
 
    dtr_add_arg($args, "--testdir=%s", $opt_testdir);
 
3221
    mtr_add_arg($args, "--testdir=%s", $opt_testdir);
3190
3222
  }
3191
3223
 
3192
3224
 
3194
3226
  # export DRIZZLE_TEST variable containing <path>/drizzletest <args>
3195
3227
  # ----------------------------------------------------------------------
3196
3228
  $ENV{'DRIZZLE_TEST'}=
3197
 
    dtr_native_path($exe_drizzletest) . " " . join(" ", @$args);
 
3229
    mtr_native_path($exe_drizzletest) . " " . join(" ", @$args);
3198
3230
 
3199
3231
  # ----------------------------------------------------------------------
3200
3232
  # Add arguments that should not go into the DRIZZLE_TEST env var
3206
3238
    # We do this here, since we do not want to Valgrind the nested invocations
3207
3239
    # of drizzletest; that would mess up the stderr output causing test failure.
3208
3240
    my @args_saved = @$args;
3209
 
    dtr_init_args(\$args);
 
3241
    mtr_init_args(\$args);
3210
3242
    valgrind_arguments($args, \$exe);
3211
 
    dtr_add_arg($args, "%s", $_) for @args_saved;
 
3243
    mtr_add_arg($args, "%s", $_) for @args_saved;
3212
3244
  }
3213
3245
 
3214
 
  dtr_add_arg($args, "--test-file=%s", $tinfo->{'path'});
 
3246
  mtr_add_arg($args, "--test-file=%s", $tinfo->{'path'});
3215
3247
 
3216
3248
  # Number of lines of resut to include in failure report
3217
 
  dtr_add_arg($args, "--tail-lines=20");
 
3249
  mtr_add_arg($args, "--tail-lines=20");
3218
3250
 
3219
3251
  if ( defined $tinfo->{'result_file'} ) {
3220
 
    dtr_add_arg($args, "--result-file=%s", $tinfo->{'result_file'});
 
3252
    mtr_add_arg($args, "--result-file=%s", $tinfo->{'result_file'});
3221
3253
  }
3222
3254
 
3223
3255
  if ( $opt_record )
3224
3256
  {
3225
 
    dtr_add_arg($args, "--record");
 
3257
    mtr_add_arg($args, "--record");
3226
3258
  }
3227
3259
 
3228
3260
  if ( $opt_client_gdb )
3240
3272
 
3241
3273
  if ( $opt_check_testcases )
3242
3274
  {
3243
 
    foreach my $drizzled (@{$master}, @{$slave})
 
3275
    foreach my $mysqld (@{$master}, @{$slave})
3244
3276
    {
3245
 
      if ($drizzled->{'pid'})
 
3277
      if ($mysqld->{'pid'})
3246
3278
      {
3247
 
        run_check_testcase("before", $drizzled);
 
3279
        run_check_testcase("before", $mysqld);
3248
3280
      }
3249
3281
    }
3250
3282
  }
3251
3283
 
3252
 
  my $res = dtr_run_test($exe,$args,"","",$path_timefile,"");
 
3284
  my $res = mtr_run_test($exe,$args,"","",$path_timefile,"");
3253
3285
 
3254
3286
  if ( $opt_check_testcases )
3255
3287
  {
3256
 
    foreach my $drizzled (@{$master}, @{$slave})
 
3288
    foreach my $mysqld (@{$master}, @{$slave})
3257
3289
    {
3258
 
      if ($drizzled->{'pid'})
 
3290
      if ($mysqld->{'pid'})
3259
3291
      {
3260
 
        if (run_check_testcase("after", $drizzled))
 
3292
        if (run_check_testcase("after", $mysqld))
3261
3293
        {
3262
3294
          # Check failed, mark the test case with that info
3263
3295
          $tinfo->{'check_testcase_failed'}= 1;
3287
3319
  if ( $type eq "client" )
3288
3320
  {
3289
3321
    # write init file for client
3290
 
    dtr_tofile($dbx_init_file,
 
3322
    mtr_tofile($dbx_init_file,
3291
3323
               "runargs $str\n" .
3292
3324
               "run\n");
3293
3325
  }
3294
3326
  else
3295
3327
  {
3296
3328
    # write init file for drizzled
3297
 
    dtr_tofile($dbx_init_file,
 
3329
    mtr_tofile($dbx_init_file,
3298
3330
               "stop in __1cIdrizzledLmysql_parse6Fpn0AHSession_pkcI_v_\n" .
3299
3331
               "runargs $str\n" .
3300
3332
               "run\n" .
3312
3344
  }
3313
3345
 
3314
3346
  $$args= [];
3315
 
  dtr_add_arg($$args, "-title");
3316
 
  dtr_add_arg($$args, "$type");
3317
 
  dtr_add_arg($$args, "-e");
 
3347
  mtr_add_arg($$args, "-title");
 
3348
  mtr_add_arg($$args, "$type");
 
3349
  mtr_add_arg($$args, "-e");
3318
3350
 
3319
 
  dtr_add_arg($$args, "dbx");
3320
 
  dtr_add_arg($$args, "-c");
3321
 
  dtr_add_arg($$args, "source $dbx_init_file");
3322
 
  dtr_add_arg($$args, "$$exe");
 
3351
  mtr_add_arg($$args, "dbx");
 
3352
  mtr_add_arg($$args, "-c");
 
3353
  mtr_add_arg($$args, "source $dbx_init_file");
 
3354
  mtr_add_arg($$args, "$$exe");
3323
3355
 
3324
3356
  $$exe= "xterm";
3325
3357
}
3331
3363
  my $args= shift;
3332
3364
  my $exe=  shift;
3333
3365
  my $type= shift;
3334
 
  # We add needed, extra lines to gdbinit on OS X
3335
 
  my $extra_gdb_init = '' ;
3336
 
  if ($^O eq 'darwin')
3337
 
  {
3338
 
    $extra_gdb_init= "set env DYLD_INSERT_LIBRARIES /usr/lib/libgmalloc.dylib\n".
3339
 
                 "set env MallocStackLogging 1\n".
3340
 
                 "set env MallocScribble 1\n".
3341
 
                 "set env MallocPreScribble 1\n".
3342
 
                 "set env MallocStackLogging 1\n".
3343
 
                 "set env MallocStackLoggingNoCompact 1\n".
3344
 
                 "set env MallocGuardEdges 1\n" ;
3345
 
  }
3346
3366
 
3347
3367
  # Write $args to gdb init file
3348
3368
  my $str= join(" ", @$$args);
3354
3374
  if ( $type eq "client" )
3355
3375
  {
3356
3376
    # write init file for client
3357
 
    dtr_tofile($gdb_init_file,
 
3377
    mtr_tofile($gdb_init_file,
3358
3378
               "set args $str\n" .
3359
 
               "$extra_gdb_init" .
3360
3379
               "break main\n");
3361
3380
  }
3362
3381
  else
3363
3382
  {
3364
 
    # write init file for drizzled
3365
 
    dtr_tofile($gdb_init_file,
 
3383
    # write init file for mysqld
 
3384
    mtr_tofile($gdb_init_file,
3366
3385
               "set args $str\n" .
3367
 
               "$extra_gdb_init" .
3368
3386
               "set breakpoint pending on\n" .
3369
3387
               "break drizzled::mysql_parse\n" .
3370
3388
               "commands 1\n" .
3377
3395
  if ( $opt_manual_gdb )
3378
3396
  {
3379
3397
     print "\nTo start gdb for $type, type in another window:\n";
3380
 
     print "$glob_drizzle_test_dir/../libtool --mode=execute gdb -cd $glob_drizzle_test_dir -x $gdb_init_file $$exe\n";
 
3398
     print "$glob_mysql_test_dir/../libtool --mode=execute gdb -cd $glob_mysql_test_dir -x $gdb_init_file $$exe\n";
3381
3399
 
3382
3400
     # Indicate the exe should not be started
3383
3401
     $$exe= undef;
3385
3403
  }
3386
3404
 
3387
3405
  $$args= [];
3388
 
  dtr_add_arg($$args, "-title");
3389
 
  dtr_add_arg($$args, "$type");
3390
 
  dtr_add_arg($$args, "-e");
 
3406
  mtr_add_arg($$args, "-title");
 
3407
  mtr_add_arg($$args, "$type");
 
3408
  mtr_add_arg($$args, "-e");
3391
3409
 
3392
3410
  if ( $exe_libtool )
3393
3411
  {
3394
 
    dtr_add_arg($$args, $exe_libtool);
3395
 
    dtr_add_arg($$args, "--mode=execute");
 
3412
    mtr_add_arg($$args, $exe_libtool);
 
3413
    mtr_add_arg($$args, "--mode=execute");
3396
3414
  }
3397
3415
 
3398
 
  dtr_add_arg($$args, "gdb");
3399
 
  dtr_add_arg($$args, "-x");
3400
 
  dtr_add_arg($$args, "$gdb_init_file");
3401
 
  dtr_add_arg($$args, "$$exe");
 
3416
  mtr_add_arg($$args, "gdb");
 
3417
  mtr_add_arg($$args, "-x");
 
3418
  mtr_add_arg($$args, "$gdb_init_file");
 
3419
  mtr_add_arg($$args, "$$exe");
3402
3420
 
3403
3421
  $$exe= "xterm";
3404
3422
}
3422
3440
  if ( $type eq "client" )
3423
3441
  {
3424
3442
    # write init file for client
3425
 
    dtr_tofile($gdb_init_file,
 
3443
    mtr_tofile($gdb_init_file,
3426
3444
               "set args $str\n" .
3427
3445
               "break main\n");
3428
3446
  }
3429
3447
  else
3430
3448
  {
3431
 
    # write init file for drizzled
3432
 
    dtr_tofile($gdb_init_file,
 
3449
    # write init file for mysqld
 
3450
    mtr_tofile($gdb_init_file,
3433
3451
               "file $$exe\n" .
3434
3452
               "set args $str\n" .
3435
3453
               "break drizzled::mysql_parse\n" .
3441
3459
  if ( $opt_manual_ddd )
3442
3460
  {
3443
3461
     print "\nTo start ddd for $type, type in another window:\n";
3444
 
     print "ddd -cd $glob_drizzle_test_dir -x $gdb_init_file $$exe\n";
 
3462
     print "ddd -cd $glob_mysql_test_dir -x $gdb_init_file $$exe\n";
3445
3463
 
3446
3464
     # Indicate the exe should not be started
3447
3465
     $$exe= undef;
3453
3471
  if ( $exe_libtool )
3454
3472
  {
3455
3473
    $$exe= $exe_libtool;
3456
 
    dtr_add_arg($$args, "--mode=execute");
3457
 
    dtr_add_arg($$args, "ddd");
 
3474
    mtr_add_arg($$args, "--mode=execute");
 
3475
    mtr_add_arg($$args, "ddd");
3458
3476
  }
3459
3477
  else
3460
3478
  {
3461
3479
    $$exe= "ddd";
3462
3480
  }
3463
 
  dtr_add_arg($$args, "--command=$gdb_init_file");
3464
 
  dtr_add_arg($$args, "$save_exe");
 
3481
  mtr_add_arg($$args, "--command=$gdb_init_file");
 
3482
  mtr_add_arg($$args, "$save_exe");
3465
3483
}
3466
3484
 
3467
3485
 
3499
3517
#  }
3500
3518
  else
3501
3519
  {
3502
 
    dtr_error("Unknown argument \"$debugger\" passed to --debugger");
 
3520
    mtr_error("Unknown argument \"$debugger\" passed to --debugger");
3503
3521
  }
3504
3522
}
3505
3523
 
3513
3531
 
3514
3532
  if ( $opt_callgrind)
3515
3533
  {
3516
 
    dtr_add_arg($args, "--tool=callgrind");
 
3534
    mtr_add_arg($args, "--tool=callgrind");
 
3535
    mtr_add_arg($args, "--base=$opt_vardir/log");
3517
3536
  }
3518
3537
  elsif ($opt_massif)
3519
3538
  {
3520
 
    dtr_add_arg($args, "--tool=massif");
 
3539
    mtr_add_arg($args, "--tool=massif");
3521
3540
  }
3522
3541
  else
3523
3542
  {
3524
 
    dtr_add_arg($args, "--tool=memcheck"); # From >= 2.1.2 needs this option
3525
 
    dtr_add_arg($args, "--leak-check=yes");
3526
 
    dtr_add_arg($args, "--num-callers=16");
3527
 
    dtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_drizzle_test_dir)
3528
 
      if -f "$glob_drizzle_test_dir/valgrind.supp";
 
3543
    mtr_add_arg($args, "--tool=memcheck"); # From >= 2.1.2 needs this option
 
3544
    mtr_add_arg($args, "--leak-check=yes");
 
3545
    mtr_add_arg($args, "--num-callers=16");
 
3546
    mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
 
3547
      if -f "$glob_mysql_test_dir/valgrind.supp";
3529
3548
  }
3530
3549
 
3531
3550
  # Add valgrind options, can be overriden by user
3532
 
  dtr_add_arg($args, '%s', $_) for (@valgrind_args);
 
3551
  mtr_add_arg($args, '%s', $_) for (@valgrind_args);
3533
3552
 
3534
 
  dtr_add_arg($args, $$exe);
 
3553
  mtr_add_arg($args, $$exe);
3535
3554
 
3536
3555
  $$exe= $opt_valgrind_path || "valgrind";
3537
3556
 
3545
3564
}
3546
3565
 
3547
3566
 
3548
 
sub drizzled_wait_started($){
3549
 
  my $drizzled= shift;
 
3567
sub mysqld_wait_started($){
 
3568
  my $mysqld= shift;
3550
3569
 
3551
 
  if (sleep_until_file_created($drizzled->{'path_pid'},
3552
 
            $drizzled->{'start_timeout'},
3553
 
            $drizzled->{'pid'}) == 0)
 
3570
  if (sleep_until_file_created($mysqld->{'path_pid'},
 
3571
            $mysqld->{'start_timeout'},
 
3572
            $mysqld->{'pid'}) == 0)
3554
3573
  {
3555
3574
    # Failed to wait for pid file
3556
3575
    return 1;
3558
3577
 
3559
3578
  # Get the "real pid" of the process, it will be used for killing
3560
3579
  # the process in ActiveState's perl on windows
3561
 
  $drizzled->{'real_pid'}= dtr_get_pid_from_file($drizzled->{'path_pid'});
 
3580
  $mysqld->{'real_pid'}= mtr_get_pid_from_file($mysqld->{'path_pid'});
3562
3581
 
3563
3582
  return 0;
3564
3583
}
3628
3647
                        using a builtin list of standard locations
3629
3648
                        for tmpfs (/dev/shm)
3630
3649
                        The option can also be set using environment
3631
 
                        variable DTR_MEM=[DIR]
 
3650
                        variable MTR_MEM=[DIR]
3632
3651
 
3633
3652
Options to control what test suites or cases to run
3634
3653
 
3644
3663
                        list of suite names.
3645
3664
                        The default is: "$opt_suites_default"
3646
3665
  skip-rpl              Skip the replication test cases.
3647
 
  combination="ARG1 .. ARG2" Specify a set of "drizzled" arguments for one
 
3666
  combination="ARG1 .. ARG2" Specify a set of "mysqld" arguments for one
3648
3667
                        combination.
3649
3668
  skip-combination      Skip any combination options and combinations files
3650
3669
  repeat-test=n         How many times to repeat each test (default: 1)
3653
3672
 
3654
3673
  master_port=PORT      Specify the port number used by the first master
3655
3674
  slave_port=PORT       Specify the port number used by the first slave
3656
 
  dtr-build-thread=#    Specify unique collection of ports. Can also be set by
3657
 
                        setting the environment variable DTR_BUILD_THREAD.
 
3675
  mtr-build-thread=#    Specify unique collection of ports. Can also be set by
 
3676
                        setting the environment variable MTR_BUILD_THREAD.
3658
3677
 
3659
3678
Options for test case authoring
3660
3679
 
3664
3683
 
3665
3684
Options that pass on options
3666
3685
 
3667
 
  drizzled=ARGS           Specify additional arguments to "drizzled"
 
3686
  mysqld=ARGS           Specify additional arguments to "mysqld"
3668
3687
 
3669
3688
Options to run test on running server
3670
3689
 
3676
3695
  client-ddd            Start drizzletest client in ddd
3677
3696
  client-debugger=NAME  Start drizzletest in the selected debugger
3678
3697
  client-gdb            Start drizzletest client in gdb
3679
 
  ddd                   Start drizzled in ddd
 
3698
  ddd                   Start mysqld in ddd
3680
3699
  debug                 Dump trace output for all servers and client programs
3681
 
  debugger=NAME         Start drizzled in the selected debugger
3682
 
  gdb                   Start the drizzled(s) in gdb
3683
 
  manual-debug          Let user manually start drizzled in debugger, before
 
3700
  debugger=NAME         Start mysqld in the selected debugger
 
3701
  gdb                   Start the mysqld(s) in gdb
 
3702
  manual-debug          Let user manually start mysqld in debugger, before
3684
3703
                        running test(s)
3685
 
  manual-gdb            Let user manually start drizzled in gdb, before running
3686
 
                        test(s)
3687
 
  manual-ddd            Let user manually start drizzled in ddd, before running
3688
 
                        test(s)
3689
 
  master-binary=PATH    Specify the master "drizzled" to use
3690
 
  slave-binary=PATH     Specify the slave "drizzled" to use
 
3704
  manual-gdb            Let user manually start mysqld in gdb, before running
 
3705
                        test(s)
 
3706
  manual-ddd            Let user manually start mysqld in ddd, before running
 
3707
                        test(s)
 
3708
  master-binary=PATH    Specify the master "mysqld" to use
 
3709
  slave-binary=PATH     Specify the slave "mysqld" to use
3691
3710
  strace-client         Create strace output for drizzletest client
3692
3711
  max-save-core         Limit the number of core files saved (to avoid filling
3693
3712
                        up disks for heavily crashing server). Defaults to
3697
3716
 
3698
3717
  gcov                  FIXME
3699
3718
  gprof                 See online documentation on how to use it.
3700
 
  valgrind              Run the "drizzletest" and "drizzled" executables using
 
3719
  valgrind              Run the "drizzletest" and "mysqld" executables using
3701
3720
                        valgrind with default options
3702
3721
  valgrind-all          Synonym for --valgrind
3703
 
  valgrind-drizzleslap  Run "drizzleslap" with valgrind.
3704
 
  valgrind-drizzletest  Run the "drizzletest" and "drizzle_client_test" executable
 
3722
  valgrind-drizzletest    Run the "drizzletest" and "drizzle_client_test" executable
3705
3723
                        with valgrind
3706
 
  valgrind-drizzled       Run the "drizzled" executable with valgrind
 
3724
  valgrind-mysqld       Run the "mysqld" executable with valgrind
3707
3725
  valgrind-options=ARGS Deprecated, use --valgrind-option
3708
3726
  valgrind-option=ARGS  Option to give valgrind, replaces default option(s),
3709
3727
                        can be specified more then once
3727
3745
 
3728
3746
  testcase-timeout=MINUTES Max test case run time (default $default_testcase_timeout)
3729
3747
  suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout)
3730
 
  warnings | log-warnings Pass --log-warnings to drizzled
 
3748
  warnings | log-warnings Pass --log-warnings to mysqld
3731
3749
 
3732
3750
  sleep=SECONDS         Passed to drizzletest, will be used as fixed sleep time
3733
3751
 
3734
3752
HERE
3735
 
  dtr_exit(1);
 
3753
  mtr_exit(1);
3736
3754
 
3737
3755
}