~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/test-run.pl

  • Committer: Brian Aker
  • Date: 2010-05-18 15:49:50 UTC
  • Revision ID: brian@gaz-20100518154950-qhctxu6lvvnyxy9i
Simplify out Open_tables_state() backup/restore (no longer needed).

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