~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/test-run.pl

  • Committer: Brian Aker
  • Date: 2008-07-16 01:30:24 UTC
  • Revision ID: brian@tangent.org-20080716013024-nmnogwdpa459jrch
First pass of cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
#
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
require "lib/mtr_cases.pl";
 
77
require "lib/mtr_process.pl";
 
78
require "lib/mtr_timer.pl";
 
79
require "lib/mtr_io.pl";
 
80
require "lib/mtr_gcov.pl";
 
81
require "lib/mtr_gprof.pl";
 
82
require "lib/mtr_report.pl";
 
83
require "lib/mtr_match.pl";
 
84
require "lib/mtr_misc.pl";
 
85
require "lib/mtr_stress.pl";
 
86
require "lib/mtr_unique.pl";
88
87
 
89
88
$Devel::Trace::TRACE= 1;
90
89
 
104
103
 
105
104
our $glob_basedir;
106
105
 
 
106
our $path_charsetsdir;
107
107
our $path_client_bindir;
 
108
our $path_share;
 
109
our $path_language;
108
110
our $path_timefile;
109
111
our $path_snapshot;
110
 
our $path_drizzletest_log;
 
112
our $path_mysqltest_log;
111
113
our $path_current_test_log;
112
114
our $path_my_basedir;
113
115
 
125
127
our $opt_verbose= 0;  # Verbose output, enable with --verbose
126
128
 
127
129
our $exe_master_mysqld;
128
 
our $exe_drizzle;
129
 
our $exe_drizzleadmin;
130
 
our $exe_drizzle_client_test;
 
130
our $exe_mysql;
 
131
our $exe_mysqladmin;
 
132
our $exe_mysqlbinlog;
 
133
our $exe_mysql_client_test;
131
134
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;
 
135
our $exe_mysqld;
 
136
our $exe_mysqlcheck;
 
137
our $exe_mysqldump;
 
138
our $exe_mysqlslap;
 
139
our $exe_mysqlimport;
 
140
our $exe_mysql_fix_system_tables;
 
141
our $exe_mysqltest;
139
142
our $exe_slave_mysqld;
140
143
our $exe_my_print_defaults;
141
144
our $exe_perror;
157
160
our $opt_debug;
158
161
our $opt_do_test;
159
162
our @opt_cases;                  # The test cases names in argv
160
 
our $opt_engine;
161
163
 
162
164
our $opt_extern= 0;
163
165
our $opt_socket;
225
227
 
226
228
my $opt_valgrind= 0;
227
229
my $opt_valgrind_mysqld= 0;
228
 
my $opt_valgrind_drizzletest= 0;
 
230
my $opt_valgrind_mysqltest= 0;
229
231
my @default_valgrind_args= ("--show-reachable=yes");
230
232
my @valgrind_args;
231
233
my $opt_valgrind_path;
293
295
sub mysqld_start ($$$);
294
296
sub mysqld_arguments ($$$$);
295
297
sub stop_all_servers ();
296
 
sub run_drizzletest ($);
 
298
sub run_mysqltest ($);
297
299
sub usage ($);
298
300
 
299
301
 
486
488
 
487
489
             # Extra options used when starting mysqld
488
490
             'mysqld=s'                 => \@opt_extra_mysqld_opt,
489
 
             'engine=s'                 => \$opt_engine,
490
491
 
491
492
             # Run test on running server
492
493
             'extern'                   => \$opt_extern,
510
511
             'gcov'                     => \$opt_gcov,
511
512
             'gprof'                    => \$opt_gprof,
512
513
             'valgrind|valgrind-all'    => \$opt_valgrind,
513
 
             'valgrind-drizzletest'       => \$opt_valgrind_drizzletest,
 
514
             'valgrind-mysqltest'       => \$opt_valgrind_mysqltest,
514
515
             'valgrind-mysqld'          => \$opt_valgrind_mysqld,
515
516
             'valgrind-options=s'       => sub {
516
517
               my ($opt, $value)= @_;
591
592
              "as follows:\n./$glob_scriptname");
592
593
  }
593
594
 
594
 
  if ( -d "../drizzled" )
 
595
  if ( -d "../server" )
595
596
  {
596
597
    $source_dist=  1;
597
598
  }
635
636
  $path_client_bindir= mtr_path_exists("$glob_basedir/client",
636
637
                                       "$glob_basedir/bin");
637
638
 
 
639
  # Look for language files and charsetsdir, use same share
 
640
  $path_share=      mtr_path_exists("$glob_basedir/share/mysql",
 
641
                                    "$glob_basedir/server/share",
 
642
                                    "$glob_basedir/share");
 
643
 
 
644
  $path_language=      mtr_path_exists("$path_share/english");
 
645
  $path_charsetsdir=   mtr_path_exists("$path_share/charsets");
 
646
 
 
647
 
638
648
  if (!$opt_extern)
639
649
  {
640
 
    $exe_drizzled=       mtr_exe_exists ("$glob_basedir/drizzled/drizzled",
 
650
    $exe_mysqld=       mtr_exe_exists ("$glob_basedir/server/drizzled",
641
651
                                       "$path_client_bindir/drizzled",
642
652
                                       "$glob_basedir/libexec/drizzled",
643
653
                                       "$glob_basedir/bin/drizzled",
651
661
    $mysqld_variables{'port'}= 4427;
652
662
  }
653
663
 
654
 
  if (!$opt_engine)
655
 
  {
656
 
    $opt_engine= "innodb";
657
 
  }
658
 
 
659
664
  if ( $opt_comment )
660
665
  {
661
666
    print "\n";
843
848
  # --------------------------------------------------------------------------
844
849
  # Check if special exe was selected for master or slave
845
850
  # --------------------------------------------------------------------------
846
 
  $exe_master_mysqld= $exe_master_mysqld || $exe_drizzled;
847
 
  $exe_slave_mysqld=  $exe_slave_mysqld  || $exe_drizzled;
 
851
  $exe_master_mysqld= $exe_master_mysqld || $exe_mysqld;
 
852
  $exe_slave_mysqld=  $exe_slave_mysqld  || $exe_mysqld;
848
853
 
849
854
  # --------------------------------------------------------------------------
850
855
  # Check valgrind arguments
854
859
    mtr_report("Turning on valgrind for all executables");
855
860
    $opt_valgrind= 1;
856
861
    $opt_valgrind_mysqld= 1;
857
 
    $opt_valgrind_drizzletest= 1;
 
862
    $opt_valgrind_mysqltest= 1;
858
863
  }
859
864
  elsif ( $opt_valgrind_mysqld )
860
865
  {
861
866
    mtr_report("Turning on valgrind for mysqld(s) only");
862
867
    $opt_valgrind= 1;
863
868
  }
864
 
  elsif ( $opt_valgrind_drizzletest )
 
869
  elsif ( $opt_valgrind_mysqltest )
865
870
  {
866
 
    mtr_report("Turning on valgrind for drizzletest and drizzle_client_test only");
 
871
    mtr_report("Turning on valgrind for mysqltest and mysql_client_test only");
867
872
    $opt_valgrind= 1;
868
873
  }
869
874
 
1020
1025
  }
1021
1026
 
1022
1027
 
1023
 
  $path_timefile=  "$opt_vardir/log/drizzletest-time";
1024
 
  $path_drizzletest_log=  "$opt_vardir/log/drizzletest.log";
 
1028
  $path_timefile=  "$opt_vardir/log/mysqltest-time";
 
1029
  $path_mysqltest_log=  "$opt_vardir/log/mysqltest.log";
1025
1030
  $path_current_test_log= "$opt_vardir/log/current_test";
1026
1031
 
1027
1032
  $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/";
1114
1119
  #
1115
1120
  # --datadir must exist, mysqld will chdir into it
1116
1121
  #
1117
 
  my $list= `$exe_drizzled --no-defaults --datadir=$tmpdir --skip-grant-tables --verbose --help`;
 
1122
  my $list= `$exe_mysqld --no-defaults --datadir=$tmpdir --language=$path_language --skip-grant-tables --verbose --help`;
1118
1123
 
1119
1124
  foreach my $line (split('\n', $list))
1120
1125
  {
1122
1127
    if ( !$mysql_version_id )
1123
1128
    {
1124
1129
      # Look for version
1125
 
      my $exe_name= basename($exe_drizzled);
 
1130
      my $exe_name= basename($exe_mysqld);
1126
1131
      mtr_verbose("exe_name: $exe_name");
1127
1132
      if ( $line =~ /^\S*$exe_name\s\sVer\s([0-9]*)\.([0-9]*)\.([0-9]*)/ )
1128
1133
      {
1188
1193
  mtr_add_arg($args, "--silent"); # Tab separated output
1189
1194
  mtr_add_arg($args, "-e '%s'", $query);
1190
1195
 
1191
 
  my $cmd= "$exe_drizzle " . join(' ', @$args);
 
1196
  my $cmd= "$exe_mysql " . join(' ', @$args);
1192
1197
  mtr_verbose("cmd: $cmd");
1193
1198
  return `$cmd`;
1194
1199
}
1236
1241
  $exe_perror= "perror";
1237
1242
 
1238
1243
# 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");
 
1244
  $exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
 
1245
  $exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump");
 
1246
  $exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport");
 
1247
  $exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
 
1248
  $exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
 
1249
  $exe_mysql=          mtr_exe_exists("$path_client_bindir/mysql");
1244
1250
 
1245
1251
  if (!$opt_extern)
1246
1252
  {
1247
1253
# Look for SQL scripts directory
1248
 
     if ( $mysql_version_id >= 50100 )
1249
 
     {
1250
 
         $exe_drizzleslap= mtr_exe_exists("$path_client_bindir/drizzleslap");
1251
 
     }
 
1254
    if ( $mysql_version_id >= 50100 )
 
1255
    {
 
1256
      $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
 
1257
    }
1252
1258
  }
1253
1259
 
1254
 
# Look for drizzletest executable
 
1260
# Look for mysqltest executable
1255
1261
  {
1256
 
    $exe_drizzletest= mtr_exe_exists("$path_client_bindir/drizzletest");
 
1262
    $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
1257
1263
  }
1258
1264
 
1259
 
# Look for drizzle_client_test executable which may _not_ exist in
 
1265
# Look for mysql_client_test executable which may _not_ exist in
1260
1266
# some versions, test using it should be skipped
1261
1267
  {
1262
 
    $exe_drizzle_client_test=
 
1268
    $exe_mysql_client_test=
1263
1269
      mtr_exe_maybe_exists(
1264
 
          "$glob_basedir/tests/drizzle_client_test",
1265
 
          "$glob_basedir/bin/drizzle_client_test");
 
1270
          "$glob_basedir/tests/mysql_client_test",
 
1271
          "$glob_basedir/bin/mysql_client_test");
1266
1272
  }
1267
1273
 
1268
1274
# Look for bug25714 executable which may _not_ exist in
1277
1283
sub generate_cmdline_mysqldump ($) {
1278
1284
  my($mysqld) = @_;
1279
1285
  return
1280
 
    mtr_native_path($exe_drizzledump) .
 
1286
    mtr_native_path($exe_mysqldump) .
1281
1287
      " --no-defaults -uroot --debug-check " .
1282
1288
      "--port=$mysqld->{'port'} ";
1283
1289
}
1290
1296
#
1291
1297
##############################################################################
1292
1298
 
1293
 
sub drizzle_client_test_arguments()
 
1299
sub mysql_client_test_arguments()
1294
1300
{
1295
 
  my $exe= $exe_drizzle_client_test;
 
1301
  my $exe= $exe_mysql_client_test;
1296
1302
 
1297
1303
  my $args;
1298
1304
  mtr_init_args(\$args);
1299
 
  if ( $opt_valgrind_drizzletest )
 
1305
  if ( $opt_valgrind_mysqltest )
1300
1306
  {
1301
1307
    valgrind_arguments($args, \$exe);
1302
1308
  }
1314
1320
  if ( $opt_debug )
1315
1321
  {
1316
1322
    mtr_add_arg($args,
1317
 
      "--debug=d:t:A,$path_vardir_trace/log/drizzle_client_test.trace");
 
1323
      "--debug=d:t:A,$path_vardir_trace/log/mysql_client_test.trace");
1318
1324
  }
1319
1325
 
1320
1326
  return join(" ", $exe, @$args);
1390
1396
  # Also command lines in .opt files may contain env vars
1391
1397
  # --------------------------------------------------------------------------
1392
1398
 
1393
 
  $ENV{'CHARSETSDIR'}=              "";
 
1399
  $ENV{'CHARSETSDIR'}=              $path_charsetsdir;
1394
1400
  $ENV{'UMASK'}=              "0660"; # The octal *string*
1395
1401
  $ENV{'UMASK_DIR'}=          "0770"; # The octal *string*
1396
1402
  
1407
1413
  
1408
1414
  $ENV{'LC_COLLATE'}=         "C";
1409
1415
  $ENV{'USE_RUNNING_SERVER'}= $opt_extern;
1410
 
  $ENV{'DRIZZLE_TEST_DIR'}=     $glob_mysql_test_dir;
 
1416
  $ENV{'MYSQL_TEST_DIR'}=     $glob_mysql_test_dir;
1411
1417
  $ENV{'MYSQLTEST_VARDIR'}=   $opt_vardir;
1412
 
  $ENV{'DRIZZLE_TMP_DIR'}=      $opt_tmpdir;
 
1418
  $ENV{'MYSQL_TMP_DIR'}=      $opt_tmpdir;
1413
1419
  $ENV{'MASTER_MYSOCK'}=      $master->[0]->{'path_sock'};
1414
1420
  $ENV{'MASTER_MYSOCK1'}=     $master->[1]->{'path_sock'};
1415
1421
  $ENV{'MASTER_MYPORT'}=      $master->[0]->{'port'};
1418
1424
  $ENV{'SLAVE_MYPORT'}=       $slave->[0]->{'port'};
1419
1425
  $ENV{'SLAVE_MYPORT1'}=      $slave->[1]->{'port'};
1420
1426
  $ENV{'SLAVE_MYPORT2'}=      $slave->[2]->{'port'};
1421
 
  $ENV{'DRIZZLE_TCP_PORT'}=     $mysqld_variables{'port'};
 
1427
  $ENV{'MYSQL_TCP_PORT'}=     $mysqld_variables{'port'};
1422
1428
 
1423
1429
  $ENV{MTR_BUILD_THREAD}=      $opt_mtr_build_thread;
1424
1430
 
1425
 
  $ENV{'EXE_MYSQL'}=          $exe_drizzle;
 
1431
  $ENV{'EXE_MYSQL'}=          $exe_mysql;
1426
1432
 
1427
1433
  # ----------------------------------------------------
1428
1434
  # Setup env so childs can execute mysqlcheck
1429
1435
  # ----------------------------------------------------
1430
1436
  my $cmdline_mysqlcheck=
1431
 
    mtr_native_path($exe_drizzlecheck) .
 
1437
    mtr_native_path($exe_mysqlcheck) .
1432
1438
    " --no-defaults --debug-check -uroot " .
1433
1439
    "--port=$master->[0]->{'port'} ";
1434
1440
 
1437
1443
    $cmdline_mysqlcheck .=
1438
1444
      " --debug=d:t:A,$path_vardir_trace/log/mysqlcheck.trace";
1439
1445
  }
1440
 
  $ENV{'DRIZZLE_CHECK'}=              $cmdline_mysqlcheck;
 
1446
  $ENV{'MYSQL_CHECK'}=              $cmdline_mysqlcheck;
1441
1447
 
1442
1448
  # ----------------------------------------------------
1443
1449
  # Setup env to childs can execute myqldump
1452
1458
    $cmdline_mysqldumpslave .=
1453
1459
      " --debug=d:t:A,$path_vardir_trace/log/mysqldump-slave.trace";
1454
1460
  }
1455
 
  $ENV{'DRIZZLE_DUMP'}= $cmdline_mysqldump;
1456
 
  $ENV{'DRIZZLE_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
 
1461
  $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
 
1462
  $ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
 
1463
 
1457
1464
 
1458
1465
  # ----------------------------------------------------
1459
1466
  # Setup env so childs can execute mysqlslap
1460
1467
  # ----------------------------------------------------
1461
 
  if ( $exe_drizzleslap )
 
1468
  if ( $exe_mysqlslap )
1462
1469
  {
1463
 
    my $cmdline_drizzleslap=
1464
 
      mtr_native_path($exe_drizzleslap) .
 
1470
    my $cmdline_mysqlslap=
 
1471
      mtr_native_path($exe_mysqlslap) .
1465
1472
      " -uroot " .
1466
1473
      "--port=$master->[0]->{'port'} ";
1467
1474
 
1468
1475
    if ( $opt_debug )
1469
1476
   {
1470
 
      $cmdline_drizzleslap .=
1471
 
        " --debug=d:t:A,$path_vardir_trace/log/drizzleslap.trace";
 
1477
      $cmdline_mysqlslap .=
 
1478
        " --debug=d:t:A,$path_vardir_trace/log/mysqlslap.trace";
1472
1479
    }
1473
 
    $ENV{'DRIZZLE_SLAP'}= $cmdline_drizzleslap;
 
1480
    $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap;
1474
1481
  }
1475
1482
 
1476
 
 
1477
 
 
1478
1483
  # ----------------------------------------------------
1479
1484
  # Setup env so childs can execute mysqlimport
1480
1485
  # ----------------------------------------------------
1481
1486
  my $cmdline_mysqlimport=
1482
 
    mtr_native_path($exe_drizzleimport) .
 
1487
    mtr_native_path($exe_mysqlimport) .
1483
1488
    " -uroot --debug-check " .
1484
1489
    "--port=$master->[0]->{'port'} ";
1485
1490
 
1488
1493
    $cmdline_mysqlimport .=
1489
1494
      " --debug=d:t:A,$path_vardir_trace/log/mysqlimport.trace";
1490
1495
  }
1491
 
  $ENV{'DRIZZLE_IMPORT'}= $cmdline_mysqlimport;
1492
 
 
 
1496
  $ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
 
1497
 
 
1498
 
 
1499
  # ----------------------------------------------------
 
1500
  # Setup env so childs can execute mysqlbinlog
 
1501
  # ----------------------------------------------------
 
1502
  my $cmdline_mysqlbinlog=
 
1503
    mtr_native_path($exe_mysqlbinlog) .
 
1504
      " --no-defaults --disable-force-if-open --debug-check";
 
1505
  if ( !$opt_extern && $mysql_version_id >= 50000 )
 
1506
  {
 
1507
    $cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
 
1508
  }
 
1509
 
 
1510
  if ( $opt_debug )
 
1511
  {
 
1512
    $cmdline_mysqlbinlog .=
 
1513
      " --debug=d:t:A,$path_vardir_trace/log/mysqlbinlog.trace";
 
1514
  }
 
1515
  $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
1493
1516
 
1494
1517
  # ----------------------------------------------------
1495
1518
  # Setup env so childs can execute mysql
1496
1519
  # ----------------------------------------------------
1497
1520
  my $cmdline_mysql=
1498
 
    mtr_native_path($exe_drizzle) .
 
1521
    mtr_native_path($exe_mysql) .
1499
1522
    " --no-defaults --debug-check --host=localhost  --user=root --password= " .
1500
 
    "--port=$master->[0]->{'port'} ";
 
1523
    "--port=$master->[0]->{'port'} " .
 
1524
    "--character-sets-dir=$path_charsetsdir";
1501
1525
 
1502
1526
  $ENV{'MYSQL'}= $cmdline_mysql;
1503
1527
 
1504
1528
  # ----------------------------------------------------
1505
1529
  # Setup env so childs can execute bug25714
1506
1530
  # ----------------------------------------------------
1507
 
  $ENV{'DRIZZLE_BUG25714'}=  $exe_bug25714;
 
1531
  $ENV{'MYSQL_BUG25714'}=  $exe_bug25714;
1508
1532
 
1509
1533
  # ----------------------------------------------------
1510
 
  # Setup env so childs can execute drizzle_client_test
 
1534
  # Setup env so childs can execute mysql_client_test
1511
1535
  # ----------------------------------------------------
1512
 
  $ENV{'DRIZZLE_CLIENT_TEST'}=  drizzle_client_test_arguments();
 
1536
  $ENV{'MYSQL_CLIENT_TEST'}=  mysql_client_test_arguments();
1513
1537
 
1514
1538
 
1515
1539
  # ----------------------------------------------------
1519
1543
  if ( 0 )
1520
1544
  {
1521
1545
    my $cmdline_mysql_fix_system_tables=
1522
 
      "$exe_drizzle_fix_system_tables --no-defaults --host=localhost " .
 
1546
      "$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
1523
1547
      "--user=root --password= " .
1524
1548
      "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
1525
1549
      "--port=$master->[0]->{'port'} ";
1526
 
    $ENV{'DRIZZLE_FIX_SYSTEM_TABLES'}=  $cmdline_mysql_fix_system_tables;
 
1550
    $ENV{'MYSQL_FIX_SYSTEM_TABLES'}=  $cmdline_mysql_fix_system_tables;
1527
1551
 
1528
1552
  }
1529
1553
 
1530
1554
  # ----------------------------------------------------
1531
1555
  # Setup env so childs can execute my_print_defaults
1532
1556
  # ----------------------------------------------------
1533
 
  $ENV{'DRIZZLE_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults);
 
1557
  $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults);
1534
1558
 
1535
1559
  # ----------------------------------------------------
1536
1560
  # Setup env so childs can execute mysqladmin
1537
1561
  # ----------------------------------------------------
1538
 
  $ENV{'MYSQLADMIN'}= mtr_native_path($exe_drizzleadmin);
 
1562
  $ENV{'MYSQLADMIN'}= mtr_native_path($exe_mysqladmin);
1539
1563
 
1540
1564
  # ----------------------------------------------------
1541
1565
  # Setup env so childs can execute perror  
1795
1819
  # the file will not return 0000
1796
1820
  my $file_mode= (stat($test_file))[2] & 07777;
1797
1821
 
1798
 
  $ENV{'DRIZZLE_TEST_ROOT'}= "NO";
 
1822
  $ENV{'MYSQL_TEST_ROOT'}= "NO";
1799
1823
  mtr_verbose("result: $result, file_mode: $file_mode");
1800
1824
  if ($result eq "MySQL" && $file_mode == 0)
1801
1825
  {
1802
1826
    mtr_warning("running this script as _root_ will cause some " .
1803
1827
                "tests to be skipped");
1804
 
    $ENV{'DRIZZLE_TEST_ROOT'}= "YES";
 
1828
    $ENV{'MYSQL_TEST_ROOT'}= "YES";
1805
1829
  }
1806
1830
 
1807
1831
  chmod(oct("0755"), $test_file);
2042
2066
  # If marked to skip, just print out and return.
2043
2067
  # Note that a test case not marked as 'skip' can still be
2044
2068
  # skipped later, because of the test case itself in cooperation
2045
 
  # with the drizzletest program tells us so.
 
2069
  # with the mysqltest program tells us so.
2046
2070
  # ----------------------------------------------------------------------
2047
2071
 
2048
2072
  if ( $tinfo->{'skip'} )
2056
2080
}
2057
2081
 
2058
2082
 
2059
 
sub do_before_run_drizzletest($)
 
2083
sub do_before_run_mysqltest($)
2060
2084
{
2061
2085
  my $tinfo= shift;
2062
2086
  my $args;
2063
2087
 
2064
 
  # Remove old files produced by drizzletest
 
2088
  # Remove old files produced by mysqltest
2065
2089
  my $base_file= mtr_match_extension($tinfo->{'result_file'},
2066
2090
                                    "result"); # Trim extension
2067
2091
  unlink("$base_file.reject");
2086
2110
 
2087
2111
        my $sql= "include/set_binlog_format_".$tinfo->{binlog_format}.".sql";
2088
2112
        mtr_verbose("Setting binlog format:", $tinfo->{binlog_format});
2089
 
        if (mtr_run($exe_drizzle, $args, $sql, "", "", "") != 0)
 
2113
        if (mtr_run($exe_mysql, $args, $sql, "", "", "") != 0)
2090
2114
        {
2091
2115
          mtr_error("Failed to switch binlog format");
2092
2116
        }
2095
2119
  }
2096
2120
}
2097
2121
 
2098
 
sub do_after_run_drizzletest($)
 
2122
sub do_after_run_mysqltest($)
2099
2123
{
2100
2124
  my $tinfo= shift;
2101
2125
 
2102
 
  # Save info from this testcase run to drizzletest.log
2103
 
  mtr_appendfile_to_file($path_current_test_log, $path_drizzletest_log)
 
2126
  # Save info from this testcase run to mysqltest.log
 
2127
  mtr_appendfile_to_file($path_current_test_log, $path_mysqltest_log)
2104
2128
    if -f $path_current_test_log;
2105
 
  mtr_appendfile_to_file($path_timefile, $path_drizzletest_log)
 
2129
  mtr_appendfile_to_file($path_timefile, $path_mysqltest_log)
2106
2130
    if -f $path_timefile;
2107
2131
}
2108
2132
 
2131
2155
  # Set default message
2132
2156
  $tinfo->{'comment'}= "Detected by testcase(no log file)";
2133
2157
 
2134
 
  # Open drizzletest-time(the drizzletest log file)
 
2158
  # Open mysqltest-time(the mysqltest log file)
2135
2159
  my $F= IO::File->new($path_timefile)
2136
2160
    or return;
2137
2161
  my $reason;
2222
2246
  }
2223
2247
 
2224
2248
  {
2225
 
    do_before_run_drizzletest($tinfo);
 
2249
    do_before_run_mysqltest($tinfo);
2226
2250
 
2227
 
    my $res= run_drizzletest($tinfo);
 
2251
    my $res= run_mysqltest($tinfo);
2228
2252
    mtr_report_test_name($tinfo);
2229
2253
 
2230
 
    do_after_run_drizzletest($tinfo);
 
2254
    do_after_run_mysqltest($tinfo);
2231
2255
 
2232
2256
    if ( $res == 0 )
2233
2257
    {
2237
2261
    {
2238
2262
      # Testcase itself tell us to skip this one
2239
2263
 
2240
 
      # Try to get reason from drizzletest.log
 
2264
      # Try to get reason from mysqltest.log
2241
2265
      find_testcase_skipped_reason($tinfo);
2242
2266
      mtr_report_test_skipped($tinfo);
2243
2267
    }
2248
2272
    }
2249
2273
    elsif ( $res == 1 )
2250
2274
    {
2251
 
      # Test case failure reported by drizzletest
 
2275
      # Test case failure reported by mysqltest
2252
2276
      report_failure_and_restart($tinfo);
2253
2277
    }
2254
2278
    else
2255
2279
    {
2256
 
      # drizzletest failed, probably crashed
 
2280
      # mysqltest failed, probably crashed
2257
2281
      $tinfo->{comment}=
2258
 
        "drizzletest returned unexpected code $res, it has probably crashed";
 
2282
        "mysqltest returned unexpected code $res, it has probably crashed";
2259
2283
      report_failure_and_restart($tinfo);
2260
2284
    }
2261
2285
  }
2262
2286
 
2263
 
  # Remove the file that drizzletest writes info to
 
2287
  # Remove the file that mysqltest writes info to
2264
2288
  unlink($path_timefile);
2265
2289
 
2266
2290
  # ----------------------------------------------------------------------
2461
2485
    $sidx= $idx;
2462
2486
  }
2463
2487
 
2464
 
  my $prefix= "";               # If drizzletest server arg
 
2488
  my $prefix= "";               # If mysqltest server arg
2465
2489
 
2466
2490
  mtr_add_arg($args, "%s--no-defaults", $prefix);
2467
2491
 
2468
2492
  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
 
  }
 
2493
  mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir);
2474
2494
 
2475
2495
  if ( $mysql_version_id >= 50036)
2476
2496
  {
2478
2498
    mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir);
2479
2499
  }
2480
2500
 
 
2501
  if ( $mysql_version_id >= 50000 )
 
2502
  {
 
2503
    mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
 
2504
  }
 
2505
 
 
2506
  mtr_add_arg($args, "%s--default-character-set=latin1", $prefix);
 
2507
  mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
2481
2508
  mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
2482
2509
 
2483
2510
  # Increase default connect_timeout to avoid intermittent
2502
2529
  mtr_add_arg($args, "%s--datadir=%s", $prefix,
2503
2530
              $mysqld->{'path_myddir'});
2504
2531
 
 
2532
 
 
2533
  if ( $mysql_version_id >= 50106 )
 
2534
  {
 
2535
    # Turn on logging to bothe tables and file
 
2536
    mtr_add_arg($args, "%s--log-output=table,file", $prefix);
 
2537
  }
 
2538
 
2505
2539
  my $log_base_path= "$opt_vardir/log/$mysqld->{'type'}$sidx";
2506
2540
  mtr_add_arg($args, "%s--log=%s.log", $prefix, $log_base_path);
 
2541
  mtr_add_arg($args,
 
2542
              "%s--log-slow-queries=%s-slow.log", $prefix, $log_base_path);
2507
2543
 
2508
2544
  # Check if "extra_opt" contains --skip-log-bin
2509
2545
  my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt, @opt_extra_mysqld_opt);
3060
3096
  mtr_add_arg($args, "--no-defaults");
3061
3097
  mtr_add_arg($args, "--silent");
3062
3098
  mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
 
3099
  mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
3063
3100
 
3064
3101
  mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
3065
3102
  mtr_add_arg($args, "--database=test");
3074
3111
    mtr_add_arg($args, "--record");
3075
3112
  }
3076
3113
 
3077
 
  my $res = mtr_run_test($exe_drizzletest,$args,
 
3114
  my $res = mtr_run_test($exe_mysqltest,$args,
3078
3115
                "include/check-testcase.test", "", "", "");
3079
3116
 
3080
3117
  if ( $res == 1  and $mode eq "after")
3120
3157
  $tinfo->{'slave_opt'} = [];
3121
3158
  $tinfo->{'slave_mi'} = [];
3122
3159
  $tinfo->{'comment'} = 'report server features';
3123
 
  run_drizzletest($tinfo);
 
3160
  run_mysqltest($tinfo);
3124
3161
 
3125
3162
  {
3126
3163
    stop_all_servers();
3128
3165
}
3129
3166
 
3130
3167
 
3131
 
sub run_drizzletest ($) {
 
3168
sub run_mysqltest ($) {
3132
3169
  my ($tinfo)= @_;
3133
 
  my $exe= $exe_drizzletest;
 
3170
  my $exe= $exe_mysqltest;
3134
3171
  my $args;
3135
3172
 
3136
3173
  mtr_init_args(\$args);
3138
3175
  mtr_add_arg($args, "--no-defaults");
3139
3176
  mtr_add_arg($args, "--silent");
3140
3177
  mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
 
3178
  mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
3141
3179
  mtr_add_arg($args, "--logdir=%s/log", $opt_vardir);
3142
3180
 
3143
3181
  # Log line number and time  for each line in .test file
3155
3193
  {
3156
3194
    $exe=  "strace";            # FIXME there are ktrace, ....
3157
3195
    mtr_add_arg($args, "-o");
3158
 
    mtr_add_arg($args, "%s/log/drizzletest.strace", $opt_vardir);
3159
 
    mtr_add_arg($args, "$exe_drizzletest");
 
3196
    mtr_add_arg($args, "%s/log/mysqltest.strace", $opt_vardir);
 
3197
    mtr_add_arg($args, "$exe_mysqltest");
3160
3198
  }
3161
3199
 
3162
3200
  if ( $opt_timer )
3176
3214
 
3177
3215
  if ( $opt_debug )
3178
3216
  {
3179
 
    mtr_add_arg($args, "--debug=d:t:A,%s/log/drizzletest.trace",
 
3217
    mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace",
3180
3218
                $path_vardir_trace);
3181
3219
  }
3182
3220
 
3183
3221
  # ----------------------------------------------------------------------
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 )
 
3222
  # export MYSQL_TEST variable containing <path>/mysqltest <args>
 
3223
  # ----------------------------------------------------------------------
 
3224
  $ENV{'MYSQL_TEST'}=
 
3225
    mtr_native_path($exe_mysqltest) . " " . join(" ", @$args);
 
3226
 
 
3227
  # ----------------------------------------------------------------------
 
3228
  # Add arguments that should not go into the MYSQL_TEST env var
 
3229
  # ----------------------------------------------------------------------
 
3230
 
 
3231
  if ( $opt_valgrind_mysqltest )
3194
3232
  {
3195
3233
    # Prefix the Valgrind options to the argument list.
3196
3234
    # 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.
 
3235
    # of mysqltest; that would mess up the stderr output causing test failure.
3198
3236
    my @args_saved = @$args;
3199
3237
    mtr_init_args(\$args);
3200
3238
    valgrind_arguments($args, \$exe);
3566
3604
 
3567
3605
Options for debugging the product
3568
3606
 
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
 
3607
  client-ddd            Start mysqltest client in ddd
 
3608
  client-debugger=NAME  Start mysqltest in the selected debugger
 
3609
  client-gdb            Start mysqltest client in gdb
3572
3610
  ddd                   Start mysqld in ddd
3573
3611
  debug                 Dump trace output for all servers and client programs
3574
3612
  debugger=NAME         Start mysqld in the selected debugger
3581
3619
                        test(s)
3582
3620
  master-binary=PATH    Specify the master "mysqld" to use
3583
3621
  slave-binary=PATH     Specify the slave "mysqld" to use
3584
 
  strace-client         Create strace output for drizzletest client
 
3622
  strace-client         Create strace output for mysqltest client
3585
3623
  max-save-core         Limit the number of core files saved (to avoid filling
3586
3624
                        up disks for heavily crashing server). Defaults to
3587
3625
                        $opt_max_save_core, set to 0 for no limit.
3589
3627
Options for coverage, profiling etc
3590
3628
 
3591
3629
  gcov                  FIXME
3592
 
  gprof                 See online documentation on how to use it.
3593
 
  valgrind              Run the "drizzletest" and "mysqld" executables using
 
3630
  gprof                 FIXME
 
3631
  valgrind              Run the "mysqltest" and "mysqld" executables using
3594
3632
                        valgrind with default options
3595
3633
  valgrind-all          Synonym for --valgrind
3596
 
  valgrind-drizzletest    Run the "drizzletest" and "drizzle_client_test" executable
 
3634
  valgrind-mysqltest    Run the "mysqltest" and "mysql_client_test" executable
3597
3635
                        with valgrind
3598
3636
  valgrind-mysqld       Run the "mysqld" executable with valgrind
3599
3637
  valgrind-options=ARGS Deprecated, use --valgrind-option
3620
3658
  suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout)
3621
3659
  warnings | log-warnings Pass --log-warnings to mysqld
3622
3660
 
3623
 
  sleep=SECONDS         Passed to drizzletest, will be used as fixed sleep time
 
3661
  sleep=SECONDS         Passed to mysqltest, will be used as fixed sleep time
3624
3662
 
3625
3663
HERE
3626
3664
  mtr_exit(1);