~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysql-test/mysql-test-run.pl

  • Committer: Monty Taylor
  • Date: 2008-07-05 22:08:52 UTC
  • mto: This revision was merged to the branch mainline in revision 77.
  • Revision ID: monty@inaugust.com-20080705220852-cqd9t6tfkhvlcf73
Removed HAVE_LONG_LONG, as this is now assumed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
#
5
5
##############################################################################
6
6
#
7
 
#  drizzle-test-run.pl
 
7
#  mysql-test-run.pl
8
8
#
9
9
#  Tool used for executing a suite of .test file
10
10
#
11
 
#  For now, see the "MySQL Test framework manual" for more information
 
11
#  See the "MySQL Test framework manual" for more information
12
12
#  http://dev.mysql.com/doc/mysqltest/en/index.html
13
 
#  (as the Drizzle test environment is currently still fairly similar)
14
13
#
15
14
#  Please keep the test framework tools identical in all versions!
16
15
#
50
49
# A nice way to trace the execution of this script while debugging
51
50
# is to use the Devel::Trace package found at
52
51
# "http://www.plover.com/~mjd/perl/Trace/" and run this script like
53
 
# "perl -d:Trace drizzle-test-run.pl"
 
52
# "perl -d:Trace mysql-test-run.pl"
54
53
#
55
54
 
56
55
 
74
73
select(STDOUT);
75
74
$| = 1; # Automatically flush STDOUT
76
75
 
77
 
require "mtr_cases.pl";
78
 
require "mtr_process.pl";
79
 
require "mtr_timer.pl";
80
 
require "mtr_io.pl";
81
 
require "mtr_gcov.pl";
82
 
require "mtr_gprof.pl";
83
 
require "mtr_report.pl";
84
 
require "mtr_match.pl";
85
 
require "mtr_misc.pl";
86
 
require "mtr_stress.pl";
87
 
require "mtr_unique.pl";
 
76
our $glob_win32_perl=  ($^O eq "MSWin32"); # ActiveState Win32 Perl
 
77
our $glob_cygwin_perl= ($^O eq "cygwin");  # Cygwin Perl
 
78
our $glob_win32=       ($glob_win32_perl or $glob_cygwin_perl);
 
79
our $glob_netware=     ($^O eq "NetWare"); # NetWare
 
80
 
 
81
require "lib/mtr_cases.pl";
 
82
require "lib/mtr_process.pl";
 
83
require "lib/mtr_timer.pl";
 
84
require "lib/mtr_io.pl";
 
85
require "lib/mtr_gcov.pl";
 
86
require "lib/mtr_gprof.pl";
 
87
require "lib/mtr_report.pl";
 
88
require "lib/mtr_match.pl";
 
89
require "lib/mtr_misc.pl";
 
90
require "lib/mtr_stress.pl";
 
91
require "lib/mtr_unique.pl";
88
92
 
89
93
$Devel::Trace::TRACE= 1;
90
94
 
100
104
our $glob_mysql_bench_dir=        undef;
101
105
our $glob_scriptname=             undef;
102
106
our $glob_timers=                 undef;
 
107
our $glob_use_embedded_server=    0;
103
108
our @glob_test_mode;
104
109
 
105
110
our $glob_basedir;
106
111
 
 
112
our $path_charsetsdir;
107
113
our $path_client_bindir;
 
114
our $path_share;
 
115
our $path_language;
108
116
our $path_timefile;
109
117
our $path_snapshot;
110
 
our $path_drizzletest_log;
 
118
our $path_mysqltest_log;
111
119
our $path_current_test_log;
112
120
our $path_my_basedir;
113
121
 
115
123
our $path_vardir_trace;          # unix formatted opt_vardir for trace files
116
124
our $opt_tmpdir;                 # A path but set directly on cmd line
117
125
 
 
126
# Visual Studio produces executables in different sub-directories based on the
 
127
# configuration used to build them.  To make life easier, an environment
 
128
# variable or command-line option may be specified to control which set of
 
129
# executables will be used by the test suite.
 
130
our $opt_vs_config = $ENV{'MTR_VS_CONFIG'};
118
131
 
119
132
our $default_vardir;
120
133
 
125
138
our $opt_verbose= 0;  # Verbose output, enable with --verbose
126
139
 
127
140
our $exe_master_mysqld;
128
 
our $exe_drizzle;
129
 
our $exe_drizzleadmin;
130
 
our $exe_drizzle_client_test;
 
141
our $exe_mysql;
 
142
our $exe_mysqladmin;
 
143
our $exe_mysqlbinlog;
 
144
our $exe_mysql_client_test;
131
145
our $exe_bug25714;
132
 
our $exe_drizzled;
133
 
our $exe_drizzlecheck;
134
 
our $exe_drizzledump;
135
 
our $exe_drizzleslap;
136
 
our $exe_drizzleimport;
137
 
our $exe_drizzle_fix_system_tables;
138
 
our $exe_drizzletest;
 
146
our $exe_mysqld;
 
147
our $exe_mysqlcheck;
 
148
our $exe_mysqldump;
 
149
our $exe_mysqlslap;
 
150
our $exe_mysqlimport;
 
151
our $exe_mysqlshow;
 
152
our $exe_mysql_fix_system_tables;
 
153
our $exe_mysqltest;
 
154
our $exe_ndbd;
 
155
our $exe_ndb_mgmd;
139
156
our $exe_slave_mysqld;
140
157
our $exe_my_print_defaults;
141
158
our $exe_perror;
153
170
our @opt_extra_mysqld_opt;
154
171
 
155
172
our $opt_compress;
 
173
our $opt_ssl;
 
174
our $opt_skip_ssl;
 
175
our $opt_ssl_supported;
 
176
our $opt_ps_protocol;
 
177
our $opt_sp_protocol;
 
178
our $opt_cursor_protocol;
 
179
our $opt_view_protocol;
156
180
 
157
181
our $opt_debug;
158
182
our $opt_do_test;
159
183
our @opt_cases;                  # The test cases names in argv
160
 
our $opt_engine;
 
184
our $opt_embedded_server;
161
185
 
162
186
our $opt_extern= 0;
163
187
our $opt_socket;
195
219
 
196
220
our $opt_master_myport;
197
221
our $opt_slave_myport;
 
222
our $opt_ndbcluster_port;
 
223
our $opt_ndbconnectstring;
 
224
our $opt_ndbcluster_port_slave;
 
225
our $opt_ndbconnectstring_slave;
 
226
 
198
227
our $opt_record;
199
228
my $opt_report_features;
200
229
our $opt_check_testcases;
225
254
 
226
255
my $opt_valgrind= 0;
227
256
my $opt_valgrind_mysqld= 0;
228
 
my $opt_valgrind_drizzletest= 0;
 
257
my $opt_valgrind_mysqltest= 0;
229
258
my @default_valgrind_args= ("--show-reachable=yes");
230
259
my @valgrind_args;
231
260
my $opt_valgrind_path;
243
272
 
244
273
our $opt_warnings;
245
274
 
 
275
our $opt_skip_ndbcluster= 0;
 
276
our $opt_skip_ndbcluster_slave= 0;
 
277
our $opt_with_ndbcluster= 0;
 
278
our $opt_with_ndbcluster_only= 0;
 
279
our $glob_ndbcluster_supported= 0;
 
280
our $opt_ndb_extra_test= 0;
246
281
our $opt_skip_master_binlog= 0;
247
282
our $opt_skip_slave_binlog= 0;
248
283
 
 
284
our $exe_ndb_mgm;
 
285
our $exe_ndb_waiter;
 
286
our $path_ndb_tools_dir;
 
287
our $path_ndb_examples_dir;
 
288
our $exe_ndb_example;
 
289
our $path_ndb_testrun_log;
 
290
 
249
291
our $path_sql_dir;
250
292
 
251
293
our @data_dir_lst;
277
319
sub kill_running_servers ();
278
320
sub remove_stale_vardir ();
279
321
sub setup_vardir ();
 
322
sub check_ssl_support ($);
280
323
sub check_running_as_root();
 
324
sub check_ndbcluster_support ($);
 
325
sub rm_ndbcluster_tables ($);
 
326
sub ndbcluster_start_install ($);
 
327
sub ndbcluster_start ($$);
 
328
sub ndbcluster_wait_started ($$);
281
329
sub mysqld_wait_started($);
282
330
sub run_benchmarks ($);
283
331
sub initialize_servers ();
284
332
sub mysql_install_db ();
 
333
sub install_db ($$);
285
334
sub copy_install_db ($$);
286
335
sub run_testcase ($);
287
336
sub run_testcase_stop_servers ($$$);
290
339
sub report_failure_and_restart ($);
291
340
sub do_before_start_master ($);
292
341
sub do_before_start_slave ($);
 
342
sub ndbd_start ($$$);
 
343
sub ndb_mgmd_start ($);
293
344
sub mysqld_start ($$$);
294
345
sub mysqld_arguments ($$$$);
295
346
sub stop_all_servers ();
296
 
sub run_drizzletest ($);
 
347
sub run_mysqltest ($);
297
348
sub usage ($);
298
349
 
299
350
 
309
360
 
310
361
  command_line_setup();
311
362
 
 
363
  check_ndbcluster_support(\%mysqld_variables);
 
364
  check_ssl_support(\%mysqld_variables);
312
365
  check_debug_support(\%mysqld_variables);
313
366
 
314
367
  executable_setup();
344
397
      $opt_suites= $opt_suites_default;
345
398
 
346
399
      # Check for any extra suites to enable based on the path name
347
 
      my %extra_suites= ();
 
400
      my %extra_suites=
 
401
        (
 
402
         "mysql-5.1-new-ndb"              => "ndb_team",
 
403
         "mysql-5.1-new-ndb-merge"        => "ndb_team",
 
404
         "mysql-5.1-telco-6.2"            => "ndb_team",
 
405
         "mysql-5.1-telco-6.2-merge"      => "ndb_team",
 
406
         "mysql-5.1-telco-6.3"            => "ndb_team",
 
407
         "mysql-6.0-ndb"                  => "ndb_team",
 
408
        );
348
409
 
349
410
      foreach my $dir ( reverse splitdir($glob_basedir) )
350
411
      {
360
421
    my $tests= collect_test_cases($opt_suites);
361
422
 
362
423
    # Turn off NDB and other similar options if no tests use it
 
424
    my ($need_ndbcluster);
363
425
    foreach my $test (@$tests)
364
426
    {
365
427
      next if $test->{skip};
366
428
 
367
429
      if (!$opt_extern)
368
430
      {
 
431
        $need_ndbcluster||= $test->{ndb_test};
 
432
 
369
433
        # Count max number of slaves used by a test case
370
434
        if ( $test->{slave_num} > $max_slave_num) {
371
435
          $max_slave_num= $test->{slave_num};
382
446
      $use_innodb||= $test->{'innodb_test'};
383
447
    }
384
448
 
 
449
    # Check if cluster can be skipped
 
450
    if ( !$need_ndbcluster )
 
451
    {
 
452
      $opt_skip_ndbcluster= 1;
 
453
      $opt_skip_ndbcluster_slave= 1;
 
454
    }
 
455
 
 
456
    # Check if slave cluster can be skipped
 
457
    if ($max_slave_num == 0)
 
458
    {
 
459
      $opt_skip_ndbcluster_slave= 1;
 
460
    }
 
461
 
385
462
    initialize_servers();
386
463
 
387
464
    if ( $opt_report_features ) {
457
534
  Getopt::Long::Configure("pass_through");
458
535
  GetOptions(
459
536
             # Control what engine/variation to run
 
537
             'embedded-server'          => \$opt_embedded_server,
 
538
             'ps-protocol'              => \$opt_ps_protocol,
 
539
             'sp-protocol'              => \$opt_sp_protocol,
 
540
             'view-protocol'            => \$opt_view_protocol,
 
541
             'cursor-protocol'          => \$opt_cursor_protocol,
 
542
             'ssl|with-openssl'         => \$opt_ssl,
 
543
             'skip-ssl'                 => \$opt_skip_ssl,
460
544
             'compress'                 => \$opt_compress,
461
545
             'bench'                    => \$opt_bench,
462
546
             'small-bench'              => \$opt_small_bench,
 
547
             'with-ndbcluster|ndb'      => \$opt_with_ndbcluster,
 
548
             'vs-config'            => \$opt_vs_config,
463
549
 
464
550
             # Control what test suites or cases to run
465
551
             'force'                    => \$opt_force,
 
552
             'with-ndbcluster-only'     => \$opt_with_ndbcluster_only,
 
553
             'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster,
 
554
             'skip-ndbcluster-slave|skip-ndb-slave'
 
555
                                        => \$opt_skip_ndbcluster_slave,
 
556
             'ndb-extra-test'           => \$opt_ndb_extra_test,
466
557
             'skip-master-binlog'       => \$opt_skip_master_binlog,
467
558
             'skip-slave-binlog'        => \$opt_skip_slave_binlog,
468
559
             'do-test=s'                => \$opt_do_test,
477
568
             # Specify ports
478
569
             'master_port=i'            => \$opt_master_myport,
479
570
             'slave_port=i'             => \$opt_slave_myport,
 
571
             'ndbcluster-port|ndbcluster_port=i' => \$opt_ndbcluster_port,
 
572
             'ndbcluster-port-slave=i'  => \$opt_ndbcluster_port_slave,
480
573
             'mtr-build-thread=i'       => \$opt_mtr_build_thread,
481
574
 
482
575
             # Test case authoring
486
579
 
487
580
             # Extra options used when starting mysqld
488
581
             'mysqld=s'                 => \@opt_extra_mysqld_opt,
489
 
             'engine=s'                 => \$opt_engine,
490
582
 
491
583
             # Run test on running server
492
584
             'extern'                   => \$opt_extern,
 
585
             'ndb-connectstring=s'       => \$opt_ndbconnectstring,
 
586
             'ndb-connectstring-slave=s' => \$opt_ndbconnectstring_slave,
493
587
 
494
588
             # Debugging
495
589
             'gdb'                      => \$opt_gdb,
510
604
             'gcov'                     => \$opt_gcov,
511
605
             'gprof'                    => \$opt_gprof,
512
606
             'valgrind|valgrind-all'    => \$opt_valgrind,
513
 
             'valgrind-drizzletest'       => \$opt_valgrind_drizzletest,
 
607
             'valgrind-mysqltest'       => \$opt_valgrind_mysqltest,
514
608
             'valgrind-mysqld'          => \$opt_valgrind_mysqld,
515
609
             'valgrind-options=s'       => sub {
516
610
               my ($opt, $value)= @_;
583
677
  }
584
678
 
585
679
  # We require that we are in the "mysql-test" directory
586
 
  # to run drizzle-test-run
 
680
  # to run mysql-test-run
587
681
  if (! -f $glob_scriptname)
588
682
  {
589
 
    mtr_error("Can't find the location for the drizzle-test-run script\n" .
 
683
    mtr_error("Can't find the location for the mysql-test-run script\n" .
590
684
              "Go to to the mysql-test directory and execute the script " .
591
685
              "as follows:\n./$glob_scriptname");
592
686
  }
593
687
 
594
 
  if ( -d "../drizzled" )
 
688
  if ( -d "../sql" )
595
689
  {
596
690
    $source_dist=  1;
597
691
  }
598
692
 
599
693
  # Find the absolute path to the test directory
600
694
  $glob_mysql_test_dir=  cwd();
 
695
  if ( $glob_cygwin_perl )
 
696
  {
 
697
    # Windows programs like 'mysqld' needs Windows paths
 
698
    $glob_mysql_test_dir= `cygpath -m "$glob_mysql_test_dir"`;
 
699
    chomp($glob_mysql_test_dir);
 
700
  }
601
701
  $default_vardir= "$glob_mysql_test_dir/var";
602
702
 
603
703
  # In most cases, the base directory we find everything relative to,
626
726
 
627
727
  $glob_timers= mtr_init_timers();
628
728
 
 
729
  # --------------------------------------------------------------------------
 
730
  # Embedded server flag
 
731
  # --------------------------------------------------------------------------
 
732
  if ( $opt_embedded_server )
 
733
  {
 
734
    $glob_use_embedded_server= 1;
 
735
    # Add the location for libmysqld.dll to the path.
 
736
    if ( $glob_win32 )
 
737
    {
 
738
      my $lib_mysqld=
 
739
        mtr_path_exists(vs_config_dirs('libmysqld',''));
 
740
          $lib_mysqld= $glob_cygwin_perl ? ":".`cygpath "$lib_mysqld"` 
 
741
                                     : ";".$lib_mysqld;
 
742
      chomp($lib_mysqld);
 
743
      $ENV{'PATH'}="$ENV{'PATH'}".$lib_mysqld;
 
744
    }
 
745
 
 
746
    push(@glob_test_mode, "embedded");
 
747
    $opt_skip_rpl= 1;              # We never run replication with embedded
 
748
    $opt_skip_ndbcluster= 1;       # Turn off use of NDB cluster
 
749
    $opt_skip_ssl= 1;              # Turn off use of SSL
 
750
 
 
751
    # Turn off use of bin log
 
752
    push(@opt_extra_mysqld_opt, "--skip-log-bin");
 
753
 
 
754
    if ( $opt_extern )
 
755
    {
 
756
      mtr_error("Can't use --extern with --embedded-server");
 
757
    }
 
758
  }
 
759
 
629
760
  #
630
761
  # Find the mysqld executable to be able to find the mysqld version
631
762
  # number as early as possible
632
763
  #
633
764
 
634
765
  # Look for the client binaries directory
635
 
  $path_client_bindir= mtr_path_exists("$glob_basedir/client",
 
766
  $path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
 
767
                                       "$glob_basedir/client_debug",
 
768
                                       vs_config_dirs('client', ''),
 
769
                                       "$glob_basedir/client",
636
770
                                       "$glob_basedir/bin");
637
771
 
 
772
  # Look for language files and charsetsdir, use same share
 
773
  $path_share=      mtr_path_exists("$glob_basedir/share/mysql",
 
774
                                    "$glob_basedir/sql/share",
 
775
                                    "$glob_basedir/share");
 
776
 
 
777
  $path_language=      mtr_path_exists("$path_share/english");
 
778
  $path_charsetsdir=   mtr_path_exists("$path_share/charsets");
 
779
 
 
780
 
638
781
  if (!$opt_extern)
639
782
  {
640
 
    $exe_drizzled=       mtr_exe_exists ("$glob_basedir/drizzled/drizzled",
641
 
                                       "$path_client_bindir/drizzled",
642
 
                                       "$glob_basedir/libexec/drizzled",
643
 
                                       "$glob_basedir/bin/drizzled",
644
 
                                       "$glob_basedir/sbin/drizzled");
 
783
    $exe_mysqld=       mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
 
784
                                       vs_config_dirs('sql', 'mysqld-debug'),
 
785
                                       "$glob_basedir/sql/mysqld",
 
786
                                       "$path_client_bindir/mysqld-max-nt",
 
787
                                       "$path_client_bindir/mysqld-max",
 
788
                                       "$path_client_bindir/mysqld-nt",
 
789
                                       "$path_client_bindir/mysqld",
 
790
                                       "$path_client_bindir/mysqld-debug",
 
791
                                       "$path_client_bindir/mysqld-max",
 
792
                                       "$glob_basedir/libexec/mysqld",
 
793
                                       "$glob_basedir/bin/mysqld",
 
794
                                       "$glob_basedir/sbin/mysqld");
645
795
 
646
796
    # Use the mysqld found above to find out what features are available
647
797
    collect_mysqld_features();
648
798
  }
649
799
  else
650
800
  {
651
 
    $mysqld_variables{'port'}= 4427;
652
 
  }
653
 
 
654
 
  if (!$opt_engine)
655
 
  {
656
 
    $opt_engine= "innodb";
 
801
    $mysqld_variables{'port'}= 3306;
657
802
  }
658
803
 
659
804
  if ( $opt_comment )
712
857
  # --------------------------------------------------------------------------
713
858
  # Find out default storage engine being used(if any)
714
859
  # --------------------------------------------------------------------------
 
860
  if ( $opt_with_ndbcluster )
 
861
  {
 
862
    # --ndb or --with-ndbcluster turns on --default-storage-engine=ndbcluster
 
863
    push(@opt_extra_mysqld_opt, "--default-storage-engine=ndbcluster");
 
864
  }
 
865
 
715
866
  foreach my $arg ( @opt_extra_mysqld_opt )
716
867
  {
717
868
    if ( $arg =~ /default-storage-engine=(\S+)/ )
762
913
    # Version 4.1 and --vardir was specified
763
914
    # Only supported as a symlink from var/
764
915
    # by setting up $opt_mem that symlink will be created
 
916
    if ( ! $glob_win32 )
765
917
    {
766
918
      # Only platforms that have native symlinks can use the vardir trick
767
919
      $opt_mem= $opt_vardir;
776
928
  $path_vardir_trace=~ s/^\w://;
777
929
 
778
930
  # We make the path absolute, as the server will do a chdir() before usage
779
 
  unless ( $opt_vardir =~ m,^/,)
 
931
  unless ( $opt_vardir =~ m,^/, or
 
932
           ($glob_win32 and $opt_vardir =~ m,^[a-z]:/,i) )
780
933
  {
781
934
    # Make absolute path, relative test dir
782
935
    $opt_vardir= "$glob_mysql_test_dir/$opt_vardir";
802
955
  }
803
956
 
804
957
  # --------------------------------------------------------------------------
 
958
  # ps protcol flag
 
959
  # --------------------------------------------------------------------------
 
960
  if ( $opt_ps_protocol )
 
961
  {
 
962
    push(@glob_test_mode, "ps-protocol");
 
963
  }
 
964
 
 
965
  # --------------------------------------------------------------------------
805
966
  # Bench flags
806
967
  # --------------------------------------------------------------------------
807
968
  if ( $opt_small_bench )
843
1004
  # --------------------------------------------------------------------------
844
1005
  # Check if special exe was selected for master or slave
845
1006
  # --------------------------------------------------------------------------
846
 
  $exe_master_mysqld= $exe_master_mysqld || $exe_drizzled;
847
 
  $exe_slave_mysqld=  $exe_slave_mysqld  || $exe_drizzled;
 
1007
  $exe_master_mysqld= $exe_master_mysqld || $exe_mysqld;
 
1008
  $exe_slave_mysqld=  $exe_slave_mysqld  || $exe_mysqld;
848
1009
 
849
1010
  # --------------------------------------------------------------------------
850
1011
  # Check valgrind arguments
854
1015
    mtr_report("Turning on valgrind for all executables");
855
1016
    $opt_valgrind= 1;
856
1017
    $opt_valgrind_mysqld= 1;
857
 
    $opt_valgrind_drizzletest= 1;
 
1018
    $opt_valgrind_mysqltest= 1;
858
1019
  }
859
1020
  elsif ( $opt_valgrind_mysqld )
860
1021
  {
861
1022
    mtr_report("Turning on valgrind for mysqld(s) only");
862
1023
    $opt_valgrind= 1;
863
1024
  }
864
 
  elsif ( $opt_valgrind_drizzletest )
 
1025
  elsif ( $opt_valgrind_mysqltest )
865
1026
  {
866
 
    mtr_report("Turning on valgrind for drizzletest and drizzle_client_test only");
 
1027
    mtr_report("Turning on valgrind for mysqltest and mysql_client_test only");
867
1028
    $opt_valgrind= 1;
868
1029
  }
869
1030
 
892
1053
  {
893
1054
    $opt_testcase_timeout= $default_testcase_timeout;
894
1055
    $opt_testcase_timeout*= 10 if $opt_valgrind;
 
1056
    $opt_testcase_timeout*= 10 if ($opt_debug and $glob_win32);
895
1057
  }
896
1058
 
897
1059
  if ( ! $opt_suite_timeout )
898
1060
  {
899
1061
    $opt_suite_timeout= $default_suite_timeout;
900
1062
    $opt_suite_timeout*= 6 if $opt_valgrind;
 
1063
    $opt_suite_timeout*= 6 if ($opt_debug and $glob_win32);
901
1064
  }
902
1065
 
903
1066
  if ( ! $opt_user )
1000
1163
  };
1001
1164
 
1002
1165
 
 
1166
  my $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port";
 
1167
  $clusters->[0]=
 
1168
  {
 
1169
   name            => "Master",
 
1170
   nodes           => 2,
 
1171
   port            => "$opt_ndbcluster_port",
 
1172
   data_dir        => "$data_dir",
 
1173
   connect_string  => "host=localhost:$opt_ndbcluster_port",
 
1174
   path_pid        => "$data_dir/ndb_3.pid", # Nodes + 1
 
1175
   pid             => 0, # pid of ndb_mgmd
 
1176
   installed_ok    => 0,
 
1177
  };
 
1178
 
 
1179
  $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port_slave";
 
1180
  $clusters->[1]=
 
1181
  {
 
1182
   name            => "Slave",
 
1183
   nodes           => 1,
 
1184
   port            => "$opt_ndbcluster_port_slave",
 
1185
   data_dir        => "$data_dir",
 
1186
   connect_string  => "host=localhost:$opt_ndbcluster_port_slave",
 
1187
   path_pid        => "$data_dir/ndb_2.pid", # Nodes + 1
 
1188
   pid             => 0, # pid of ndb_mgmd
 
1189
   installed_ok    => 0,
 
1190
  };
 
1191
 
 
1192
  # Init pids of ndbd's
 
1193
  foreach my $cluster ( @{$clusters} )
 
1194
  {
 
1195
    for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ )
 
1196
    {
 
1197
      my $nodeid= $idx+1;
 
1198
      $cluster->{'ndbds'}->[$idx]=
 
1199
        {
 
1200
         pid      => 0,
 
1201
         nodeid => $nodeid,
 
1202
         path_pid => "$cluster->{'data_dir'}/ndb_${nodeid}.pid",
 
1203
         path_fs => "$cluster->{'data_dir'}/ndb_${nodeid}_fs",
 
1204
        };
 
1205
    }
 
1206
  }
 
1207
 
1003
1208
  # --------------------------------------------------------------------------
1004
1209
  # extern
1005
1210
  # --------------------------------------------------------------------------
1007
1212
  {
1008
1213
    # Turn off features not supported when running with extern server
1009
1214
    $opt_skip_rpl= 1;
 
1215
    $opt_skip_ndbcluster= 1;
1010
1216
    warn("Currenty broken --extern");
1011
1217
 
1012
1218
    # Setup master->[0] with the settings for the extern server
1020
1226
  }
1021
1227
 
1022
1228
 
1023
 
  $path_timefile=  "$opt_vardir/log/drizzletest-time";
1024
 
  $path_drizzletest_log=  "$opt_vardir/log/drizzletest.log";
 
1229
  # --------------------------------------------------------------------------
 
1230
  # ndbconnectstring and ndbconnectstring_slave
 
1231
  # --------------------------------------------------------------------------
 
1232
  if ( $opt_ndbconnectstring )
 
1233
  {
 
1234
    # ndbconnectstring was supplied by user, the tests shoudl be run
 
1235
    # against an already started cluster, change settings
 
1236
    my $cluster= $clusters->[0]; # Master cluster
 
1237
    $cluster->{'connect_string'}= $opt_ndbconnectstring;
 
1238
    $cluster->{'use_running'}= 1;
 
1239
 
 
1240
    mtr_error("Can't specify --ndb-connectstring and --skip-ndbcluster")
 
1241
      if $opt_skip_ndbcluster;
 
1242
  }
 
1243
  $ENV{'NDB_CONNECTSTRING'}= $clusters->[0]->{'connect_string'};
 
1244
 
 
1245
 
 
1246
  if ( $opt_ndbconnectstring_slave )
 
1247
  {
 
1248
    # ndbconnectstring-slave was supplied by user, the tests should be run
 
1249
    # agains an already started slave cluster, change settings
 
1250
    my $cluster= $clusters->[1]; # Slave cluster
 
1251
    $cluster->{'connect_string'}= $opt_ndbconnectstring_slave;
 
1252
    $cluster->{'use_running'}= 1;
 
1253
 
 
1254
    mtr_error("Can't specify ndb-connectstring_slave and " .
 
1255
              "--skip-ndbcluster-slave")
 
1256
      if $opt_skip_ndbcluster_slave;
 
1257
  }
 
1258
 
 
1259
 
 
1260
  $path_timefile=  "$opt_vardir/log/mysqltest-time";
 
1261
  $path_mysqltest_log=  "$opt_vardir/log/mysqltest.log";
1025
1262
  $path_current_test_log= "$opt_vardir/log/current_test";
 
1263
  $path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log";
1026
1264
 
1027
1265
  $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/";
1028
1266
 
1069
1307
  # A magic value in command_line_setup depends on these equations.
1070
1308
  $opt_master_myport=         $mtr_build_thread * 10 + 10000; # and 1
1071
1309
  $opt_slave_myport=          $opt_master_myport + 2;  # and 3 4
 
1310
  $opt_ndbcluster_port=       $opt_master_myport + 5;
 
1311
  $opt_ndbcluster_port_slave= $opt_master_myport + 6;
1072
1312
 
1073
1313
  if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 )
1074
1314
  {
1114
1354
  #
1115
1355
  # --datadir must exist, mysqld will chdir into it
1116
1356
  #
1117
 
  my $list= `$exe_drizzled --no-defaults --datadir=$tmpdir --skip-grant-tables --verbose --help`;
 
1357
  my $list= `$exe_mysqld --no-defaults --datadir=$tmpdir --language=$path_language --skip-grant-tables --verbose --help`;
1118
1358
 
1119
1359
  foreach my $line (split('\n', $list))
1120
1360
  {
1122
1362
    if ( !$mysql_version_id )
1123
1363
    {
1124
1364
      # Look for version
1125
 
      my $exe_name= basename($exe_drizzled);
 
1365
      my $exe_name= basename($exe_mysqld);
1126
1366
      mtr_verbose("exe_name: $exe_name");
1127
1367
      if ( $line =~ /^\S*$exe_name\s\sVer\s([0-9]*)\.([0-9]*)\.([0-9]*)/ )
1128
1368
      {
1188
1428
  mtr_add_arg($args, "--silent"); # Tab separated output
1189
1429
  mtr_add_arg($args, "-e '%s'", $query);
1190
1430
 
1191
 
  my $cmd= "$exe_drizzle " . join(' ', @$args);
 
1431
  my $cmd= "$exe_mysql " . join(' ', @$args);
1192
1432
  mtr_verbose("cmd: $cmd");
1193
1433
  return `$cmd`;
1194
1434
}
1209
1449
  }
1210
1450
}
1211
1451
 
 
1452
 
 
1453
sub executable_setup_ndb () {
 
1454
 
 
1455
  # Look for ndb tols and binaries
 
1456
  my $ndb_path= mtr_file_exists("$glob_basedir/ndb",
 
1457
                                "$glob_basedir/storage/ndb",
 
1458
                                "$glob_basedir/bin");
 
1459
 
 
1460
  $exe_ndbd=
 
1461
    mtr_exe_maybe_exists("$ndb_path/src/kernel/ndbd",
 
1462
                         "$ndb_path/ndbd");
 
1463
  $exe_ndb_mgm=
 
1464
    mtr_exe_maybe_exists("$ndb_path/src/mgmclient/ndb_mgm",
 
1465
                         "$ndb_path/ndb_mgm");
 
1466
  $exe_ndb_mgmd=
 
1467
    mtr_exe_maybe_exists("$ndb_path/src/mgmsrv/ndb_mgmd",
 
1468
                         "$ndb_path/ndb_mgmd");
 
1469
  $exe_ndb_waiter=
 
1470
    mtr_exe_maybe_exists("$ndb_path/tools/ndb_waiter",
 
1471
                         "$ndb_path/ndb_waiter");
 
1472
 
 
1473
  # May not exist
 
1474
  $path_ndb_tools_dir= mtr_file_exists("$ndb_path/tools",
 
1475
                                       "$ndb_path");
 
1476
  # May not exist
 
1477
  $path_ndb_examples_dir=
 
1478
    mtr_file_exists("$ndb_path/ndbapi-examples",
 
1479
                    "$ndb_path/examples");
 
1480
  # May not exist
 
1481
  $exe_ndb_example=
 
1482
    mtr_file_exists("$path_ndb_examples_dir/ndbapi_simple/ndbapi_simple");
 
1483
 
 
1484
  return ( $exe_ndbd eq "" or
 
1485
           $exe_ndb_mgm eq "" or
 
1486
           $exe_ndb_mgmd eq "" or
 
1487
           $exe_ndb_waiter eq "");
 
1488
}
 
1489
 
1212
1490
sub executable_setup () {
1213
1491
 
1214
 
#
1215
 
# Check if libtool is available in this distribution/clone
1216
 
# we need it when valgrinding or debugging non installed binary
1217
 
# Otherwise valgrind will valgrind the libtool wrapper or bash
1218
 
# and gdb will not find the real executable to debug
1219
 
#
 
1492
  #
 
1493
  # Check if libtool is available in this distribution/clone
 
1494
  # we need it when valgrinding or debugging non installed binary
 
1495
  # Otherwise valgrind will valgrind the libtool wrapper or bash
 
1496
  # and gdb will not find the real executable to debug
 
1497
  #
1220
1498
  if ( -x "../libtool")
1221
1499
  {
1222
1500
    $exe_libtool= "../libtool";
1226
1504
    }
1227
1505
  }
1228
1506
 
1229
 
# Look for my_print_defaults
 
1507
  # Look for my_print_defaults
1230
1508
  $exe_my_print_defaults=
1231
 
    mtr_exe_exists(
1232
 
        "$path_client_bindir/my_print_defaults",
1233
 
        "$glob_basedir/extra/my_print_defaults");
 
1509
    mtr_exe_exists(vs_config_dirs('extra', 'my_print_defaults'),
 
1510
                           "$path_client_bindir/my_print_defaults",
 
1511
                           "$glob_basedir/extra/my_print_defaults");
1234
1512
 
1235
 
# Look for perror
 
1513
  # Look for perror
1236
1514
  $exe_perror= "perror";
1237
1515
 
1238
 
# Look for the client binaries
1239
 
  $exe_drizzlecheck= mtr_exe_exists("$path_client_bindir/drizzlecheck");
1240
 
  $exe_drizzledump= mtr_exe_exists("$path_client_bindir/drizzledump");
1241
 
  $exe_drizzleimport= mtr_exe_exists("$path_client_bindir/drizzleimport");
1242
 
  $exe_drizzleadmin= mtr_exe_exists("$path_client_bindir/drizzleadmin");
1243
 
  $exe_drizzle=          mtr_exe_exists("$path_client_bindir/drizzle");
 
1516
  # Look for the client binaries
 
1517
  $exe_mysqlcheck=     mtr_exe_exists("$path_client_bindir/mysqlcheck");
 
1518
  $exe_mysqldump=      mtr_exe_exists("$path_client_bindir/mysqldump");
 
1519
  $exe_mysqlimport=    mtr_exe_exists("$path_client_bindir/mysqlimport");
 
1520
  $exe_mysqlshow=      mtr_exe_exists("$path_client_bindir/mysqlshow");
 
1521
  $exe_mysqlbinlog=    mtr_exe_exists("$path_client_bindir/mysqlbinlog");
 
1522
  $exe_mysqladmin=     mtr_exe_exists("$path_client_bindir/mysqladmin");
 
1523
  $exe_mysql=          mtr_exe_exists("$path_client_bindir/mysql");
1244
1524
 
1245
1525
  if (!$opt_extern)
1246
1526
  {
1247
 
# Look for SQL scripts directory
1248
 
     if ( $mysql_version_id >= 50100 )
1249
 
     {
1250
 
         $exe_drizzleslap= mtr_exe_exists("$path_client_bindir/drizzleslap");
1251
 
     }
1252
 
  }
1253
 
 
1254
 
# Look for drizzletest executable
1255
 
  {
1256
 
    $exe_drizzletest= mtr_exe_exists("$path_client_bindir/drizzletest");
1257
 
  }
1258
 
 
1259
 
# Look for drizzle_client_test executable which may _not_ exist in
1260
 
# some versions, test using it should be skipped
1261
 
  {
1262
 
    $exe_drizzle_client_test=
 
1527
  # Look for SQL scripts directory
 
1528
    if ( mtr_file_exists("$path_share/mysql_system_tables.sql") ne "")
 
1529
    {
 
1530
      # The SQL scripts are in path_share
 
1531
      $path_sql_dir= $path_share;
 
1532
    }
 
1533
    else
 
1534
    {
 
1535
  $path_sql_dir= mtr_path_exists("$glob_basedir/share",
 
1536
                                 "$glob_basedir/scripts");
 
1537
    }
 
1538
 
 
1539
    if ( $mysql_version_id >= 50100 )
 
1540
    {
 
1541
      $exe_mysqlslap=    mtr_exe_exists("$path_client_bindir/mysqlslap");
 
1542
    }
 
1543
 
 
1544
 
 
1545
    if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
 
1546
    {
 
1547
      mtr_warning("Could not find all required ndb binaries, " .
 
1548
                "all ndb tests will fail, use --skip-ndbcluster to " .
 
1549
                "skip testing it.");
 
1550
 
 
1551
      foreach my $cluster (@{$clusters})
 
1552
      {
 
1553
        $cluster->{"executable_setup_failed"}= 1;
 
1554
      }
 
1555
    }
 
1556
 
 
1557
 
 
1558
    # Look for the udf_example library
 
1559
    $lib_udf_example=
 
1560
      mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
 
1561
                      "$glob_basedir/sql/.libs/udf_example.so",);
 
1562
 
 
1563
    # Look for the ha_example library
 
1564
    $lib_example_plugin=
 
1565
      mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
 
1566
                      "$glob_basedir/storage/example/.libs/ha_example.so",);
 
1567
 
 
1568
  }
 
1569
 
 
1570
  # Look for mysqltest executable
 
1571
  if ( $glob_use_embedded_server )
 
1572
  {
 
1573
    $exe_mysqltest=
 
1574
      mtr_exe_exists(vs_config_dirs('libmysqld/examples','mysqltest_embedded'),
 
1575
                     "$glob_basedir/libmysqld/examples/mysqltest_embedded",
 
1576
                     "$path_client_bindir/mysqltest_embedded");
 
1577
  }
 
1578
  else
 
1579
  {
 
1580
    $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
 
1581
  }
 
1582
 
 
1583
  # Look for mysql_client_test executable which may _not_ exist in
 
1584
  # some versions, test using it should be skipped
 
1585
  if ( $glob_use_embedded_server )
 
1586
  {
 
1587
    $exe_mysql_client_test=
1263
1588
      mtr_exe_maybe_exists(
1264
 
          "$glob_basedir/tests/drizzle_client_test",
1265
 
          "$glob_basedir/bin/drizzle_client_test");
 
1589
        vs_config_dirs('libmysqld/examples', 'mysql_client_test_embedded'),
 
1590
        "$glob_basedir/libmysqld/examples/mysql_client_test_embedded");
 
1591
  }
 
1592
  else
 
1593
  {
 
1594
    $exe_mysql_client_test=
 
1595
      mtr_exe_maybe_exists(vs_config_dirs('tests', 'mysql_client_test'),
 
1596
                           "$glob_basedir/tests/mysql_client_test",
 
1597
                           "$glob_basedir/bin/mysql_client_test");
1266
1598
  }
1267
1599
 
1268
 
# Look for bug25714 executable which may _not_ exist in
1269
 
# some versions, test using it should be skipped
 
1600
  # Look for bug25714 executable which may _not_ exist in
 
1601
  # some versions, test using it should be skipped
1270
1602
  $exe_bug25714=
1271
 
    mtr_exe_maybe_exists(
1272
 
        "$glob_basedir/tests/bug25714");
 
1603
      mtr_exe_maybe_exists(vs_config_dirs('tests', 'bug25714'),
 
1604
                           "$glob_basedir/tests/bug25714");
1273
1605
}
1274
1606
 
1275
1607
 
1276
 
 
1277
1608
sub generate_cmdline_mysqldump ($) {
1278
1609
  my($mysqld) = @_;
1279
1610
  return
1280
 
    mtr_native_path($exe_drizzledump) .
 
1611
    mtr_native_path($exe_mysqldump) .
1281
1612
      " --no-defaults -uroot --debug-check " .
1282
1613
      "--port=$mysqld->{'port'} ";
1283
1614
}
1286
1617
##############################################################################
1287
1618
#
1288
1619
#  Set environment to be used by childs of this process for
1289
 
#  things that are constant duting the whole lifetime of drizzle-test-run.pl
 
1620
#  things that are constant duting the whole lifetime of mysql-test-run.pl
1290
1621
#
1291
1622
##############################################################################
1292
1623
 
1293
 
sub drizzle_client_test_arguments()
 
1624
sub mysql_client_test_arguments()
1294
1625
{
1295
 
  my $exe= $exe_drizzle_client_test;
 
1626
  my $exe= $exe_mysql_client_test;
1296
1627
 
1297
1628
  my $args;
1298
1629
  mtr_init_args(\$args);
1299
 
  if ( $opt_valgrind_drizzletest )
 
1630
  if ( $opt_valgrind_mysqltest )
1300
1631
  {
1301
1632
    valgrind_arguments($args, \$exe);
1302
1633
  }
1314
1645
  if ( $opt_debug )
1315
1646
  {
1316
1647
    mtr_add_arg($args,
1317
 
      "--debug=d:t:A,$path_vardir_trace/log/drizzle_client_test.trace");
 
1648
      "--debug=d:t:A,$path_vardir_trace/log/mysql_client_test.trace");
 
1649
  }
 
1650
 
 
1651
  if ( $glob_use_embedded_server )
 
1652
  {
 
1653
    mtr_add_arg($args,
 
1654
      " -A --language=$path_language");
 
1655
    mtr_add_arg($args,
 
1656
      " -A --datadir=$slave->[0]->{'path_myddir'}");
 
1657
    mtr_add_arg($args,
 
1658
      " -A --character-sets-dir=$path_charsetsdir");
1318
1659
  }
1319
1660
 
1320
1661
  return join(" ", $exe, @$args);
1344
1685
    push(@ld_library_paths, "$glob_basedir/lib");
1345
1686
  }
1346
1687
 
 
1688
 # --------------------------------------------------------------------------
 
1689
  # Add the path where libndbclient can be found
 
1690
  # --------------------------------------------------------------------------
 
1691
  if ( $glob_ndbcluster_supported )
 
1692
  {
 
1693
    push(@ld_library_paths,  "$glob_basedir/storage/ndb/src/.libs");
 
1694
  }
 
1695
 
1347
1696
  # --------------------------------------------------------------------------
1348
1697
  # Valgrind need to be run with debug libraries otherwise it's almost
1349
1698
  # impossible to add correct supressions, that means if "/usr/lib/debug"
1390
1739
  # Also command lines in .opt files may contain env vars
1391
1740
  # --------------------------------------------------------------------------
1392
1741
 
1393
 
  $ENV{'CHARSETSDIR'}=              "";
 
1742
  $ENV{'CHARSETSDIR'}=              $path_charsetsdir;
1394
1743
  $ENV{'UMASK'}=              "0660"; # The octal *string*
1395
1744
  $ENV{'UMASK_DIR'}=          "0770"; # The octal *string*
1396
1745
  
1407
1756
  
1408
1757
  $ENV{'LC_COLLATE'}=         "C";
1409
1758
  $ENV{'USE_RUNNING_SERVER'}= $opt_extern;
1410
 
  $ENV{'DRIZZLE_TEST_DIR'}=     $glob_mysql_test_dir;
 
1759
  $ENV{'MYSQL_TEST_DIR'}=     $glob_mysql_test_dir;
1411
1760
  $ENV{'MYSQLTEST_VARDIR'}=   $opt_vardir;
1412
 
  $ENV{'DRIZZLE_TMP_DIR'}=      $opt_tmpdir;
 
1761
  $ENV{'MYSQL_TMP_DIR'}=      $opt_tmpdir;
1413
1762
  $ENV{'MASTER_MYSOCK'}=      $master->[0]->{'path_sock'};
1414
1763
  $ENV{'MASTER_MYSOCK1'}=     $master->[1]->{'path_sock'};
1415
1764
  $ENV{'MASTER_MYPORT'}=      $master->[0]->{'port'};
1418
1767
  $ENV{'SLAVE_MYPORT'}=       $slave->[0]->{'port'};
1419
1768
  $ENV{'SLAVE_MYPORT1'}=      $slave->[1]->{'port'};
1420
1769
  $ENV{'SLAVE_MYPORT2'}=      $slave->[2]->{'port'};
1421
 
  $ENV{'DRIZZLE_TCP_PORT'}=     $mysqld_variables{'port'};
 
1770
  $ENV{'MYSQL_TCP_PORT'}=     $mysqld_variables{'port'};
1422
1771
 
1423
1772
  $ENV{MTR_BUILD_THREAD}=      $opt_mtr_build_thread;
1424
1773
 
1425
 
  $ENV{'EXE_MYSQL'}=          $exe_drizzle;
 
1774
  $ENV{'EXE_MYSQL'}=          $exe_mysql;
 
1775
 
 
1776
 
 
1777
  # ----------------------------------------------------
 
1778
  # Setup env for NDB
 
1779
  # ----------------------------------------------------
 
1780
  if ( ! $opt_skip_ndbcluster )
 
1781
  {
 
1782
    $ENV{'NDB_MGM'}=                  $exe_ndb_mgm;
 
1783
 
 
1784
    $ENV{'NDBCLUSTER_PORT'}=          $opt_ndbcluster_port;
 
1785
    $ENV{'NDBCLUSTER_PORT_SLAVE'}=    $opt_ndbcluster_port_slave;
 
1786
 
 
1787
    $ENV{'NDB_EXTRA_TEST'}=           $opt_ndb_extra_test;
 
1788
 
 
1789
    $ENV{'NDB_BACKUP_DIR'}=           $clusters->[0]->{'data_dir'};
 
1790
    $ENV{'NDB_DATA_DIR'}=             $clusters->[0]->{'data_dir'};
 
1791
    $ENV{'NDB_TOOLS_DIR'}=            $path_ndb_tools_dir;
 
1792
    $ENV{'NDB_TOOLS_OUTPUT'}=         $path_ndb_testrun_log;
 
1793
 
 
1794
    if ( $mysql_version_id >= 50000 )
 
1795
    {
 
1796
      $ENV{'NDB_EXAMPLES_DIR'}=         $path_ndb_examples_dir;
 
1797
      $ENV{'MY_NDB_EXAMPLES_BINARY'}=   $exe_ndb_example;
 
1798
    }
 
1799
    $ENV{'NDB_EXAMPLES_OUTPUT'}=      $path_ndb_testrun_log;
 
1800
  }
1426
1801
 
1427
1802
  # ----------------------------------------------------
1428
1803
  # Setup env so childs can execute mysqlcheck
1429
1804
  # ----------------------------------------------------
1430
1805
  my $cmdline_mysqlcheck=
1431
 
    mtr_native_path($exe_drizzlecheck) .
 
1806
    mtr_native_path($exe_mysqlcheck) .
1432
1807
    " --no-defaults --debug-check -uroot " .
1433
1808
    "--port=$master->[0]->{'port'} ";
1434
1809
 
1437
1812
    $cmdline_mysqlcheck .=
1438
1813
      " --debug=d:t:A,$path_vardir_trace/log/mysqlcheck.trace";
1439
1814
  }
1440
 
  $ENV{'DRIZZLE_CHECK'}=              $cmdline_mysqlcheck;
 
1815
  $ENV{'MYSQL_CHECK'}=              $cmdline_mysqlcheck;
1441
1816
 
1442
1817
  # ----------------------------------------------------
1443
1818
  # Setup env to childs can execute myqldump
1452
1827
    $cmdline_mysqldumpslave .=
1453
1828
      " --debug=d:t:A,$path_vardir_trace/log/mysqldump-slave.trace";
1454
1829
  }
1455
 
  $ENV{'DRIZZLE_DUMP'}= $cmdline_mysqldump;
1456
 
  $ENV{'DRIZZLE_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
 
1830
  $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
 
1831
  $ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
 
1832
 
1457
1833
 
1458
1834
  # ----------------------------------------------------
1459
1835
  # Setup env so childs can execute mysqlslap
1460
1836
  # ----------------------------------------------------
1461
 
  if ( $exe_drizzleslap )
 
1837
  if ( $exe_mysqlslap )
1462
1838
  {
1463
 
    my $cmdline_drizzleslap=
1464
 
      mtr_native_path($exe_drizzleslap) .
 
1839
    my $cmdline_mysqlslap=
 
1840
      mtr_native_path($exe_mysqlslap) .
1465
1841
      " -uroot " .
1466
1842
      "--port=$master->[0]->{'port'} ";
1467
1843
 
1468
1844
    if ( $opt_debug )
1469
1845
   {
1470
 
      $cmdline_drizzleslap .=
1471
 
        " --debug=d:t:A,$path_vardir_trace/log/drizzleslap.trace";
 
1846
      $cmdline_mysqlslap .=
 
1847
        " --debug=d:t:A,$path_vardir_trace/log/mysqlslap.trace";
1472
1848
    }
1473
 
    $ENV{'DRIZZLE_SLAP'}= $cmdline_drizzleslap;
 
1849
    $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap;
1474
1850
  }
1475
1851
 
1476
 
 
1477
 
 
1478
1852
  # ----------------------------------------------------
1479
1853
  # Setup env so childs can execute mysqlimport
1480
1854
  # ----------------------------------------------------
1481
1855
  my $cmdline_mysqlimport=
1482
 
    mtr_native_path($exe_drizzleimport) .
 
1856
    mtr_native_path($exe_mysqlimport) .
1483
1857
    " -uroot --debug-check " .
1484
1858
    "--port=$master->[0]->{'port'} ";
1485
1859
 
1488
1862
    $cmdline_mysqlimport .=
1489
1863
      " --debug=d:t:A,$path_vardir_trace/log/mysqlimport.trace";
1490
1864
  }
1491
 
  $ENV{'DRIZZLE_IMPORT'}= $cmdline_mysqlimport;
1492
 
 
 
1865
  $ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
 
1866
 
 
1867
 
 
1868
  # ----------------------------------------------------
 
1869
  # Setup env so childs can execute mysqlshow
 
1870
  # ----------------------------------------------------
 
1871
  my $cmdline_mysqlshow=
 
1872
    mtr_native_path($exe_mysqlshow) .
 
1873
    " -uroot --debug-check " .
 
1874
    "--port=$master->[0]->{'port'} ";
 
1875
 
 
1876
  if ( $opt_debug )
 
1877
  {
 
1878
    $cmdline_mysqlshow .=
 
1879
      " --debug=d:t:A,$path_vardir_trace/log/mysqlshow.trace";
 
1880
  }
 
1881
  $ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
 
1882
 
 
1883
  # ----------------------------------------------------
 
1884
  # Setup env so childs can execute mysqlbinlog
 
1885
  # ----------------------------------------------------
 
1886
  my $cmdline_mysqlbinlog=
 
1887
    mtr_native_path($exe_mysqlbinlog) .
 
1888
      " --no-defaults --disable-force-if-open --debug-check";
 
1889
  if ( !$opt_extern && $mysql_version_id >= 50000 )
 
1890
  {
 
1891
    $cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
 
1892
  }
 
1893
 
 
1894
  if ( $opt_debug )
 
1895
  {
 
1896
    $cmdline_mysqlbinlog .=
 
1897
      " --debug=d:t:A,$path_vardir_trace/log/mysqlbinlog.trace";
 
1898
  }
 
1899
  $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
1493
1900
 
1494
1901
  # ----------------------------------------------------
1495
1902
  # Setup env so childs can execute mysql
1496
1903
  # ----------------------------------------------------
1497
1904
  my $cmdline_mysql=
1498
 
    mtr_native_path($exe_drizzle) .
 
1905
    mtr_native_path($exe_mysql) .
1499
1906
    " --no-defaults --debug-check --host=localhost  --user=root --password= " .
1500
 
    "--port=$master->[0]->{'port'} ";
 
1907
    "--port=$master->[0]->{'port'} " .
 
1908
    "--character-sets-dir=$path_charsetsdir";
1501
1909
 
1502
1910
  $ENV{'MYSQL'}= $cmdline_mysql;
1503
1911
 
1504
1912
  # ----------------------------------------------------
1505
1913
  # Setup env so childs can execute bug25714
1506
1914
  # ----------------------------------------------------
1507
 
  $ENV{'DRIZZLE_BUG25714'}=  $exe_bug25714;
 
1915
  $ENV{'MYSQL_BUG25714'}=  $exe_bug25714;
1508
1916
 
1509
1917
  # ----------------------------------------------------
1510
 
  # Setup env so childs can execute drizzle_client_test
 
1918
  # Setup env so childs can execute mysql_client_test
1511
1919
  # ----------------------------------------------------
1512
 
  $ENV{'DRIZZLE_CLIENT_TEST'}=  drizzle_client_test_arguments();
 
1920
  $ENV{'MYSQL_CLIENT_TEST'}=  mysql_client_test_arguments();
1513
1921
 
1514
1922
 
1515
1923
  # ----------------------------------------------------
1516
1924
  # Setup env so childs can execute mysql_fix_system_tables
1517
1925
  # ----------------------------------------------------
1518
 
  #if ( !$opt_extern)
 
1926
  #if ( !$opt_extern && ! $glob_win32 )
1519
1927
  if ( 0 )
1520
1928
  {
1521
1929
    my $cmdline_mysql_fix_system_tables=
1522
 
      "$exe_drizzle_fix_system_tables --no-defaults --host=localhost " .
 
1930
      "$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
1523
1931
      "--user=root --password= " .
1524
1932
      "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
1525
1933
      "--port=$master->[0]->{'port'} ";
1526
 
    $ENV{'DRIZZLE_FIX_SYSTEM_TABLES'}=  $cmdline_mysql_fix_system_tables;
 
1934
    $ENV{'MYSQL_FIX_SYSTEM_TABLES'}=  $cmdline_mysql_fix_system_tables;
1527
1935
 
1528
1936
  }
1529
1937
 
1530
1938
  # ----------------------------------------------------
1531
1939
  # Setup env so childs can execute my_print_defaults
1532
1940
  # ----------------------------------------------------
1533
 
  $ENV{'DRIZZLE_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults);
 
1941
  $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults);
1534
1942
 
1535
1943
  # ----------------------------------------------------
1536
1944
  # Setup env so childs can execute mysqladmin
1537
1945
  # ----------------------------------------------------
1538
 
  $ENV{'MYSQLADMIN'}= mtr_native_path($exe_drizzleadmin);
 
1946
  $ENV{'MYSQLADMIN'}= mtr_native_path($exe_mysqladmin);
1539
1947
 
1540
1948
  # ----------------------------------------------------
1541
1949
  # Setup env so childs can execute perror  
1543
1951
  $ENV{'MY_PERROR'}= mtr_native_path($exe_perror);
1544
1952
 
1545
1953
  # ----------------------------------------------------
 
1954
  # Add the path where mysqld will find udf_example.so
 
1955
  # ----------------------------------------------------
 
1956
  $ENV{'UDF_EXAMPLE_LIB'}=
 
1957
    ($lib_udf_example ? basename($lib_udf_example) : "");
 
1958
  $ENV{'UDF_EXAMPLE_LIB_OPT'}=
 
1959
    ($lib_udf_example ? "--plugin_dir=" . dirname($lib_udf_example) : "");
 
1960
 
 
1961
  # ----------------------------------------------------
1546
1962
  # Add the path where mysqld will find ha_example.so
1547
1963
  # ----------------------------------------------------
1548
1964
  $ENV{'EXAMPLE_PLUGIN'}=
1554
1970
  # Setup env so childs can execute myisampack and myisamchk
1555
1971
  # ----------------------------------------------------
1556
1972
#  $ENV{'MYISAMCHK'}= mtr_native_path(mtr_exe_exists(
 
1973
#                       vs_config_dirs('storage/myisam', 'myisamchk'),
 
1974
#                       vs_config_dirs('myisam', 'myisamchk'),
1557
1975
#                       "$path_client_bindir/myisamchk",
1558
1976
#                       "$glob_basedir/storage/myisam/myisamchk",
1559
1977
#                       "$glob_basedir/myisam/myisamchk"));
1560
1978
#  $ENV{'MYISAMPACK'}= mtr_native_path(mtr_exe_exists(
 
1979
#                        vs_config_dirs('storage/myisam', 'myisampack'),
 
1980
#                        vs_config_dirs('myisam', 'myisampack'),
1561
1981
#                        "$path_client_bindir/myisampack",
1562
1982
#                        "$glob_basedir/storage/myisam/myisampack",
1563
1983
#                        "$glob_basedir/myisam/myisampack"));
1573
1993
    print "Using SLAVE_MYPORT          = $ENV{SLAVE_MYPORT}\n";
1574
1994
    print "Using SLAVE_MYPORT1         = $ENV{SLAVE_MYPORT1}\n";
1575
1995
    print "Using SLAVE_MYPORT2         = $ENV{SLAVE_MYPORT2}\n";
 
1996
    if ( ! $opt_skip_ndbcluster )
 
1997
    {
 
1998
      print "Using NDBCLUSTER_PORT       = $ENV{NDBCLUSTER_PORT}\n";
 
1999
      if ( ! $opt_skip_ndbcluster_slave )
 
2000
      {
 
2001
        print "Using NDBCLUSTER_PORT_SLAVE = $ENV{NDBCLUSTER_PORT_SLAVE}\n";
 
2002
      }
 
2003
    }
1576
2004
  }
1577
2005
 
1578
2006
  # Create an environment variable to make it possible
1609
2037
##############################################################################
1610
2038
 
1611
2039
sub kill_running_servers () {
 
2040
 
 
2041
  if ( $opt_fast or $glob_use_embedded_server )
 
2042
  {
 
2043
    # FIXME is embedded server really using PID files?!
 
2044
    unlink($master->[0]->{'path_pid'});
 
2045
    unlink($master->[1]->{'path_pid'});
 
2046
    unlink($slave->[0]->{'path_pid'});
 
2047
    unlink($slave->[1]->{'path_pid'});
 
2048
    unlink($slave->[2]->{'path_pid'});
 
2049
  }
 
2050
  else
1612
2051
  {
1613
2052
    # Ensure that no old mysqld test servers are running
1614
2053
    # This is different from terminating processes we have
1766
2205
  }
1767
2206
 
1768
2207
  # Make a link std_data_ln in var/ that points to std_data
1769
 
  symlink("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln");
 
2208
  if ( ! $glob_win32 )
 
2209
  {
 
2210
    symlink("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln");
 
2211
  }
 
2212
  else
 
2213
  {
 
2214
    # on windows, copy all files from std_data into var/std_data_ln
 
2215
    mkpath("$opt_vardir/std_data_ln");
 
2216
    opendir(DIR, "$glob_mysql_test_dir/std_data")
 
2217
      or mtr_error("Can't find the std_data directory: $!");
 
2218
    for(readdir(DIR)) {
 
2219
      next if -d "$glob_mysql_test_dir/std_data/$_";
 
2220
      copy("$glob_mysql_test_dir/std_data/$_", "$opt_vardir/std_data_ln/$_");
 
2221
    }
 
2222
    closedir(DIR);
 
2223
  }
1770
2224
 
1771
2225
  # Remove old log files
1772
2226
  foreach my $name (glob("r/*.progress r/*.log r/*.warnings"))
1795
2249
  # the file will not return 0000
1796
2250
  my $file_mode= (stat($test_file))[2] & 07777;
1797
2251
 
1798
 
  $ENV{'DRIZZLE_TEST_ROOT'}= "NO";
 
2252
  $ENV{'MYSQL_TEST_ROOT'}= "NO";
1799
2253
  mtr_verbose("result: $result, file_mode: $file_mode");
1800
2254
  if ($result eq "MySQL" && $file_mode == 0)
1801
2255
  {
1802
2256
    mtr_warning("running this script as _root_ will cause some " .
1803
2257
                "tests to be skipped");
1804
 
    $ENV{'DRIZZLE_TEST_ROOT'}= "YES";
 
2258
    $ENV{'MYSQL_TEST_ROOT'}= "YES";
1805
2259
  }
1806
2260
 
1807
2261
  chmod(oct("0755"), $test_file);
1810
2264
}
1811
2265
 
1812
2266
 
 
2267
sub check_ssl_support ($) {
 
2268
  my $mysqld_variables= shift;
 
2269
 
 
2270
  if ($opt_skip_ssl || $opt_extern)
 
2271
  {
 
2272
    if (!$opt_extern)
 
2273
    {
 
2274
      mtr_report("Skipping SSL");
 
2275
    }
 
2276
    $opt_ssl_supported= 0;
 
2277
    $opt_ssl= 0;
 
2278
    return;
 
2279
  }
 
2280
 
 
2281
  if ( ! $mysqld_variables->{'ssl'} )
 
2282
  {
 
2283
    if ( $opt_ssl)
 
2284
    {
 
2285
      mtr_error("Couldn't find support for SSL");
 
2286
      return;
 
2287
    }
 
2288
    mtr_report("Skipping SSL, mysqld not compiled with SSL");
 
2289
    $opt_ssl_supported= 0;
 
2290
    $opt_ssl= 0;
 
2291
    return;
 
2292
  }
 
2293
  mtr_report("Setting mysqld to support SSL connections");
 
2294
  $opt_ssl_supported= 1;
 
2295
}
 
2296
 
 
2297
 
1813
2298
sub check_debug_support ($) {
1814
2299
  my $mysqld_variables= shift;
1815
2300
 
1828
2313
  $debug_compiled_binaries= 1;
1829
2314
}
1830
2315
 
 
2316
##############################################################################
 
2317
#
 
2318
# Helper function to handle configuration-based subdirectories which Visual
 
2319
# Studio uses for storing binaries.  If opt_vs_config is set, this returns
 
2320
# a path based on that setting; if not, it returns paths for the default
 
2321
# /release/ and /debug/ subdirectories.
 
2322
#
 
2323
# $exe can be undefined, if the directory itself will be used
 
2324
#
 
2325
###############################################################################
 
2326
 
 
2327
sub vs_config_dirs ($$) {
 
2328
  my ($path_part, $exe) = @_;
 
2329
 
 
2330
  $exe = "" if not defined $exe;
 
2331
 
 
2332
  if ($opt_vs_config)
 
2333
  {
 
2334
    return ("$glob_basedir/$path_part/$opt_vs_config/$exe");
 
2335
  }
 
2336
 
 
2337
  return ("$glob_basedir/$path_part/release/$exe",
 
2338
          "$glob_basedir/$path_part/relwithdebinfo/$exe",
 
2339
          "$glob_basedir/$path_part/debug/$exe");
 
2340
}
 
2341
 
 
2342
##############################################################################
 
2343
#
 
2344
#  Start the ndb cluster
 
2345
#
 
2346
##############################################################################
 
2347
 
 
2348
sub check_ndbcluster_support ($) {
 
2349
  my $mysqld_variables= shift;
 
2350
 
 
2351
  if ($opt_skip_ndbcluster || $opt_extern)
 
2352
  {
 
2353
    if (!$opt_extern)
 
2354
    {
 
2355
      mtr_report("Skipping ndbcluster");
 
2356
    }
 
2357
    $opt_skip_ndbcluster_slave= 1;
 
2358
    return;
 
2359
  }
 
2360
 
 
2361
  if ( ! $mysqld_variables->{'ndb-connectstring'} )
 
2362
  {
 
2363
    mtr_report("Skipping ndbcluster, mysqld not compiled with ndbcluster");
 
2364
    $opt_skip_ndbcluster= 1;
 
2365
    $opt_skip_ndbcluster_slave= 1;
 
2366
    return;
 
2367
  }
 
2368
  $glob_ndbcluster_supported= 1;
 
2369
  mtr_report("Using ndbcluster when necessary, mysqld supports it");
 
2370
 
 
2371
  if ( $mysql_version_id < 50100 )
 
2372
  {
 
2373
    # Slave cluster is not supported until 5.1
 
2374
    $opt_skip_ndbcluster_slave= 1;
 
2375
 
 
2376
  }
 
2377
 
 
2378
  return;
 
2379
}
 
2380
 
 
2381
 
 
2382
sub ndbcluster_start_install ($) {
 
2383
  my $cluster= shift;
 
2384
 
 
2385
  mtr_report("Installing $cluster->{'name'} Cluster");
 
2386
 
 
2387
  mkdir($cluster->{'data_dir'});
 
2388
 
 
2389
  # Create a config file from template
 
2390
  my $ndb_no_ord=512;
 
2391
  my $ndb_no_attr=2048;
 
2392
  my $ndb_con_op=105000;
 
2393
  my $ndb_dmem="80M";
 
2394
  my $ndb_imem="24M";
 
2395
  my $ndb_pbmem="32M";
 
2396
  my $nodes= $cluster->{'nodes'};
 
2397
  my $ndb_host= "localhost";
 
2398
  my $ndb_diskless= 0;
 
2399
 
 
2400
  if (!$opt_bench)
 
2401
  {
 
2402
    # Use a smaller configuration
 
2403
    if (  $mysql_version_id < 50100 )
 
2404
    {
 
2405
      # 4.1 and 5.0 is using a "larger" --small configuration
 
2406
      $ndb_no_ord=128;
 
2407
      $ndb_con_op=10000;
 
2408
      $ndb_dmem="40M";
 
2409
      $ndb_imem="12M";
 
2410
    }
 
2411
    else
 
2412
    {
 
2413
      $ndb_no_ord=32;
 
2414
      $ndb_con_op=10000;
 
2415
      $ndb_dmem="20M";
 
2416
      $ndb_imem="1M";
 
2417
      $ndb_pbmem="4M";
 
2418
    }
 
2419
  }
 
2420
 
 
2421
  my $config_file_template=     "ndb/ndb_config_${nodes}_node.ini";
 
2422
  my $config_file= "$cluster->{'data_dir'}/config.ini";
 
2423
 
 
2424
  open(IN, $config_file_template)
 
2425
    or mtr_error("Can't open $config_file_template: $!");
 
2426
  open(OUT, ">", $config_file)
 
2427
    or mtr_error("Can't write to $config_file: $!");
 
2428
  while (<IN>)
 
2429
  {
 
2430
    chomp;
 
2431
 
 
2432
    s/CHOOSE_MaxNoOfAttributes/$ndb_no_attr/;
 
2433
    s/CHOOSE_MaxNoOfOrderedIndexes/$ndb_no_ord/;
 
2434
    s/CHOOSE_MaxNoOfConcurrentOperations/$ndb_con_op/;
 
2435
    s/CHOOSE_DataMemory/$ndb_dmem/;
 
2436
    s/CHOOSE_IndexMemory/$ndb_imem/;
 
2437
    s/CHOOSE_Diskless/$ndb_diskless/;
 
2438
    s/CHOOSE_HOSTNAME_.*/$ndb_host/;
 
2439
    s/CHOOSE_FILESYSTEM/$cluster->{'data_dir'}/;
 
2440
    s/CHOOSE_PORT_MGM/$cluster->{'port'}/;
 
2441
    if ( $mysql_version_id < 50000 )
 
2442
    {
 
2443
      my $base_port= $cluster->{'port'} + 1;
 
2444
      s/CHOOSE_PORT_TRANSPORTER/$base_port/;
 
2445
    }
 
2446
    s/CHOOSE_DiskPageBufferMemory/$ndb_pbmem/;
 
2447
 
 
2448
    print OUT "$_ \n";
 
2449
  }
 
2450
  close OUT;
 
2451
  close IN;
 
2452
 
 
2453
 
 
2454
  # Start cluster with "--initial"
 
2455
 
 
2456
  ndbcluster_start($cluster, "--initial");
 
2457
 
 
2458
  return 0;
 
2459
}
 
2460
 
 
2461
 
 
2462
sub ndbcluster_wait_started($$){
 
2463
  my $cluster= shift;
 
2464
  my $ndb_waiter_extra_opt= shift;
 
2465
  my $path_waiter_log= "$cluster->{'data_dir'}/ndb_waiter.log";
 
2466
  my $args;
 
2467
 
 
2468
  mtr_init_args(\$args);
 
2469
 
 
2470
  mtr_add_arg($args, "--no-defaults");
 
2471
  mtr_add_arg($args, "--core");
 
2472
  mtr_add_arg($args, "--ndb-connectstring=%s", $cluster->{'connect_string'});
 
2473
  mtr_add_arg($args, "--timeout=60");
 
2474
 
 
2475
  if ($ndb_waiter_extra_opt)
 
2476
  {
 
2477
    mtr_add_arg($args, "$ndb_waiter_extra_opt");
 
2478
  }
 
2479
 
 
2480
  # Start the ndb_waiter which will connect to the ndb_mgmd
 
2481
  # and poll it for state of the ndbd's, will return when
 
2482
  # all nodes in the cluster is started
 
2483
  my $res= mtr_run($exe_ndb_waiter, $args,
 
2484
                   "", $path_waiter_log, $path_waiter_log, "");
 
2485
  mtr_verbose("ndbcluster_wait_started, returns: $res") if $res;
 
2486
  return $res;
 
2487
}
 
2488
 
 
2489
 
 
2490
 
 
2491
sub mysqld_wait_started($){
 
2492
  my $mysqld= shift;
 
2493
 
 
2494
  if (sleep_until_file_created($mysqld->{'path_pid'},
 
2495
                               $mysqld->{'start_timeout'},
 
2496
                               $mysqld->{'pid'}) == 0)
 
2497
  {
 
2498
    # Failed to wait for pid file
 
2499
    return 1;
 
2500
  }
 
2501
 
 
2502
  # Get the "real pid" of the process, it will be used for killing
 
2503
  # the process in ActiveState's perl on windows
 
2504
  $mysqld->{'real_pid'}= mtr_get_pid_from_file($mysqld->{'path_pid'});
 
2505
 
 
2506
  return 0;
 
2507
}
 
2508
 
 
2509
 
 
2510
sub ndb_mgmd_wait_started($) {
 
2511
  my ($cluster)= @_;
 
2512
 
 
2513
  my $retries= 100;
 
2514
  while (ndbcluster_wait_started($cluster, "--no-contact") and
 
2515
         $retries)
 
2516
  {
 
2517
    # Millisceond sleep emulated with select
 
2518
    select(undef, undef, undef, (0.1));
 
2519
 
 
2520
    $retries--;
 
2521
  }
 
2522
 
 
2523
  return $retries == 0;
 
2524
 
 
2525
}
 
2526
 
 
2527
sub ndb_mgmd_start ($) {
 
2528
  my $cluster= shift;
 
2529
 
 
2530
  my $args;                             # Arg vector
 
2531
  my $pid= -1;
 
2532
 
 
2533
  mtr_init_args(\$args);
 
2534
  mtr_add_arg($args, "--no-defaults");
 
2535
  mtr_add_arg($args, "--core");
 
2536
  mtr_add_arg($args, "--nodaemon");
 
2537
  mtr_add_arg($args, "--config-file=%s", "$cluster->{'data_dir'}/config.ini");
 
2538
 
 
2539
 
 
2540
  my $path_ndb_mgmd_log= "$cluster->{'data_dir'}/\l$cluster->{'name'}_ndb_mgmd.log";
 
2541
  $pid= mtr_spawn($exe_ndb_mgmd, $args, "",
 
2542
                  $path_ndb_mgmd_log,
 
2543
                  $path_ndb_mgmd_log,
 
2544
                  "",
 
2545
                  { append_log_file => 1 });
 
2546
 
 
2547
  # FIXME Should not be needed
 
2548
  # Unfortunately the cluster nodes will fail to start
 
2549
  # if ndb_mgmd has not started properly
 
2550
  if (ndb_mgmd_wait_started($cluster))
 
2551
  {
 
2552
    mtr_error("Failed to wait for start of ndb_mgmd");
 
2553
  }
 
2554
 
 
2555
  # Remember pid of ndb_mgmd
 
2556
  $cluster->{'pid'}= $pid;
 
2557
 
 
2558
  mtr_verbose("ndb_mgmd_start, pid: $pid");
 
2559
 
 
2560
  return $pid;
 
2561
}
 
2562
 
 
2563
 
 
2564
sub ndbd_start ($$$) {
 
2565
  my $cluster= shift;
 
2566
  my $idx= shift;
 
2567
  my $extra_args= shift;
 
2568
 
 
2569
  my $args;                             # Arg vector
 
2570
  my $pid= -1;
 
2571
 
 
2572
  mtr_init_args(\$args);
 
2573
  mtr_add_arg($args, "--no-defaults");
 
2574
  mtr_add_arg($args, "--core");
 
2575
  mtr_add_arg($args, "--ndb-connectstring=%s", "$cluster->{'connect_string'}");
 
2576
  if ( $mysql_version_id >= 50000)
 
2577
  {
 
2578
    mtr_add_arg($args, "--character-sets-dir=%s", "$path_charsetsdir");
 
2579
  }
 
2580
  mtr_add_arg($args, "--nodaemon");
 
2581
  mtr_add_arg($args, "$extra_args");
 
2582
 
 
2583
  my $nodeid= $cluster->{'ndbds'}->[$idx]->{'nodeid'};
 
2584
  my $path_ndbd_log= "$cluster->{'data_dir'}/ndb_${nodeid}.log";
 
2585
  $pid= mtr_spawn($exe_ndbd, $args, "",
 
2586
                  $path_ndbd_log,
 
2587
                  $path_ndbd_log,
 
2588
                  "",
 
2589
                  { append_log_file => 1 });
 
2590
 
 
2591
  # Add pid to list of pids for this cluster
 
2592
  $cluster->{'ndbds'}->[$idx]->{'pid'}= $pid;
 
2593
 
 
2594
  # Rememeber options used when starting
 
2595
  $cluster->{'ndbds'}->[$idx]->{'start_extra_args'}= $extra_args;
 
2596
  $cluster->{'ndbds'}->[$idx]->{'idx'}= $idx;
 
2597
 
 
2598
  mtr_verbose("ndbd_start, pid: $pid");
 
2599
 
 
2600
  return $pid;
 
2601
}
 
2602
 
 
2603
 
 
2604
sub ndbcluster_start ($$) {
 
2605
  my $cluster= shift;
 
2606
  my $extra_args= shift;
 
2607
 
 
2608
  mtr_verbose("ndbcluster_start '$cluster->{'name'}'");
 
2609
 
 
2610
  if ( $cluster->{'use_running'} )
 
2611
  {
 
2612
    return 0;
 
2613
  }
 
2614
 
 
2615
  if ( $cluster->{'pid'} )
 
2616
  {
 
2617
    mtr_error("Cluster '$cluster->{'name'}' already started");
 
2618
  }
 
2619
 
 
2620
  ndb_mgmd_start($cluster);
 
2621
 
 
2622
  for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ )
 
2623
  {
 
2624
    ndbd_start($cluster, $idx, $extra_args);
 
2625
  }
 
2626
 
 
2627
  return 0;
 
2628
}
 
2629
 
 
2630
 
 
2631
sub rm_ndbcluster_tables ($) {
 
2632
  my $dir=       shift;
 
2633
  foreach my $bin ( glob("$dir/mysql/ndb_apply_status*"),
 
2634
                    glob("$dir/mysql/ndb_schema*"))
 
2635
  {
 
2636
    unlink($bin);
 
2637
  }
 
2638
}
 
2639
 
1831
2640
 
1832
2641
##############################################################################
1833
2642
#
1840
2649
 
1841
2650
  my $args;
1842
2651
 
 
2652
  if ( ! $glob_use_embedded_server )
1843
2653
  {
1844
2654
    mysqld_start($master->[0],[],[]);
1845
2655
    if ( ! $master->[0]->{'pid'} )
1858
2668
    mtr_add_arg($args, "--small-tables");
1859
2669
  }
1860
2670
 
 
2671
  if ( $opt_with_ndbcluster )
 
2672
  {
 
2673
    mtr_add_arg($args, "--create-options=TYPE=ndb");
 
2674
  }
 
2675
 
1861
2676
  chdir($glob_mysql_bench_dir)
1862
2677
    or mtr_error("Couldn't chdir to '$glob_mysql_bench_dir': $!");
1863
2678
 
1879
2694
 
1880
2695
  chdir($glob_mysql_test_dir);          # Go back
1881
2696
 
 
2697
  if ( ! $glob_use_embedded_server )
1882
2698
  {
1883
2699
    stop_masters();
1884
2700
  }
1917
2733
  mtr_print_line();
1918
2734
 
1919
2735
  if ( ! $glob_debugger and
1920
 
       ! $opt_extern )
 
2736
       ! $opt_extern and
 
2737
       ! $glob_use_embedded_server )
1921
2738
  {
1922
2739
    stop_all_servers();
1923
2740
  }
1981
2798
  }
1982
2799
  check_running_as_root();
1983
2800
 
1984
 
  mtr_log_init("$opt_vardir/log/drizzle-test-run.log");
 
2801
  mtr_log_init("$opt_vardir/log/mysql-test-run.log");
1985
2802
 
1986
2803
}
1987
2804
 
1988
2805
sub mysql_install_db () {
1989
2806
 
 
2807
  install_db('master', $master->[0]->{'path_myddir'});
 
2808
 
1990
2809
  if ($max_master_num > 1)
1991
2810
  {
1992
2811
    copy_install_db('master', $master->[1]->{'path_myddir'});
1998
2817
    copy_install_db("slave".($idx+1), $slave->[$idx]->{'path_myddir'});
1999
2818
  }
2000
2819
 
 
2820
  my $cluster_started_ok= 1; # Assume it can be started
 
2821
 
 
2822
  my $cluster= $clusters->[0]; # Master cluster
 
2823
  if ($opt_skip_ndbcluster ||
 
2824
      $cluster->{'use_running'} ||
 
2825
      $cluster->{executable_setup_failed})
 
2826
  {
 
2827
    # Don't install master cluster
 
2828
  }
 
2829
  elsif (ndbcluster_start_install($cluster))
 
2830
  {
 
2831
    mtr_warning("Failed to start install of $cluster->{name}");
 
2832
    $cluster_started_ok= 0;
 
2833
  }
 
2834
 
 
2835
  $cluster= $clusters->[1]; # Slave cluster
 
2836
  if ($max_slave_num == 0 ||
 
2837
      $opt_skip_ndbcluster_slave ||
 
2838
      $cluster->{'use_running'} ||
 
2839
      $cluster->{executable_setup_failed})
 
2840
  {
 
2841
    # Don't install slave cluster
 
2842
  }
 
2843
  elsif (ndbcluster_start_install($cluster))
 
2844
  {
 
2845
    mtr_warning("Failed to start install of $cluster->{name}");
 
2846
    $cluster_started_ok= 0;
 
2847
  }
 
2848
 
 
2849
  foreach $cluster (@{$clusters})
 
2850
  {
 
2851
 
 
2852
    next if !$cluster->{'pid'};
 
2853
 
 
2854
    $cluster->{'installed_ok'}= 1; # Assume install suceeds
 
2855
 
 
2856
    if (ndbcluster_wait_started($cluster, ""))
 
2857
    {
 
2858
      # failed to install, disable usage and flag that its no ok
 
2859
      mtr_report("ndbcluster_install of $cluster->{'name'} failed");
 
2860
      $cluster->{"installed_ok"}= 0;
 
2861
 
 
2862
      $cluster_started_ok= 0;
 
2863
    }
 
2864
  }
 
2865
 
 
2866
  if ( ! $cluster_started_ok )
 
2867
  {
 
2868
    if ( $opt_force)
 
2869
    {
 
2870
      # Continue without cluster
 
2871
    }
 
2872
    else
 
2873
    {
 
2874
      mtr_error("To continue, re-run with '--force'.");
 
2875
    }
 
2876
  }
 
2877
 
2001
2878
  return 0;
2002
2879
}
2003
2880
 
2014
2891
}
2015
2892
 
2016
2893
 
 
2894
sub install_db ($$) {
 
2895
  my $type=      shift;
 
2896
  my $data_dir=  shift;
 
2897
 
 
2898
  mtr_report("Installing \u$type Database");
 
2899
 
 
2900
 
 
2901
  my $args;
 
2902
  mtr_init_args(\$args);
 
2903
  mtr_add_arg($args, "--no-defaults");
 
2904
  mtr_add_arg($args, "--bootstrap");
 
2905
  mtr_add_arg($args, "--basedir=%s", $path_my_basedir);
 
2906
  mtr_add_arg($args, "--datadir=%s", $data_dir);
 
2907
  mtr_add_arg($args, "--loose-skip-innodb");
 
2908
  mtr_add_arg($args, "--tmpdir=.");
 
2909
  mtr_add_arg($args, "--core-file");
 
2910
 
 
2911
  if ( $opt_debug )
 
2912
  {
 
2913
    mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap_%s.trace",
 
2914
                $path_vardir_trace, $type);
 
2915
  }
 
2916
 
 
2917
  if ( ! $glob_netware )
 
2918
  {
 
2919
    mtr_add_arg($args, "--language=%s", $path_language);
 
2920
    mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
 
2921
  }
 
2922
 
 
2923
  # If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
 
2924
  # configure --disable-grant-options), mysqld will not recognize the
 
2925
  # --bootstrap or --skip-grant-tables options.  The user can set
 
2926
  # MYSQLD_BOOTSTRAP to the full path to a mysqld which does accept
 
2927
  # --bootstrap, to accommodate this.
 
2928
  my $exe_mysqld_bootstrap = $ENV{'MYSQLD_BOOTSTRAP'} || $exe_mysqld;
 
2929
 
 
2930
  # ----------------------------------------------------------------------
 
2931
  # export MYSQLD_BOOTSTRAP_CMD variable containing <path>/mysqld <args>
 
2932
  # ----------------------------------------------------------------------
 
2933
  $ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args);
 
2934
 
 
2935
  # ----------------------------------------------------------------------
 
2936
  # Create the bootstrap.sql file
 
2937
  # ----------------------------------------------------------------------
 
2938
  my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql";
 
2939
 
 
2940
  # Use the mysql database for system tables
 
2941
  mtr_tofile($bootstrap_sql_file, "use mysql");
 
2942
 
 
2943
  # Add the offical mysql system tables
 
2944
  # for a production system
 
2945
  mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables.sql",
 
2946
                         $bootstrap_sql_file);
 
2947
 
 
2948
 
 
2949
  # Add test data for timezone - this is just a subset, on a real
 
2950
  # system these tables will be populated either by mysql_tzinfo_to_sql
 
2951
  # or by downloading the timezone table package from our website
 
2952
  mtr_appendfile_to_file("$path_sql_dir/mysql_test_data_timezone.sql",
 
2953
                         $bootstrap_sql_file);
 
2954
 
 
2955
  # Remove anonymous users
 
2956
  mtr_tofile($bootstrap_sql_file,
 
2957
             "DELETE FROM mysql.user where user= '';");
 
2958
 
 
2959
  # Log bootstrap command
 
2960
  my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log";
 
2961
  mtr_tofile($path_bootstrap_log,
 
2962
             "$exe_mysqld_bootstrap " . join(" ", @$args) . "\n");
 
2963
 
 
2964
 
 
2965
  if ( mtr_run($exe_mysqld_bootstrap, $args, $bootstrap_sql_file,
 
2966
               $path_bootstrap_log, $path_bootstrap_log,
 
2967
               "", { append_log_file => 1 }) != 0 )
 
2968
 
 
2969
  {
 
2970
    mtr_error("Error executing mysqld --bootstrap\n" .
 
2971
              "Could not install system database from $bootstrap_sql_file\n" .
 
2972
              "see $path_bootstrap_log for errors");
 
2973
  }
 
2974
}
 
2975
 
 
2976
 
2017
2977
#
2018
2978
# Restore snapshot of the installed slave databases
2019
2979
# if the snapshot exists
2042
3002
  # If marked to skip, just print out and return.
2043
3003
  # Note that a test case not marked as 'skip' can still be
2044
3004
  # skipped later, because of the test case itself in cooperation
2045
 
  # with the drizzletest program tells us so.
 
3005
  # with the mysqltest program tells us so.
2046
3006
  # ----------------------------------------------------------------------
2047
3007
 
2048
3008
  if ( $tinfo->{'skip'} )
2052
3012
    return 1;
2053
3013
  }
2054
3014
 
 
3015
  if ($tinfo->{'ndb_test'})
 
3016
  {
 
3017
    foreach my $cluster (@{$clusters})
 
3018
    {
 
3019
      # Slave cluster is skipped and thus not
 
3020
      # installed, no need to perform checks
 
3021
      last if ($opt_skip_ndbcluster_slave and
 
3022
               $cluster->{'name'} eq 'Slave');
 
3023
 
 
3024
      # Using running cluster - no need
 
3025
      # to check if test should be skipped
 
3026
      # will be done by test itself
 
3027
      last if ($cluster->{'use_running'});
 
3028
 
 
3029
      # If test needs this cluster, check binaries was found ok
 
3030
      if ( $cluster->{'executable_setup_failed'} )
 
3031
      {
 
3032
        mtr_report_test_name($tinfo);
 
3033
        $tinfo->{comment}=
 
3034
          "Failed to find cluster binaries";
 
3035
        mtr_report_test_failed($tinfo);
 
3036
        return 1;
 
3037
      }
 
3038
 
 
3039
      # If test needs this cluster, check it was installed ok
 
3040
      if ( !$cluster->{'installed_ok'} )
 
3041
      {
 
3042
        mtr_report_test_name($tinfo);
 
3043
        $tinfo->{comment}=
 
3044
          "Cluster $cluster->{'name'} was not installed ok";
 
3045
        mtr_report_test_failed($tinfo);
 
3046
        return 1;
 
3047
      }
 
3048
 
 
3049
    }
 
3050
  }
 
3051
 
2055
3052
  return 0;
2056
3053
}
2057
3054
 
2058
3055
 
2059
 
sub do_before_run_drizzletest($)
 
3056
sub do_before_run_mysqltest($)
2060
3057
{
2061
3058
  my $tinfo= shift;
2062
3059
  my $args;
2063
3060
 
2064
 
  # Remove old files produced by drizzletest
 
3061
  # Remove old files produced by mysqltest
2065
3062
  my $base_file= mtr_match_extension($tinfo->{'result_file'},
2066
3063
                                    "result"); # Trim extension
2067
3064
  unlink("$base_file.reject");
2071
3068
 
2072
3069
  if (!$opt_extern)
2073
3070
  {
 
3071
    if ( $mysql_version_id < 50000 ) {
 
3072
      # Set environment variable NDB_STATUS_OK to 1
 
3073
      # if script decided to run mysqltest cluster _is_ installed ok
 
3074
      $ENV{'NDB_STATUS_OK'} = "1";
 
3075
    } elsif ( $mysql_version_id < 50100 ) {
 
3076
      # Set environment variable NDB_STATUS_OK to YES
 
3077
      # if script decided to run mysqltest cluster _is_ installed ok
 
3078
      $ENV{'NDB_STATUS_OK'} = "YES";
 
3079
    }
2074
3080
    if (defined $tinfo->{binlog_format} and  $mysql_version_id > 50100 )
2075
3081
    {
2076
3082
      # Dynamically switch binlog format of
2086
3092
 
2087
3093
        my $sql= "include/set_binlog_format_".$tinfo->{binlog_format}.".sql";
2088
3094
        mtr_verbose("Setting binlog format:", $tinfo->{binlog_format});
2089
 
        if (mtr_run($exe_drizzle, $args, $sql, "", "", "") != 0)
 
3095
        if (mtr_run($exe_mysql, $args, $sql, "", "", "") != 0)
2090
3096
        {
2091
3097
          mtr_error("Failed to switch binlog format");
2092
3098
        }
2095
3101
  }
2096
3102
}
2097
3103
 
2098
 
sub do_after_run_drizzletest($)
 
3104
sub do_after_run_mysqltest($)
2099
3105
{
2100
3106
  my $tinfo= shift;
2101
3107
 
2102
 
  # Save info from this testcase run to drizzletest.log
2103
 
  mtr_appendfile_to_file($path_current_test_log, $path_drizzletest_log)
 
3108
  # Save info from this testcase run to mysqltest.log
 
3109
  mtr_appendfile_to_file($path_current_test_log, $path_mysqltest_log)
2104
3110
    if -f $path_current_test_log;
2105
 
  mtr_appendfile_to_file($path_timefile, $path_drizzletest_log)
 
3111
  mtr_appendfile_to_file($path_timefile, $path_mysqltest_log)
2106
3112
    if -f $path_timefile;
2107
3113
}
2108
3114
 
2122
3128
    mtr_tofile($mysqld->{path_myerr}, $log_msg);
2123
3129
  }
2124
3130
 
 
3131
  # ndbcluster log file
 
3132
  mtr_tofile($path_ndb_testrun_log, $log_msg);
 
3133
 
2125
3134
}
2126
3135
 
2127
3136
sub find_testcase_skipped_reason($)
2131
3140
  # Set default message
2132
3141
  $tinfo->{'comment'}= "Detected by testcase(no log file)";
2133
3142
 
2134
 
  # Open drizzletest-time(the drizzletest log file)
 
3143
  # Open mysqltest-time(the mysqltest log file)
2135
3144
  my $F= IO::File->new($path_timefile)
2136
3145
    or return;
2137
3146
  my $reason;
2210
3219
      return 1;
2211
3220
    }
2212
3221
  }
 
3222
  elsif ($glob_use_embedded_server)
 
3223
  {
 
3224
    run_master_init_script($tinfo);
 
3225
  }
 
3226
 
2213
3227
  # ----------------------------------------------------------------------
2214
3228
  # If --start-and-exit or --start-dirty given, stop here to let user manually
2215
3229
  # run tests
2222
3236
  }
2223
3237
 
2224
3238
  {
2225
 
    do_before_run_drizzletest($tinfo);
 
3239
    do_before_run_mysqltest($tinfo);
2226
3240
 
2227
 
    my $res= run_drizzletest($tinfo);
 
3241
    my $res= run_mysqltest($tinfo);
2228
3242
    mtr_report_test_name($tinfo);
2229
3243
 
2230
 
    do_after_run_drizzletest($tinfo);
 
3244
    do_after_run_mysqltest($tinfo);
2231
3245
 
2232
3246
    if ( $res == 0 )
2233
3247
    {
2237
3251
    {
2238
3252
      # Testcase itself tell us to skip this one
2239
3253
 
2240
 
      # Try to get reason from drizzletest.log
 
3254
      # Try to get reason from mysqltest.log
2241
3255
      find_testcase_skipped_reason($tinfo);
2242
3256
      mtr_report_test_skipped($tinfo);
2243
3257
    }
2248
3262
    }
2249
3263
    elsif ( $res == 1 )
2250
3264
    {
2251
 
      # Test case failure reported by drizzletest
 
3265
      # Test case failure reported by mysqltest
2252
3266
      report_failure_and_restart($tinfo);
2253
3267
    }
2254
3268
    else
2255
3269
    {
2256
 
      # drizzletest failed, probably crashed
 
3270
      # mysqltest failed, probably crashed
2257
3271
      $tinfo->{comment}=
2258
 
        "drizzletest returned unexpected code $res, it has probably crashed";
 
3272
        "mysqltest returned unexpected code $res, it has probably crashed";
2259
3273
      report_failure_and_restart($tinfo);
2260
3274
    }
2261
3275
  }
2262
3276
 
2263
 
  # Remove the file that drizzletest writes info to
 
3277
  # Remove the file that mysqltest writes info to
2264
3278
  unlink($path_timefile);
2265
3279
 
2266
3280
  # ----------------------------------------------------------------------
2326
3340
      mtr_rmtree("$data_dir");
2327
3341
      mtr_copy_dir("$path_snapshot/$name", "$data_dir");
2328
3342
    }
 
3343
 
 
3344
    # Remove the ndb_*_fs dirs for all ndbd nodes
 
3345
    # forcing a clean start of ndb
 
3346
    foreach my $cluster (@{$clusters})
 
3347
    {
 
3348
      foreach my $ndbd (@{$cluster->{'ndbds'}})
 
3349
      {
 
3350
        mtr_rmtree("$ndbd->{'path_fs'}" );
 
3351
      }
 
3352
    }
2329
3353
  }
2330
3354
  else
2331
3355
  {
2354
3378
  mtr_report("Aborting: $tinfo->{'name'} failed in $test_mode mode. ");
2355
3379
  mtr_report("To continue, re-run with '--force'.");
2356
3380
  if ( ! $glob_debugger and
2357
 
       ! $opt_extern )
 
3381
       ! $opt_extern and
 
3382
       ! $glob_use_embedded_server )
2358
3383
  {
2359
3384
    stop_all_servers();
2360
3385
  }
2461
3486
    $sidx= $idx;
2462
3487
  }
2463
3488
 
2464
 
  my $prefix= "";               # If drizzletest server arg
 
3489
  my $prefix= "";               # If mysqltest server arg
 
3490
  if ( $glob_use_embedded_server )
 
3491
  {
 
3492
    $prefix= "--server-arg=";
 
3493
  }
2465
3494
 
2466
3495
  mtr_add_arg($args, "%s--no-defaults", $prefix);
2467
3496
 
2468
3497
  mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir);
2469
 
 
2470
 
  if ($opt_engine)
2471
 
  {
2472
 
    mtr_add_arg($args, "%s--default-storage-engine=%s", $prefix, $opt_engine);
2473
 
  }
 
3498
  mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir);
2474
3499
 
2475
3500
  if ( $mysql_version_id >= 50036)
2476
3501
  {
2478
3503
    mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir);
2479
3504
  }
2480
3505
 
 
3506
  if ( $mysql_version_id >= 50000 )
 
3507
  {
 
3508
    mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
 
3509
  }
 
3510
 
 
3511
  mtr_add_arg($args, "%s--default-character-set=latin1", $prefix);
 
3512
  mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
2481
3513
  mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
2482
3514
 
2483
3515
  # Increase default connect_timeout to avoid intermittent
2489
3521
  # When mysqld is run by a root user(euid is 0), it will fail
2490
3522
  # to start unless we specify what user to run as, see BUG#30630
2491
3523
  my $euid= $>;
2492
 
  if (grep(/^--user/, @$extra_opt, @opt_extra_mysqld_opt) == 0) {
 
3524
  if (!$glob_win32 and $euid == 0 and
 
3525
      grep(/^--user/, @$extra_opt, @opt_extra_mysqld_opt) == 0) {
2493
3526
    mtr_add_arg($args, "%s--user=root", $prefix);
2494
3527
  }
2495
3528
 
2502
3535
  mtr_add_arg($args, "%s--datadir=%s", $prefix,
2503
3536
              $mysqld->{'path_myddir'});
2504
3537
 
 
3538
 
 
3539
  if ( $mysql_version_id >= 50106 )
 
3540
  {
 
3541
    # Turn on logging to bothe tables and file
 
3542
    mtr_add_arg($args, "%s--log-output=table,file", $prefix);
 
3543
  }
 
3544
 
2505
3545
  my $log_base_path= "$opt_vardir/log/$mysqld->{'type'}$sidx";
2506
3546
  mtr_add_arg($args, "%s--log=%s.log", $prefix, $log_base_path);
 
3547
  mtr_add_arg($args,
 
3548
              "%s--log-slow-queries=%s-slow.log", $prefix, $log_base_path);
2507
3549
 
2508
3550
  # Check if "extra_opt" contains --skip-log-bin
2509
3551
  my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt, @opt_extra_mysqld_opt);
2527
3569
    {
2528
3570
      mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
2529
3571
    }
 
3572
 
 
3573
    my $cluster= $clusters->[$mysqld->{'cluster'}];
 
3574
    if ( $cluster->{'pid'} ||           # Cluster is started
 
3575
         $cluster->{'use_running'} )    # Using running cluster
 
3576
    {
 
3577
      mtr_add_arg($args, "%s--ndbcluster", $prefix);
 
3578
      mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
 
3579
                  $cluster->{'connect_string'});
 
3580
      mtr_add_arg($args, "%s--ndb-wait-connected=20", $prefix);
 
3581
      mtr_add_arg($args, "%s--ndb-cluster-connection-pool=3", $prefix);
 
3582
      mtr_add_arg($args, "%s--slave-allow-batching", $prefix);
 
3583
      if ( $mysql_version_id >= 50100 )
 
3584
      {
 
3585
        mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
 
3586
        mtr_add_arg($args, "%s--ndb-log-orig", $prefix);
 
3587
      }
 
3588
    }
 
3589
    else
 
3590
    {
 
3591
      mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
 
3592
    }
2530
3593
  }
2531
3594
  else
2532
3595
  {
2574
3637
      mtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id);
2575
3638
#      mtr_add_arg($args, "%s--rpl-recovery-rank=%d", $prefix, $slave_rpl_rank);
2576
3639
    }
 
3640
 
 
3641
   my $cluster= $clusters->[$mysqld->{'cluster'}];
 
3642
   if ( $cluster->{'pid'} ||         # Slave cluster is started
 
3643
        $cluster->{'use_running'} )  # Using running slave cluster
 
3644
    {
 
3645
      mtr_add_arg($args, "%s--ndbcluster", $prefix);
 
3646
      mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
 
3647
                  $cluster->{'connect_string'});
 
3648
      mtr_add_arg($args, "%s--ndb-wait-connected=20", $prefix);
 
3649
      mtr_add_arg($args, "%s--ndb-cluster-connection-pool=3", $prefix);
 
3650
      mtr_add_arg($args, "%s--slave-allow-batching", $prefix);
 
3651
      if ( $mysql_version_id >= 50100 )
 
3652
      {
 
3653
        mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
 
3654
        mtr_add_arg($args, "%s--ndb-log-orig", $prefix);
 
3655
      }
 
3656
    }
 
3657
    else
 
3658
    {
 
3659
      mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
 
3660
    }
2577
3661
  } # end slave
2578
3662
 
2579
3663
  if ( $opt_debug )
2586
3670
  mtr_add_arg($args, "%s--sort_buffer=256K", $prefix);
2587
3671
  mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix);
2588
3672
 
 
3673
  if ( $opt_ssl_supported )
 
3674
  {
 
3675
    mtr_add_arg($args, "%s--ssl-ca=%s/std_data/cacert.pem", $prefix,
 
3676
                $glob_mysql_test_dir);
 
3677
    mtr_add_arg($args, "%s--ssl-cert=%s/std_data/server-cert.pem", $prefix,
 
3678
                $glob_mysql_test_dir);
 
3679
    mtr_add_arg($args, "%s--ssl-key=%s/std_data/server-key.pem", $prefix,
 
3680
                $glob_mysql_test_dir);
 
3681
  }
 
3682
 
2589
3683
  if ( $opt_warnings )
2590
3684
  {
2591
3685
    mtr_add_arg($args, "%s--log-warnings", $prefix);
2652
3746
  my $type= $mysqld->{'type'};
2653
3747
  my $idx= $mysqld->{'idx'};
2654
3748
 
 
3749
  mtr_error("Internal error: mysqld should never be started for embedded")
 
3750
    if $glob_use_embedded_server;
 
3751
 
2655
3752
  if ( $type eq 'master' )
2656
3753
  {
2657
3754
    $exe= $exe_master_mysqld;
2766
3863
    }
2767
3864
  }
2768
3865
 
 
3866
  # Start shutdown of clusters
 
3867
  foreach my $cluster (@{$clusters})
 
3868
  {
 
3869
    if ( $cluster->{'pid'} )
 
3870
    {
 
3871
      $pid= mtr_ndbmgm_start($cluster, "shutdown");
 
3872
      $admin_pids{$pid}= 1;
 
3873
 
 
3874
      push(@kill_pids,{
 
3875
                       pid      => $cluster->{'pid'},
 
3876
                       pidfile  => $cluster->{'path_pid'}
 
3877
                      });
 
3878
 
 
3879
      $cluster->{'pid'}= 0; # Assume we are done with it
 
3880
 
 
3881
      foreach my $ndbd (@{$cluster->{'ndbds'}})
 
3882
      {
 
3883
        if ( $ndbd->{'pid'} )
 
3884
        {
 
3885
          push(@kill_pids,{
 
3886
                           pid      => $ndbd->{'pid'},
 
3887
                           pidfile  => $ndbd->{'path_pid'},
 
3888
                          });
 
3889
          $ndbd->{'pid'}= 0;
 
3890
        }
 
3891
      }
 
3892
    }
 
3893
  }
 
3894
 
2769
3895
  # Wait blocking until all shutdown processes has completed
2770
3896
  mtr_wait_blocking(\%admin_pids);
2771
3897
 
2772
3898
  # Make sure that process has shutdown else try to kill them
2773
3899
  mtr_check_stop_servers(\@kill_pids);
 
3900
 
 
3901
  foreach my $mysqld (@{$master}, @{$slave})
 
3902
  {
 
3903
    rm_ndbcluster_tables($mysqld->{'path_myddir'});
 
3904
  }
2774
3905
}
2775
3906
 
2776
3907
 
2781
3912
  # We try to find out if we are to restart the master(s)
2782
3913
  my $do_restart= 0;          # Assumes we don't have to
2783
3914
 
2784
 
  if ( $tinfo->{'master_sh'} )
 
3915
  if ( $glob_use_embedded_server )
 
3916
  {
 
3917
    mtr_verbose("Never start or restart for embedded server");
 
3918
    return $do_restart;
 
3919
  }
 
3920
  elsif ( $tinfo->{'master_sh'} )
2785
3921
  {
2786
3922
    $do_restart= 1;           # Always restart if script to run
2787
3923
    mtr_verbose("Restart master: Always restart if script to run");
2791
3927
    $do_restart= 1; # Always restart if --force-restart in -opt file
2792
3928
    mtr_verbose("Restart master: Restart forced with --force-restart");
2793
3929
  }
 
3930
  elsif ( ! $opt_skip_ndbcluster and
 
3931
          !$tinfo->{'ndb_test'} and
 
3932
          $clusters->[0]->{'pid'} != 0 )
 
3933
  {
 
3934
    $do_restart= 1;           # Restart without cluster
 
3935
    mtr_verbose("Restart master: Test does not need cluster");
 
3936
  }
 
3937
  elsif ( ! $opt_skip_ndbcluster and
 
3938
          $tinfo->{'ndb_test'} and
 
3939
          $clusters->[0]->{'pid'} == 0 )
 
3940
  {
 
3941
    $do_restart= 1;           # Restart with cluster
 
3942
    mtr_verbose("Restart master: Test need cluster");
 
3943
  }
2794
3944
  elsif( $tinfo->{'component_id'} eq 'im' )
2795
3945
  {
2796
3946
    $do_restart= 1;
2845
3995
  # We try to find out if we are to restart the slaves
2846
3996
  my $do_slave_restart= 0;     # Assumes we don't have to
2847
3997
 
2848
 
  if ( $max_slave_num == 0)
 
3998
  if ( $glob_use_embedded_server )
 
3999
  {
 
4000
    mtr_verbose("Never start or restart for embedded server");
 
4001
    return $do_slave_restart;
 
4002
  }
 
4003
  elsif ( $max_slave_num == 0)
2849
4004
  {
2850
4005
    mtr_verbose("Skip slave restart: No testcase use slaves");
2851
4006
  }
2924
4079
        $mysqld->{'pid'}= 0; # Assume we are done with it
2925
4080
      }
2926
4081
    }
 
4082
 
 
4083
    # Start shutdown of master cluster
 
4084
    my $cluster= $clusters->[0];
 
4085
    if ( $cluster->{'pid'} )
 
4086
    {
 
4087
      $pid= mtr_ndbmgm_start($cluster, "shutdown");
 
4088
      $admin_pids{$pid}= 1;
 
4089
 
 
4090
      push(@kill_pids,{
 
4091
                       pid      => $cluster->{'pid'},
 
4092
                       pidfile  => $cluster->{'path_pid'}
 
4093
                      });
 
4094
 
 
4095
      $cluster->{'pid'}= 0; # Assume we are done with it
 
4096
 
 
4097
      foreach my $ndbd (@{$cluster->{'ndbds'}})
 
4098
      {
 
4099
        push(@kill_pids,{
 
4100
                         pid      => $ndbd->{'pid'},
 
4101
                         pidfile  => $ndbd->{'path_pid'},
 
4102
                        });
 
4103
        $ndbd->{'pid'}= 0; # Assume we are done with it
 
4104
      }
 
4105
    }
2927
4106
  }
2928
4107
 
2929
4108
  if ( $do_restart || $do_slave_restart )
2953
4132
        $mysqld->{'pid'}= 0; # Assume we are done with it
2954
4133
      }
2955
4134
    }
 
4135
 
 
4136
    # Start shutdown of slave cluster
 
4137
    my $cluster= $clusters->[1];
 
4138
    if ( $cluster->{'pid'} )
 
4139
    {
 
4140
      $pid= mtr_ndbmgm_start($cluster, "shutdown");
 
4141
 
 
4142
      $admin_pids{$pid}= 1;
 
4143
 
 
4144
      push(@kill_pids,{
 
4145
                       pid      => $cluster->{'pid'},
 
4146
                       pidfile  => $cluster->{'path_pid'}
 
4147
                      });
 
4148
 
 
4149
      $cluster->{'pid'}= 0; # Assume we are done with it
 
4150
 
 
4151
      foreach my $ndbd (@{$cluster->{'ndbds'}} )
 
4152
      {
 
4153
        push(@kill_pids,{
 
4154
                         pid      => $ndbd->{'pid'},
 
4155
                         pidfile  => $ndbd->{'path_pid'},
 
4156
                        });
 
4157
        $ndbd->{'pid'}= 0; # Assume we are done with it
 
4158
      }
 
4159
    }
2956
4160
  }
2957
4161
 
2958
4162
  # ----------------------------------------------------------------------
2966
4170
 
2967
4171
  # Make sure that process has shutdown else try to kill them
2968
4172
  mtr_check_stop_servers(\@kill_pids);
 
4173
 
 
4174
  foreach my $mysqld (@{$master}, @{$slave})
 
4175
  {
 
4176
    if ( ! $mysqld->{'pid'} )
 
4177
    {
 
4178
      # Remove ndbcluster tables if server is stopped
 
4179
      rm_ndbcluster_tables($mysqld->{'path_myddir'});
 
4180
    }
 
4181
  }
2969
4182
}
2970
4183
 
2971
4184
 
2985
4198
 
2986
4199
  if ( $tinfo->{'component_id'} eq 'mysqld' )
2987
4200
  {
 
4201
    if ( ! $opt_skip_ndbcluster and
 
4202
         !$clusters->[0]->{'pid'} and
 
4203
         $tinfo->{'ndb_test'} )
 
4204
    {
 
4205
      # Test need cluster, cluster is not started, start it
 
4206
      ndbcluster_start($clusters->[0], "");
 
4207
    }
 
4208
 
2988
4209
    if ( !$master->[0]->{'pid'} )
2989
4210
    {
2990
4211
      # Master mysqld is not started
2994
4215
 
2995
4216
    }
2996
4217
 
 
4218
    if ( $clusters->[0]->{'pid'} || $clusters->[0]->{'use_running'}
 
4219
         and ! $master->[1]->{'pid'} and
 
4220
         $tinfo->{'master_num'} > 1 )
 
4221
    {
 
4222
      # Test needs cluster, start an extra mysqld connected to cluster
 
4223
 
 
4224
      if ( $mysql_version_id >= 50100 )
 
4225
      {
 
4226
        # First wait for first mysql server to have created ndb system
 
4227
        # tables ok FIXME This is a workaround so that only one mysqld
 
4228
        # create the tables
 
4229
        if ( ! sleep_until_file_created(
 
4230
                  "$master->[0]->{'path_myddir'}/mysql/ndb_apply_status.ndb",
 
4231
                                        $master->[0]->{'start_timeout'},
 
4232
                                        $master->[0]->{'pid'}))
 
4233
        {
 
4234
 
 
4235
          $tinfo->{'comment'}= "Failed to create 'mysql/ndb_apply_status' table";
 
4236
          return 1;
 
4237
        }
 
4238
      }
 
4239
      mysqld_start($master->[1],$tinfo->{'master_opt'},[]);
 
4240
    }
 
4241
 
2997
4242
    # Save this test case information, so next can examine it
2998
4243
    $master->[0]->{'running_master_options'}= $tinfo;
2999
4244
  }
3007
4252
 
3008
4253
    do_before_start_slave($tinfo);
3009
4254
 
 
4255
    if ( ! $opt_skip_ndbcluster_slave and
 
4256
         !$clusters->[1]->{'pid'} and
 
4257
         $tinfo->{'ndb_test'} )
 
4258
    {
 
4259
      # Test need slave cluster, cluster is not started, start it
 
4260
      ndbcluster_start($clusters->[1], "");
 
4261
    }
 
4262
 
3010
4263
    for ( my $idx= 0; $idx <  $tinfo->{'slave_num'}; $idx++ )
3011
4264
    {
3012
4265
      if ( ! $slave->[$idx]->{'pid'} )
3021
4274
    $slave->[0]->{'running_slave_options'}= $tinfo;
3022
4275
  }
3023
4276
 
 
4277
  # Wait for clusters to start
 
4278
  foreach my $cluster (@{$clusters})
 
4279
  {
 
4280
 
 
4281
    next if !$cluster->{'pid'};
 
4282
 
 
4283
    if (ndbcluster_wait_started($cluster, ""))
 
4284
    {
 
4285
      # failed to start
 
4286
      $tinfo->{'comment'}= "Start of $cluster->{'name'} cluster failed";
 
4287
      return 1;
 
4288
    }
 
4289
  }
 
4290
 
3024
4291
  # Wait for mysqld's to start
3025
4292
  foreach my $mysqld (@{$master},@{$slave})
3026
4293
  {
3060
4327
  mtr_add_arg($args, "--no-defaults");
3061
4328
  mtr_add_arg($args, "--silent");
3062
4329
  mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
 
4330
  mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
3063
4331
 
3064
4332
  mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
3065
4333
  mtr_add_arg($args, "--database=test");
3074
4342
    mtr_add_arg($args, "--record");
3075
4343
  }
3076
4344
 
3077
 
  my $res = mtr_run_test($exe_drizzletest,$args,
 
4345
  my $res = mtr_run_test($exe_mysqltest,$args,
3078
4346
                "include/check-testcase.test", "", "", "");
3079
4347
 
3080
4348
  if ( $res == 1  and $mode eq "after")
3100
4368
sub run_report_features () {
3101
4369
  my $args;
3102
4370
 
 
4371
  if ( ! $glob_use_embedded_server )
3103
4372
  {
3104
4373
    mysqld_start($master->[0],[],[]);
3105
4374
    if ( ! $master->[0]->{'pid'} )
3120
4389
  $tinfo->{'slave_opt'} = [];
3121
4390
  $tinfo->{'slave_mi'} = [];
3122
4391
  $tinfo->{'comment'} = 'report server features';
3123
 
  run_drizzletest($tinfo);
 
4392
  run_mysqltest($tinfo);
3124
4393
 
 
4394
  if ( ! $glob_use_embedded_server )
3125
4395
  {
3126
4396
    stop_all_servers();
3127
4397
  }
3128
4398
}
3129
4399
 
3130
4400
 
3131
 
sub run_drizzletest ($) {
 
4401
sub run_mysqltest ($) {
3132
4402
  my ($tinfo)= @_;
3133
 
  my $exe= $exe_drizzletest;
 
4403
  my $exe= $exe_mysqltest;
3134
4404
  my $args;
3135
4405
 
3136
4406
  mtr_init_args(\$args);
3138
4408
  mtr_add_arg($args, "--no-defaults");
3139
4409
  mtr_add_arg($args, "--silent");
3140
4410
  mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
 
4411
  mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
3141
4412
  mtr_add_arg($args, "--logdir=%s/log", $opt_vardir);
3142
4413
 
3143
4414
  # Log line number and time  for each line in .test file
3151
4422
    mtr_add_arg($args, "--password=");
3152
4423
  }
3153
4424
 
 
4425
  if ( $opt_ps_protocol )
 
4426
  {
 
4427
    mtr_add_arg($args, "--ps-protocol");
 
4428
  }
 
4429
 
 
4430
  if ( $opt_sp_protocol )
 
4431
  {
 
4432
    mtr_add_arg($args, "--sp-protocol");
 
4433
  }
 
4434
 
 
4435
  if ( $opt_view_protocol )
 
4436
  {
 
4437
    mtr_add_arg($args, "--view-protocol");
 
4438
  }
 
4439
 
 
4440
  if ( $opt_cursor_protocol )
 
4441
  {
 
4442
    mtr_add_arg($args, "--cursor-protocol");
 
4443
  }
 
4444
 
3154
4445
  if ( $opt_strace_client )
3155
4446
  {
3156
4447
    $exe=  "strace";            # FIXME there are ktrace, ....
3157
4448
    mtr_add_arg($args, "-o");
3158
 
    mtr_add_arg($args, "%s/log/drizzletest.strace", $opt_vardir);
3159
 
    mtr_add_arg($args, "$exe_drizzletest");
 
4449
    mtr_add_arg($args, "%s/log/mysqltest.strace", $opt_vardir);
 
4450
    mtr_add_arg($args, "$exe_mysqltest");
3160
4451
  }
3161
4452
 
3162
4453
  if ( $opt_timer )
3176
4467
 
3177
4468
  if ( $opt_debug )
3178
4469
  {
3179
 
    mtr_add_arg($args, "--debug=d:t:A,%s/log/drizzletest.trace",
 
4470
    mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace",
3180
4471
                $path_vardir_trace);
3181
4472
  }
3182
4473
 
3183
 
  # ----------------------------------------------------------------------
3184
 
  # export DRIZZLE_TEST variable containing <path>/drizzletest <args>
3185
 
  # ----------------------------------------------------------------------
3186
 
  $ENV{'DRIZZLE_TEST'}=
3187
 
    mtr_native_path($exe_drizzletest) . " " . join(" ", @$args);
3188
 
 
3189
 
  # ----------------------------------------------------------------------
3190
 
  # Add arguments that should not go into the DRIZZLE_TEST env var
3191
 
  # ----------------------------------------------------------------------
3192
 
 
3193
 
  if ( $opt_valgrind_drizzletest )
 
4474
  if ( $opt_ssl_supported )
 
4475
  {
 
4476
    mtr_add_arg($args, "--ssl-ca=%s/std_data/cacert.pem",
 
4477
                $glob_mysql_test_dir);
 
4478
    mtr_add_arg($args, "--ssl-cert=%s/std_data/client-cert.pem",
 
4479
                $glob_mysql_test_dir);
 
4480
    mtr_add_arg($args, "--ssl-key=%s/std_data/client-key.pem",
 
4481
                $glob_mysql_test_dir);
 
4482
  }
 
4483
 
 
4484
  if ( $opt_ssl )
 
4485
  {
 
4486
    # Turn on SSL for _all_ test cases if option --ssl was used
 
4487
    mtr_add_arg($args, "--ssl");
 
4488
  }
 
4489
  elsif ( $opt_ssl_supported )
 
4490
  {
 
4491
    mtr_add_arg($args, "--skip-ssl");
 
4492
  }
 
4493
 
 
4494
  # ----------------------------------------------------------------------
 
4495
  # If embedded server, we create server args to give mysqltest to pass on
 
4496
  # ----------------------------------------------------------------------
 
4497
 
 
4498
  if ( $glob_use_embedded_server )
 
4499
  {
 
4500
    mysqld_arguments($args,$master->[0],$tinfo->{'master_opt'},[]);
 
4501
  }
 
4502
 
 
4503
  # ----------------------------------------------------------------------
 
4504
  # export MYSQL_TEST variable containing <path>/mysqltest <args>
 
4505
  # ----------------------------------------------------------------------
 
4506
  $ENV{'MYSQL_TEST'}=
 
4507
    mtr_native_path($exe_mysqltest) . " " . join(" ", @$args);
 
4508
 
 
4509
  # ----------------------------------------------------------------------
 
4510
  # Add arguments that should not go into the MYSQL_TEST env var
 
4511
  # ----------------------------------------------------------------------
 
4512
 
 
4513
  if ( $opt_valgrind_mysqltest )
3194
4514
  {
3195
4515
    # Prefix the Valgrind options to the argument list.
3196
4516
    # We do this here, since we do not want to Valgrind the nested invocations
3197
 
    # of drizzletest; that would mess up the stderr output causing test failure.
 
4517
    # of mysqltest; that would mess up the stderr output causing test failure.
3198
4518
    my @args_saved = @$args;
3199
4519
    mtr_init_args(\$args);
3200
4520
    valgrind_arguments($args, \$exe);
3406
4726
    $$exe= $debugger;
3407
4727
 
3408
4728
  }
 
4729
  elsif ( $debugger =~ /windbg/ )
 
4730
  {
 
4731
    # windbg exe arg1 .. argn
 
4732
 
 
4733
    # Add name of the exe before args
 
4734
    unshift(@$$args, "$$exe");
 
4735
 
 
4736
    # Set exe to debuggername
 
4737
    $$exe= $debugger;
 
4738
 
 
4739
  }
3409
4740
  elsif ( $debugger eq "dbx" )
3410
4741
  {
3411
4742
    # xterm -e dbx -r exe arg1 .. argn
3464
4795
}
3465
4796
 
3466
4797
 
3467
 
sub mysqld_wait_started($){
3468
 
  my $mysqld= shift;
3469
 
 
3470
 
  if (sleep_until_file_created($mysqld->{'path_pid'},
3471
 
            $mysqld->{'start_timeout'},
3472
 
            $mysqld->{'pid'}) == 0)
3473
 
  {
3474
 
    # Failed to wait for pid file
3475
 
    return 1;
3476
 
  }
3477
 
 
3478
 
  # Get the "real pid" of the process, it will be used for killing
3479
 
  # the process in ActiveState's perl on windows
3480
 
  $mysqld->{'real_pid'}= mtr_get_pid_from_file($mysqld->{'path_pid'});
3481
 
 
3482
 
  return 0;
3483
 
}
3484
 
 
3485
 
 
3486
4798
##############################################################################
3487
4799
#
3488
4800
#  Usage
3503
4815
 
3504
4816
Options to control what engine/variation to run
3505
4817
 
 
4818
  embedded-server       Use the embedded server, i.e. no mysqld daemons
 
4819
  ps-protocol           Use the binary protocol between client and server
 
4820
  cursor-protocol       Use the cursor protocol between client and server
 
4821
                        (implies --ps-protocol)
 
4822
  view-protocol         Create a view to execute all non updating queries
 
4823
  sp-protocol           Create a stored procedure to execute all queries
3506
4824
  compress              Use the compressed protocol between client and server
 
4825
  ssl                   Use ssl protocol between client and server
 
4826
  skip-ssl              Dont start server with support for ssl connections
3507
4827
  bench                 Run the benchmark suite
3508
4828
  small-bench           Run the benchmarks with --small-tests --small-tables
 
4829
  ndb|with-ndbcluster   Use cluster as default table type
 
4830
  vs-config             Visual Studio configuration used to create executables
 
4831
                        (default: MTR_VS_CONFIG environment variable)
3509
4832
 
3510
4833
Options to control directories to use
3511
4834
  benchdir=DIR          The directory where the benchmark suite is stored
3525
4848
Options to control what test suites or cases to run
3526
4849
 
3527
4850
  force                 Continue to run the suite after failure
 
4851
  with-ndbcluster-only  Run only tests that include "ndb" in the filename
 
4852
  skip-ndb[cluster]     Skip all tests that need cluster
 
4853
  skip-ndb[cluster]-slave Skip all tests that need a slave cluster
 
4854
  ndb-extra             Run extra tests from ndb directory
3528
4855
  do-test=PREFIX or REGEX
3529
4856
                        Run test cases which name are prefixed with PREFIX
3530
4857
                        or fulfills REGEX
3546
4873
 
3547
4874
  master_port=PORT      Specify the port number used by the first master
3548
4875
  slave_port=PORT       Specify the port number used by the first slave
 
4876
  ndbcluster-port=PORT  Specify the port number used by cluster
 
4877
  ndbcluster-port-slave=PORT  Specify the port number used by slave cluster
3549
4878
  mtr-build-thread=#    Specify unique collection of ports. Can also be set by
3550
4879
                        setting the environment variable MTR_BUILD_THREAD.
3551
4880
 
3562
4891
Options to run test on running server
3563
4892
 
3564
4893
  extern                Use running server for tests
 
4894
  ndb-connectstring=STR Use running cluster, and connect using STR
 
4895
  ndb-connectstring-slave=STR Use running slave cluster, and connect using STR
3565
4896
  user=USER             User for connection to extern server
 
4897
  socket=PATH           Socket for connection to extern server
3566
4898
 
3567
4899
Options for debugging the product
3568
4900
 
3569
 
  client-ddd            Start drizzletest client in ddd
3570
 
  client-debugger=NAME  Start drizzletest in the selected debugger
3571
 
  client-gdb            Start drizzletest client in gdb
 
4901
  client-ddd            Start mysqltest client in ddd
 
4902
  client-debugger=NAME  Start mysqltest in the selected debugger
 
4903
  client-gdb            Start mysqltest client in gdb
3572
4904
  ddd                   Start mysqld in ddd
3573
4905
  debug                 Dump trace output for all servers and client programs
3574
4906
  debugger=NAME         Start mysqld in the selected debugger
3581
4913
                        test(s)
3582
4914
  master-binary=PATH    Specify the master "mysqld" to use
3583
4915
  slave-binary=PATH     Specify the slave "mysqld" to use
3584
 
  strace-client         Create strace output for drizzletest client
 
4916
  strace-client         Create strace output for mysqltest client
3585
4917
  max-save-core         Limit the number of core files saved (to avoid filling
3586
4918
                        up disks for heavily crashing server). Defaults to
3587
4919
                        $opt_max_save_core, set to 0 for no limit.
3589
4921
Options for coverage, profiling etc
3590
4922
 
3591
4923
  gcov                  FIXME
3592
 
  gprof                 See online documentation on how to use it.
3593
 
  valgrind              Run the "drizzletest" and "mysqld" executables using
 
4924
  gprof                 FIXME
 
4925
  valgrind              Run the "mysqltest" and "mysqld" executables using
3594
4926
                        valgrind with default options
3595
4927
  valgrind-all          Synonym for --valgrind
3596
 
  valgrind-drizzletest    Run the "drizzletest" and "drizzle_client_test" executable
 
4928
  valgrind-mysqltest    Run the "mysqltest" and "mysql_client_test" executable
3597
4929
                        with valgrind
3598
4930
  valgrind-mysqld       Run the "mysqld" executable with valgrind
3599
4931
  valgrind-options=ARGS Deprecated, use --valgrind-option
3620
4952
  suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout)
3621
4953
  warnings | log-warnings Pass --log-warnings to mysqld
3622
4954
 
3623
 
  sleep=SECONDS         Passed to drizzletest, will be used as fixed sleep time
 
4955
  sleep=SECONDS         Passed to mysqltest, will be used as fixed sleep time
 
4956
 
 
4957
Deprecated options
 
4958
  with-openssl          Deprecated option for ssl
 
4959
 
3624
4960
 
3625
4961
HERE
3626
4962
  mtr_exit(1);