~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/test-run.pl

  • Committer: Monty Taylor
  • Date: 2009-04-14 19:16:51 UTC
  • mto: (997.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 994.
  • Revision ID: mordred@inaugust.com-20090414191651-ltbww6hpqks8k7qk
Clarified instructions in README.

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
##############################################################################
99
99
 
100
100
# Misc global variables
101
 
our $drizzle_version_id;
102
 
our $glob_suite_path=             undef;
 
101
our $mysql_version_id;
103
102
our $glob_mysql_test_dir=         undef;
104
103
our $glob_mysql_bench_dir=        undef;
105
104
our $glob_scriptname=             undef;
120
119
our $opt_vardir;                 # A path but set directly on cmd line
121
120
our $path_vardir_trace;          # unix formatted opt_vardir for trace files
122
121
our $opt_tmpdir;                 # A path but set directly on cmd line
123
 
our $opt_suitepath;
124
122
our $opt_testdir;
125
123
 
126
 
our $opt_subunit;
127
124
 
128
125
our $default_vardir;
129
126
 
130
127
our $opt_usage;
131
128
our $opt_suites;
132
 
our $opt_suites_default= "main,jp"; # Default suites to run
 
129
our $opt_suites_default= "main"; # Default suites to run
133
130
our $opt_script_debug= 0;  # Script debugging, enable with --script-debug
134
131
our $opt_verbose= 0;  # Verbose output, enable with --verbose
135
132
 
140
137
our $exe_drizzle_client_test;
141
138
our $exe_bug25714;
142
139
our $exe_drizzled;
 
140
our $exe_drizzlecheck;
143
141
our $exe_drizzledump;
144
142
our $exe_drizzleslap;
145
143
our $exe_drizzleimport;
151
149
our $lib_udf_example;
152
150
our $lib_example_plugin;
153
151
our $exe_libtool;
154
 
our $exe_schemawriter;
155
152
 
156
153
our $opt_bench= 0;
157
154
our $opt_small_bench= 0;
 
155
our $opt_big_test= 0;
158
156
 
159
157
our @opt_combinations;
160
158
our $opt_skip_combination;
183
181
 
184
182
our $glob_debugger= 0;
185
183
our $opt_gdb;
186
 
our $opt_dbx;
187
184
our $opt_client_gdb;
188
 
our $opt_client_dbx;
189
 
our $opt_dbx_gdb;
190
185
our $opt_ddd;
191
186
our $opt_client_ddd;
192
187
our $opt_manual_gdb;
193
 
our $opt_manual_dbx;
194
188
our $opt_manual_ddd;
195
189
our $opt_manual_debug;
196
190
# Magic number -69.4 results in traditional test ports starting from 9306.
209
203
 
210
204
our $opt_master_myport;
211
205
our $opt_slave_myport;
212
 
our $opt_memc_myport;
213
206
our $opt_record;
214
207
my $opt_report_features;
215
208
our $opt_check_testcases;
245
238
my @valgrind_args;
246
239
my $opt_valgrind_path;
247
240
my $opt_callgrind;
248
 
my $opt_massif;
249
241
 
250
242
our $opt_stress=               "";
251
243
our $opt_stress_suite=     "main";
272
264
 
273
265
our $opt_max_save_core= 5;
274
266
my $num_saved_cores= 0;  # Number of core files saved in vardir/log/ so far.
275
 
our $secondary_port_offset= 50;
276
267
 
277
268
######################################################################
278
269
#
479
470
             'suite|suites=s'           => \$opt_suites,
480
471
             'skip-rpl'                 => \$opt_skip_rpl,
481
472
             'skip-test=s'              => \$opt_skip_test,
 
473
             'big-test'                 => \$opt_big_test,
482
474
             'combination=s'            => \@opt_combinations,
483
475
             'skip-combination'         => \$opt_skip_combination,
484
476
 
485
477
             # Specify ports
486
478
             'master_port=i'            => \$opt_master_myport,
487
479
             'slave_port=i'             => \$opt_slave_myport,
488
 
             'memc_port=i'              => \$opt_memc_myport,
489
480
             'mtr-build-thread=i'       => \$opt_mtr_build_thread,
490
481
 
491
482
             # Test case authoring
500
491
             # Run test on running server
501
492
             'extern'                   => \$opt_extern,
502
493
 
503
 
             # Output format
504
 
             'subunit'                  => \$opt_subunit,
505
 
 
506
494
             # Debugging
507
495
             'gdb'                      => \$opt_gdb,
508
 
             'dbx'                      => \$opt_dbx,
509
496
             'client-gdb'               => \$opt_client_gdb,
510
 
             'client-dbx'               => \$opt_client_dbx,
511
497
             'manual-gdb'               => \$opt_manual_gdb,
512
 
             'manual-dbx'               => \$opt_manual_dbx,
513
498
             'manual-debug'             => \$opt_manual_debug,
514
499
             'ddd'                      => \$opt_ddd,
515
500
             'client-ddd'               => \$opt_client_ddd,
541
526
             'valgrind-option=s'        => \@valgrind_args,
542
527
             'valgrind-path=s'          => \$opt_valgrind_path,
543
528
             'callgrind'                => \$opt_callgrind,
544
 
             'massif'                   => \$opt_massif,
545
529
 
546
530
             # Stress testing 
547
531
             'stress'                   => \$opt_stress,
557
541
             # Directories
558
542
             'tmpdir=s'                 => \$opt_tmpdir,
559
543
             'vardir=s'                 => \$opt_vardir,
560
 
             'suitepath=s'              => \$opt_suitepath,
561
 
             'testdir=s'                => \$opt_testdir,
 
544
             'testdir=s'                => \$opt_testdir,
562
545
             'benchdir=s'               => \$glob_mysql_bench_dir,
563
546
             'mem'                      => \$opt_mem,
564
547
 
590
573
 
591
574
  usage("") if $opt_usage;
592
575
 
593
 
  usage("you cannot specify --gdb and --dbx both!") if 
594
 
        ($opt_gdb && $opt_dbx) ||
595
 
        ($opt_manual_gdb && $opt_manual_dbx);
596
 
 
597
576
  $glob_scriptname=  basename($0);
598
577
 
599
578
  if ($opt_mtr_build_thread != 0)
621
600
  }
622
601
  $default_vardir= "$glob_mysql_test_dir/var";
623
602
 
624
 
  if ( ! $opt_suitepath )
625
 
  {
626
 
    $glob_suite_path= "$glob_mysql_test_dir/../plugin";
627
 
  }
628
 
  else
629
 
  {
630
 
    $glob_suite_path= $opt_suitepath;
631
 
  }
632
603
  # In most cases, the base directory we find everything relative to,
633
604
  # is the parent directory of the "mysql-test" directory. For source
634
605
  # distributions, TAR binary distributions and some other packages.
810
781
  }
811
782
 
812
783
  # --------------------------------------------------------------------------
 
784
  # Big test flags
 
785
  # --------------------------------------------------------------------------
 
786
   if ( $opt_big_test )
 
787
   {
 
788
     $ENV{'BIG_TEST'}= 1;
 
789
   }
 
790
 
 
791
  # --------------------------------------------------------------------------
813
792
  # Gcov flag
814
793
  # --------------------------------------------------------------------------
815
794
  if ( $opt_gcov and ! $source_dist )
822
801
  # --------------------------------------------------------------------------
823
802
  if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
824
803
       $opt_manual_gdb || $opt_manual_ddd || $opt_manual_debug ||
825
 
       $opt_debugger || $opt_client_debugger || $opt_gdb || $opt_manual_gdb)
 
804
       $opt_debugger || $opt_client_debugger )
826
805
  {
827
806
    # Indicate that we are using debugger
828
807
    $glob_debugger= 1;
870
849
      unless @valgrind_args;
871
850
  }
872
851
 
873
 
  if ( $opt_massif )
874
 
  {
875
 
    mtr_report("Valgrind with Massif tool for drizzled(s)");
876
 
    $opt_valgrind= 1;
877
 
    $opt_valgrind_mysqld= 1;
878
 
  }
879
 
 
880
852
  if ( $opt_valgrind )
881
853
  {
882
854
    # Set valgrind_options to default unless already defined
924
896
 
925
897
  $master->[0]=
926
898
  {
927
 
   pid            => 0,
928
 
   type           => "master",
929
 
   idx            => 0,
930
 
   path_myddir    => "$opt_vardir/master-data",
931
 
   path_myerr     => "$opt_vardir/log/master.err",
932
 
   path_pid       => "$opt_vardir/run/master.pid",
933
 
   path_sock      => "$sockdir/master.sock",
934
 
   port           =>  $opt_master_myport,
935
 
   secondary_port =>  $opt_master_myport + $secondary_port_offset,
936
 
   start_timeout  =>  400, # enough time create innodb tables
937
 
   cluster        =>  0, # index in clusters list
938
 
   start_opts     => [],
 
899
   pid           => 0,
 
900
   type          => "master",
 
901
   idx           => 0,
 
902
   path_myddir   => "$opt_vardir/master-data",
 
903
   path_myerr    => "$opt_vardir/log/master.err",
 
904
   path_pid      => "$opt_vardir/run/master.pid",
 
905
   path_sock     => "$sockdir/master.sock",
 
906
   port          =>  $opt_master_myport,
 
907
   start_timeout =>  400, # enough time create innodb tables
 
908
   cluster       =>  0, # index in clusters list
 
909
   start_opts    => [],
939
910
  };
940
911
 
941
912
  $master->[1]=
942
913
  {
943
 
   pid            => 0,
944
 
   type           => "master",
945
 
   idx            => 1,
946
 
   path_myddir    => "$opt_vardir/master1-data",
947
 
   path_myerr     => "$opt_vardir/log/master1.err",
948
 
   path_pid       => "$opt_vardir/run/master1.pid",
949
 
   path_sock      => "$sockdir/master1.sock",
950
 
   port           => $opt_master_myport + 1,
951
 
   secondary_port => $opt_master_myport + 1 + $secondary_port_offset,
952
 
   start_timeout  => 400, # enough time create innodb tables
953
 
   cluster        =>  0, # index in clusters list
954
 
   start_opts     => [],
 
914
   pid           => 0,
 
915
   type          => "master",
 
916
   idx           => 1,
 
917
   path_myddir   => "$opt_vardir/master1-data",
 
918
   path_myerr    => "$opt_vardir/log/master1.err",
 
919
   path_pid      => "$opt_vardir/run/master1.pid",
 
920
   path_sock     => "$sockdir/master1.sock",
 
921
   port          => $opt_master_myport + 1,
 
922
   start_timeout => 400, # enough time create innodb tables
 
923
   cluster       =>  0, # index in clusters list
 
924
   start_opts    => [],
955
925
  };
956
926
 
957
927
  $slave->[0]=
958
928
  {
959
 
   pid            => 0,
960
 
   type           => "slave",
961
 
   idx            => 0,
962
 
   path_myddir    => "$opt_vardir/slave-data",
963
 
   path_myerr     => "$opt_vardir/log/slave.err",
964
 
   path_pid       => "$opt_vardir/run/slave.pid",
965
 
   path_sock      => "$sockdir/slave.sock",
966
 
   port           => $opt_slave_myport,
967
 
   secondary_port => $opt_slave_myport + $secondary_port_offset,
968
 
   start_timeout  => 400,
969
 
   cluster        =>  1, # index in clusters list
970
 
   start_opts     => [],
 
929
   pid           => 0,
 
930
   type          => "slave",
 
931
   idx           => 0,
 
932
   path_myddir   => "$opt_vardir/slave-data",
 
933
   path_myerr    => "$opt_vardir/log/slave.err",
 
934
   path_pid    => "$opt_vardir/run/slave.pid",
 
935
   path_sock   => "$sockdir/slave.sock",
 
936
   port   => $opt_slave_myport,
 
937
   start_timeout => 400,
 
938
 
 
939
   cluster       =>  1, # index in clusters list
 
940
   start_opts    => [],
971
941
  };
972
942
 
973
943
  $slave->[1]=
974
944
  {
975
 
   pid            => 0,
976
 
   type           => "slave",
977
 
   idx            => 1,
978
 
   path_myddir    => "$opt_vardir/slave1-data",
979
 
   path_myerr     => "$opt_vardir/log/slave1.err",
980
 
   path_pid       => "$opt_vardir/run/slave1.pid",
981
 
   path_sock      => "$sockdir/slave1.sock",
982
 
   port           => $opt_slave_myport + 1,
983
 
   secondary_port => $opt_slave_myport + 1 + $secondary_port_offset,
984
 
   start_timeout  => 300,
985
 
   cluster        =>  -1, # index in clusters list
986
 
   start_opts     => [],
 
945
   pid           => 0,
 
946
   type          => "slave",
 
947
   idx           => 1,
 
948
   path_myddir   => "$opt_vardir/slave1-data",
 
949
   path_myerr    => "$opt_vardir/log/slave1.err",
 
950
   path_pid    => "$opt_vardir/run/slave1.pid",
 
951
   path_sock   => "$sockdir/slave1.sock",
 
952
   port   => $opt_slave_myport + 1,
 
953
   start_timeout => 300,
 
954
   cluster       =>  -1, # index in clusters list
 
955
   start_opts    => [],
987
956
  };
988
957
 
989
958
  $slave->[2]=
990
959
  {
991
 
   pid            => 0,
992
 
   type           => "slave",
993
 
   idx            => 2,
994
 
   path_myddir    => "$opt_vardir/slave2-data",
995
 
   path_myerr     => "$opt_vardir/log/slave2.err",
996
 
   path_pid       => "$opt_vardir/run/slave2.pid",
997
 
   path_sock      => "$sockdir/slave2.sock",
998
 
   port           => $opt_slave_myport + 2,
999
 
   secondary_port => $opt_slave_myport + 2 + $secondary_port_offset,
1000
 
   start_timeout  => 300,
1001
 
   cluster        =>  -1, # index in clusters list
1002
 
   start_opts     => [],
 
960
   pid           => 0,
 
961
   type          => "slave",
 
962
   idx           => 2,
 
963
   path_myddir   => "$opt_vardir/slave2-data",
 
964
   path_myerr    => "$opt_vardir/log/slave2.err",
 
965
   path_pid    => "$opt_vardir/run/slave2.pid",
 
966
   path_sock   => "$sockdir/slave2.sock",
 
967
   port   => $opt_slave_myport + 2,
 
968
   start_timeout => 300,
 
969
   cluster       =>  -1, # index in clusters list
 
970
   start_opts    => [],
1003
971
  };
1004
972
 
1005
973
 
1043
1011
  }
1044
1012
}
1045
1013
 
1046
 
sub gimme_a_good_port($)
1047
 
{
1048
 
  my $port_to_test= shift;
1049
 
  my $is_port_bad= 1;
1050
 
  while ($is_port_bad) {
1051
 
    my $sock = new IO::Socket::INET( PeerAddr => 'localhost',
1052
 
                                     PeerPort => $port_to_test,
1053
 
                                     Proto => 'tcp' );
1054
 
    if ($sock) {
1055
 
      close($sock);
1056
 
      $port_to_test += 1;
1057
 
      if ($port_to_test >= 32767) {
1058
 
        $port_to_test = 5001;
1059
 
      }
1060
 
 
1061
 
    } else {
1062
 
      $is_port_bad= 0;
1063
 
    }
1064
 
  }
1065
 
  return $port_to_test;
1066
 
 
1067
 
}
1068
1014
#
1069
1015
# To make it easier for different devs to work on the same host,
1070
1016
# an environment variable can be used to control all ports. A small
1094
1040
 
1095
1041
  # Up to two masters, up to three slaves
1096
1042
  # A magic value in command_line_setup depends on these equations.
1097
 
  $opt_master_myport=         gimme_a_good_port($mtr_build_thread + 9000); # and 1
1098
 
 
1099
 
 
1100
 
  $opt_slave_myport=          gimme_a_good_port($opt_master_myport + 2);  # and 3 4
1101
 
  $opt_memc_myport= gimme_a_good_port($opt_master_myport + 10);
 
1043
  $opt_master_myport=         $mtr_build_thread + 9000; # and 1
 
1044
  $opt_slave_myport=          $opt_master_myport + 2;  # and 3 4
1102
1045
 
1103
1046
  if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 )
1104
1047
  {
1149
1092
  foreach my $line (split('\n', $list))
1150
1093
  {
1151
1094
    # First look for version
1152
 
    if ( !$drizzle_version_id )
 
1095
    if ( !$mysql_version_id )
1153
1096
    {
1154
1097
      # Look for version
1155
1098
      my $exe_name= basename($exe_drizzled);
1157
1100
      if ( $line =~ /^\S*$exe_name\s\sVer\s([0-9]*)\.([0-9]*)\.([0-9]*)/ )
1158
1101
      {
1159
1102
        #print "Major: $1 Minor: $2 Build: $3\n";
1160
 
        $drizzle_version_id= $1*10000 + $2*100 + $3;
1161
 
        #print "drizzle_version_id: $drizzle_version_id\n";
1162
 
        mtr_report("Drizzle Version $1.$2.$3");
 
1103
        $mysql_version_id= $1*10000 + $2*100 + $3;
 
1104
        #print "mysql_version_id: $mysql_version_id\n";
 
1105
        mtr_report("MySQL Version $1.$2.$3");
1163
1106
      }
1164
1107
    }
1165
1108
    else
1200
1143
    }
1201
1144
  }
1202
1145
  rmtree($tmpdir);
1203
 
  mtr_error("Could not find version of Drizzle") unless $drizzle_version_id;
 
1146
  mtr_error("Could not find version of MySQL") unless $mysql_version_id;
1204
1147
  mtr_error("Could not find variabes list") unless $found_variable_list_start;
1205
1148
 
1206
1149
}
1268
1211
  $exe_perror= "perror";
1269
1212
 
1270
1213
# Look for the client binaries
 
1214
  $exe_drizzlecheck= mtr_exe_exists("$path_client_bindir/drizzlecheck");
1271
1215
  $exe_drizzledump= mtr_exe_exists("$path_client_bindir/drizzledump");
1272
1216
  $exe_drizzleimport= mtr_exe_exists("$path_client_bindir/drizzleimport");
1273
1217
  $exe_drizzle=          mtr_exe_exists("$path_client_bindir/drizzle");
1275
1219
  if (!$opt_extern)
1276
1220
  {
1277
1221
# Look for SQL scripts directory
1278
 
     if ( $drizzle_version_id >= 50100 )
 
1222
     if ( $mysql_version_id >= 50100 )
1279
1223
     {
1280
1224
         $exe_drizzleslap= mtr_exe_exists("$path_client_bindir/drizzleslap");
1281
1225
     }
1282
1226
  }
1283
1227
 
1284
 
# Look for schema_writer
1285
 
  {
1286
 
    $exe_schemawriter= mtr_exe_exists("$glob_basedir/drizzled/message/schema_writer",
1287
 
                                      "$glob_builddir/drizzled/message/schema_writer");
1288
 
  }
1289
 
 
1290
1228
# Look for drizzletest executable
1291
1229
  {
1292
1230
    $exe_drizzletest= mtr_exe_exists("$path_client_bindir/drizzletest");
1314
1252
  my($mysqld) = @_;
1315
1253
  return
1316
1254
    mtr_native_path($exe_drizzledump) .
1317
 
      " --no-defaults -uroot " .
 
1255
      " --no-defaults -uroot --debug-check " .
1318
1256
      "--port=$mysqld->{'port'} ";
1319
1257
}
1320
1258
 
1342
1280
  mtr_add_arg($args, "--user=root");
1343
1281
  mtr_add_arg($args, "--port=$master->[0]->{'port'}");
1344
1282
 
1345
 
  if ( $opt_extern || $drizzle_version_id >= 50000 )
 
1283
  if ( $opt_extern || $mysql_version_id >= 50000 )
1346
1284
  {
1347
1285
    mtr_add_arg($args, "--vardir=$opt_vardir")
1348
1286
  }
1457
1395
  $ENV{'SLAVE_MYPORT'}=       $slave->[0]->{'port'};
1458
1396
  $ENV{'SLAVE_MYPORT1'}=      $slave->[1]->{'port'};
1459
1397
  $ENV{'SLAVE_MYPORT2'}=      $slave->[2]->{'port'};
1460
 
  $ENV{'MC_PORT'}=            $opt_memc_myport;
1461
 
  $ENV{'DRIZZLE_TCP_PORT'}=     $mysqld_variables{'drizzle-protocol-port'};
 
1398
  $ENV{'DRIZZLE_TCP_PORT'}=     $mysqld_variables{'port'};
1462
1399
 
1463
1400
  $ENV{'MTR_BUILD_THREAD'}=      $opt_mtr_build_thread;
1464
1401
 
1465
1402
  $ENV{'EXE_MYSQL'}=          $exe_drizzle;
1466
1403
 
 
1404
  # ----------------------------------------------------
 
1405
  # Setup env so childs can execute mysqlcheck
 
1406
  # ----------------------------------------------------
 
1407
  my $cmdline_mysqlcheck=
 
1408
    mtr_native_path($exe_drizzlecheck) .
 
1409
    " --no-defaults --debug-check -uroot " .
 
1410
    "--port=$master->[0]->{'port'} ";
 
1411
 
 
1412
  if ( $opt_debug )
 
1413
  {
 
1414
    $cmdline_mysqlcheck .=
 
1415
      " --debug=d:t:A,$path_vardir_trace/log/mysqlcheck.trace";
 
1416
  }
 
1417
  $ENV{'DRIZZLE_CHECK'}=              $cmdline_mysqlcheck;
1467
1418
 
1468
1419
  # ----------------------------------------------------
1469
1420
  # Setup env to childs can execute myqldump
1470
1421
  # ----------------------------------------------------
1471
1422
  my $cmdline_mysqldump= generate_cmdline_mysqldump($master->[0]);
1472
1423
  my $cmdline_mysqldumpslave= generate_cmdline_mysqldump($slave->[0]);
1473
 
  my $cmdline_mysqldump_secondary= mtr_native_path($exe_drizzledump) .
1474
 
       " --no-defaults -uroot " .
1475
 
       " --port=$master->[0]->{'secondary_port'} ";
1476
1424
 
1477
1425
  if ( $opt_debug )
1478
1426
  {
1480
1428
      " --debug=d:t:A,$path_vardir_trace/log/mysqldump-master.trace";
1481
1429
    $cmdline_mysqldumpslave .=
1482
1430
      " --debug=d:t:A,$path_vardir_trace/log/mysqldump-slave.trace";
1483
 
    $cmdline_mysqldump_secondary .=
1484
 
      " --debug=d:t:A,$path_vardir_trace/log/mysqldump-mysql.trace";
1485
1431
  }
1486
1432
  $ENV{'DRIZZLE_DUMP'}= $cmdline_mysqldump;
1487
1433
  $ENV{'DRIZZLE_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
1488
 
  $ENV{'DRIZZLE_DUMP_SECONDARY'}= $cmdline_mysqldump_secondary;
1489
1434
 
1490
1435
  # ----------------------------------------------------
1491
1436
  # Setup env so childs can execute mysqlslap
1496
1441
      mtr_native_path($exe_drizzleslap) .
1497
1442
      " -uroot " .
1498
1443
      "--port=$master->[0]->{'port'} ";
1499
 
    my $cmdline_drizzleslap_secondary=
1500
 
      mtr_native_path($exe_drizzleslap) .
1501
 
      " -uroot " .
1502
 
      " --port=$master->[0]->{'secondary_port'} ";
1503
1444
 
1504
1445
    if ( $opt_debug )
1505
1446
   {
1506
1447
      $cmdline_drizzleslap .=
1507
1448
        " --debug=d:t:A,$path_vardir_trace/log/drizzleslap.trace";
1508
 
      $cmdline_drizzleslap_secondary .=
1509
 
        " --debug=d:t:A,$path_vardir_trace/log/drizzleslap.trace";
1510
1449
    }
1511
1450
    $ENV{'DRIZZLE_SLAP'}= $cmdline_drizzleslap;
1512
 
    $ENV{'DRIZZLE_SLAP_SECONDARY'}= $cmdline_drizzleslap_secondary;
1513
1451
  }
1514
1452
 
1515
1453
 
1519
1457
  # ----------------------------------------------------
1520
1458
  my $cmdline_mysqlimport=
1521
1459
    mtr_native_path($exe_drizzleimport) .
1522
 
    " -uroot " .
 
1460
    " -uroot --debug-check " .
1523
1461
    "--port=$master->[0]->{'port'} ";
1524
1462
 
1525
1463
  if ( $opt_debug )
1535
1473
  # ----------------------------------------------------
1536
1474
  my $cmdline_mysql=
1537
1475
    mtr_native_path($exe_drizzle) .
1538
 
    " --no-defaults --host=localhost  --user=root --password= " .
 
1476
    " --no-defaults --debug-check --host=localhost  --user=root --password= " .
1539
1477
    "--port=$master->[0]->{'port'} ";
1540
 
  my $cmdline_drizzle_secondary=
1541
 
    mtr_native_path($exe_drizzle) .
1542
 
    " --no-defaults --host=localhost  --user=root --password= " .
1543
 
    " --port=$master->[0]->{'secondary_port'} ";
1544
1478
 
1545
1479
  $ENV{'MYSQL'}= $cmdline_mysql;
1546
 
  $ENV{'DRIZZLE_SECONDARY'}= $cmdline_drizzle_secondary;
1547
1480
 
1548
1481
  # ----------------------------------------------------
1549
1482
  # Setup env so childs can execute bug25714
1617
1550
    print "Using SLAVE_MYPORT          = $ENV{SLAVE_MYPORT}\n";
1618
1551
    print "Using SLAVE_MYPORT1         = $ENV{SLAVE_MYPORT1}\n";
1619
1552
    print "Using SLAVE_MYPORT2         = $ENV{SLAVE_MYPORT2}\n";
1620
 
    print "Using MC_PORT               = $ENV{MC_PORT}\n";
1621
1553
  }
1622
1554
 
1623
1555
  # Create an environment variable to make it possible
1807
1739
  foreach my $data_dir (@data_dir_lst)
1808
1740
  {
1809
1741
    mkpath("$data_dir/mysql");
1810
 
    system("$exe_schemawriter mysql $data_dir/mysql/db.opt");
1811
 
 
1812
1742
    mkpath("$data_dir/test");
1813
 
    system("$exe_schemawriter test $data_dir/test/db.opt");
1814
1743
  }
1815
1744
 
1816
1745
  # Make a link std_data_ln in var/ that points to std_data
1914
1843
 
1915
1844
  if ( ! $benchmark )
1916
1845
  {
 
1846
    mtr_add_arg($args, "--log");
1917
1847
    mtr_run("$glob_mysql_bench_dir/run-all-tests", $args, "", "", "", "");
1918
1848
    # FIXME check result code?!
1919
1849
  }
2502
2432
    mtr_add_arg($args, "%s--default-storage-engine=%s", $prefix, $opt_engine);
2503
2433
  }
2504
2434
 
2505
 
  if ( $drizzle_version_id >= 50036)
 
2435
  if ( $mysql_version_id >= 50036)
2506
2436
  {
2507
2437
    # By default, prevent the started mysqld to access files outside of vardir
2508
2438
    mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir);
2513
2443
  # Increase default connect_timeout to avoid intermittent
2514
2444
  # disconnects when test servers are put under load
2515
2445
  # see BUG#28359
2516
 
  mtr_add_arg($args, "%s--mysql-protocol-connect-timeout=60", $prefix);
 
2446
  mtr_add_arg($args, "%s--connect-timeout=60", $prefix);
2517
2447
 
2518
2448
 
2519
2449
  # When mysqld is run by a root user(euid is 0), it will fail
2526
2456
  mtr_add_arg($args, "%s--pid-file=%s", $prefix,
2527
2457
              $mysqld->{'path_pid'});
2528
2458
 
2529
 
  mtr_add_arg($args, "%s--mysql-protocol-port=%d", $prefix,
2530
 
              $mysqld->{'port'});
2531
 
 
2532
 
  mtr_add_arg($args, "%s--drizzle-protocol-port=%d", $prefix,
2533
 
              $mysqld->{'secondary_port'});
 
2459
  mtr_add_arg($args, "%s--port=%d", $prefix,
 
2460
                $mysqld->{'port'});
2534
2461
 
2535
2462
  mtr_add_arg($args, "%s--datadir=%s", $prefix,
2536
2463
              $mysqld->{'path_myddir'});
2537
2464
 
 
2465
  my $log_base_path= "$opt_vardir/log/$mysqld->{'type'}$sidx";
 
2466
  mtr_add_arg($args, "%s--log=%s.log", $prefix, $log_base_path);
 
2467
 
2538
2468
  # Check if "extra_opt" contains --skip-log-bin
2539
2469
  if ( $mysqld->{'type'} eq 'master' )
2540
2470
  {
2546
2476
 
2547
2477
    mtr_add_arg($args, "%s--loose-innodb-lock-wait-timeout=5", $prefix);
2548
2478
 
 
2479
    if ( $idx > 0 or !$use_innodb)
 
2480
    {
 
2481
      mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
 
2482
    }
2549
2483
  }
2550
2484
  else
2551
2485
  {
2578
2512
                $prefix, $path_vardir_trace, $mysqld->{'type'}, $sidx);
2579
2513
  }
2580
2514
 
2581
 
  mtr_add_arg($args, "%s--myisam_key_cache_size=1M", $prefix);
 
2515
  mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix);
2582
2516
  mtr_add_arg($args, "%s--sort_buffer=256K", $prefix);
2583
2517
  mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix);
2584
2518
 
2664
2598
  {
2665
2599
    ddd_arguments(\$args, \$exe, "$type"."_$idx");
2666
2600
  }
2667
 
  if ( $opt_dbx || $opt_manual_dbx)
2668
 
  {
2669
 
    dbx_arguments(\$args, \$exe, "$type"."_$idx");
2670
 
  }
2671
2601
  elsif ( $opt_debugger )
2672
2602
  {
2673
2603
    debugger_arguments(\$args, \$exe, "$type"."_$idx");
3256
3186
 
3257
3187
}
3258
3188
 
3259
 
#
3260
 
# Modify the exe and args so that program is run in gdb in xterm
3261
 
#
3262
 
sub dbx_arguments {
3263
 
  my $args= shift;
3264
 
  my $exe=  shift;
3265
 
  my $type= shift;
3266
 
 
3267
 
  # Write $args to gdb init file
3268
 
  my $str= join(" ", @$$args);
3269
 
  my $dbx_init_file= "$opt_tmpdir/dbxinit.$type";
3270
 
 
3271
 
  # Remove the old gdbinit file
3272
 
  unlink($dbx_init_file);
3273
 
  if ( $type eq "client" )
3274
 
  {
3275
 
    # write init file for client
3276
 
    mtr_tofile($dbx_init_file,
3277
 
               "runargs $str\n" .
3278
 
               "run\n");
3279
 
  }
3280
 
  else
3281
 
  {
3282
 
    # write init file for drizzled
3283
 
    mtr_tofile($dbx_init_file,
3284
 
               "stop in __1cIdrizzledLmysql_parse6Fpn0AHSession_pkcI_v_\n" .
3285
 
               "runargs $str\n" .
3286
 
               "run\n" .
3287
 
               "\n");
3288
 
  }
3289
 
 
3290
 
  if ( $opt_manual_dbx )
3291
 
  {
3292
 
     print "\nTo start dbx for $type, type in another window:\n";
3293
 
     print "dbx -c 'source $dbx_init_file' $$exe\n";
3294
 
 
3295
 
     # Indicate the exe should not be started
3296
 
     $$exe= undef;
3297
 
     return;
3298
 
  }
3299
 
 
3300
 
  $$args= [];
3301
 
  mtr_add_arg($$args, "-title");
3302
 
  mtr_add_arg($$args, "$type");
3303
 
  mtr_add_arg($$args, "-e");
3304
 
 
3305
 
  mtr_add_arg($$args, "dbx");
3306
 
  mtr_add_arg($$args, "-c");
3307
 
  mtr_add_arg($$args, "source $dbx_init_file");
3308
 
  mtr_add_arg($$args, "$$exe");
3309
 
 
3310
 
  $$exe= "xterm";
3311
 
}
3312
3189
 
3313
3190
#
3314
3191
# Modify the exe and args so that program is run in gdb in xterm
3337
3214
    # write init file for mysqld
3338
3215
    mtr_tofile($gdb_init_file,
3339
3216
               "set args $str\n" .
3340
 
               "break drizzled::mysql_parse\n" .
 
3217
               "break mysql_parse\n" .
3341
3218
               "commands 1\n" .
3342
3219
               "disable 1\n" .
3343
3220
               "end\n" .
3402
3279
    mtr_tofile($gdb_init_file,
3403
3280
               "file $$exe\n" .
3404
3281
               "set args $str\n" .
3405
 
               "break drizzled::mysql_parse\n" .
 
3282
               "break mysql_parse\n" .
3406
3283
               "commands 1\n" .
3407
3284
               "disable 1\n" .
3408
3285
               "end");
3455
3332
    $$exe= $debugger;
3456
3333
 
3457
3334
  }
3458
 
  #elsif ( $debugger eq "dbx" )
3459
 
  #{
3460
 
  #  # xterm -e dbx -r exe arg1 .. argn
3461
 
#
3462
 
#    unshift(@$$args, $$exe);
3463
 
#    unshift(@$$args, "-r");
3464
 
#    unshift(@$$args, $debugger);
3465
 
#    unshift(@$$args, "-e");
3466
 
#
3467
 
#    $$exe= "xterm";
3468
 
#
3469
 
#  }
 
3335
  elsif ( $debugger eq "dbx" )
 
3336
  {
 
3337
    # xterm -e dbx -r exe arg1 .. argn
 
3338
 
 
3339
    unshift(@$$args, $$exe);
 
3340
    unshift(@$$args, "-r");
 
3341
    unshift(@$$args, $debugger);
 
3342
    unshift(@$$args, "-e");
 
3343
 
 
3344
    $$exe= "xterm";
 
3345
 
 
3346
  }
3470
3347
  else
3471
3348
  {
3472
3349
    mtr_error("Unknown argument \"$debugger\" passed to --debugger");
3486
3363
    mtr_add_arg($args, "--tool=callgrind");
3487
3364
    mtr_add_arg($args, "--base=$opt_vardir/log");
3488
3365
  }
3489
 
  elsif ($opt_massif)
3490
 
  {
3491
 
    mtr_add_arg($args, "--tool=massif");
3492
 
  }
3493
3366
  else
3494
3367
  {
3495
3368
    mtr_add_arg($args, "--tool=memcheck"); # From >= 2.1.2 needs this option
 
3369
    mtr_add_arg($args, "--alignment=8");
3496
3370
    mtr_add_arg($args, "--leak-check=yes");
3497
3371
    mtr_add_arg($args, "--num-callers=16");
3498
3372
    mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
3615
3489
                        list of suite names.
3616
3490
                        The default is: "$opt_suites_default"
3617
3491
  skip-rpl              Skip the replication test cases.
 
3492
  big-test              Set the environment variable BIG_TEST, which can be
 
3493
                        checked from test cases.
3618
3494
  combination="ARG1 .. ARG2" Specify a set of "mysqld" arguments for one
3619
3495
                        combination.
3620
3496
  skip-combination      Skip any combination options and combinations files
3679
3555
                        can be specified more then once
3680
3556
  valgrind-path=[EXE]   Path to the valgrind executable
3681
3557
  callgrind             Instruct valgrind to use callgrind
3682
 
  massif                Instruct valgrind to use massif
3683
3558
 
3684
3559
Misc options
3685
3560