~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/test-run.pl

  • Committer: Monty Taylor
  • Date: 2008-08-04 19:37:18 UTC
  • mto: (261.2.2 codestyle)
  • mto: This revision was merged to the branch mainline in revision 262.
  • Revision ID: monty@inaugust.com-20080804193718-f0rz13uli4429ozb
Changed gettext_noop() to N_()

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/perl
2
2
# -*- cperl -*-
3
3
 
4
 
use utf8;
5
 
 
6
4
#
7
5
##############################################################################
8
6
#
10
8
#
11
9
#  Tool used for executing a suite of .test file
12
10
#
13
 
#  For now, see the "MySQL Test framework manual" for more information
14
 
#  http://dev.mysql.com/doc/mysqltest/en/index.html
15
 
#  (as the Drizzle test environment is currently still fairly similar)
 
11
#  See the "MySQL Test framework manual" for more information
 
12
#  http://dev.mysql.com/doc/drizzletest/en/index.html
16
13
#
17
14
#  Please keep the test framework tools identical in all versions!
18
15
#
106
103
 
107
104
our $glob_basedir;
108
105
 
 
106
our $path_charsetsdir;
109
107
our $path_client_bindir;
 
108
our $path_share;
110
109
our $path_timefile;
111
110
our $path_snapshot;
112
111
our $path_drizzletest_log;
129
128
our $exe_master_mysqld;
130
129
our $exe_drizzle;
131
130
our $exe_drizzleadmin;
 
131
our $exe_drizzlebinlog;
132
132
our $exe_drizzle_client_test;
133
133
our $exe_bug25714;
134
134
our $exe_drizzled;
135
135
our $exe_drizzlecheck;
136
136
our $exe_drizzledump;
137
 
our $exe_drizzleslap;
 
137
our $exe_mysqlslap;
138
138
our $exe_drizzleimport;
139
139
our $exe_drizzle_fix_system_tables;
140
140
our $exe_drizzletest;
159
159
our $opt_debug;
160
160
our $opt_do_test;
161
161
our @opt_cases;                  # The test cases names in argv
162
 
our $opt_engine;
163
162
 
164
163
our $opt_extern= 0;
165
164
our $opt_socket;
488
487
 
489
488
             # Extra options used when starting mysqld
490
489
             'mysqld=s'                 => \@opt_extra_mysqld_opt,
491
 
             'engine=s'                 => \$opt_engine,
492
490
 
493
491
             # Run test on running server
494
492
             'extern'                   => \$opt_extern,
637
635
  $path_client_bindir= mtr_path_exists("$glob_basedir/client",
638
636
                                       "$glob_basedir/bin");
639
637
 
 
638
  # Look for charsetsdir, use same share
 
639
  $path_share=      mtr_path_exists("$glob_basedir/share/mysql",
 
640
                                    "$glob_basedir/drizzled/share",
 
641
                                    "$glob_basedir/share");
 
642
 
 
643
  $path_charsetsdir=   mtr_path_exists("$path_share/charsets");
 
644
 
 
645
 
 
646
 
640
647
  if (!$opt_extern)
641
648
  {
642
649
    $exe_drizzled=       mtr_exe_exists ("$glob_basedir/drizzled/drizzled",
653
660
    $mysqld_variables{'port'}= 4427;
654
661
  }
655
662
 
656
 
  if (!$opt_engine)
657
 
  {
658
 
    $opt_engine= "innodb";
659
 
  }
660
 
 
661
663
  if ( $opt_comment )
662
664
  {
663
665
    print "\n";
1241
1243
  $exe_drizzlecheck= mtr_exe_exists("$path_client_bindir/drizzlecheck");
1242
1244
  $exe_drizzledump= mtr_exe_exists("$path_client_bindir/drizzledump");
1243
1245
  $exe_drizzleimport= mtr_exe_exists("$path_client_bindir/drizzleimport");
 
1246
  $exe_drizzlebinlog= mtr_exe_exists("$path_client_bindir/drizzlebinlog");
1244
1247
  $exe_drizzleadmin= mtr_exe_exists("$path_client_bindir/drizzleadmin");
1245
1248
  $exe_drizzle=          mtr_exe_exists("$path_client_bindir/drizzle");
1246
1249
 
1247
1250
  if (!$opt_extern)
1248
1251
  {
1249
1252
# Look for SQL scripts directory
1250
 
     if ( $mysql_version_id >= 50100 )
1251
 
     {
1252
 
         $exe_drizzleslap= mtr_exe_exists("$path_client_bindir/drizzleslap");
1253
 
     }
 
1253
    if ( $mysql_version_id >= 50100 )
 
1254
    {
 
1255
      $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
 
1256
    }
1254
1257
  }
1255
1258
 
1256
1259
# Look for drizzletest executable
1392
1395
  # Also command lines in .opt files may contain env vars
1393
1396
  # --------------------------------------------------------------------------
1394
1397
 
1395
 
  $ENV{'CHARSETSDIR'}=              "";
 
1398
  $ENV{'CHARSETSDIR'}=              $path_charsetsdir;
1396
1399
  $ENV{'UMASK'}=              "0660"; # The octal *string*
1397
1400
  $ENV{'UMASK_DIR'}=          "0770"; # The octal *string*
1398
1401
  
1409
1412
  
1410
1413
  $ENV{'LC_COLLATE'}=         "C";
1411
1414
  $ENV{'USE_RUNNING_SERVER'}= $opt_extern;
1412
 
  $ENV{'DRIZZLE_TEST_DIR'}=     $glob_mysql_test_dir;
 
1415
  $ENV{'MYSQL_TEST_DIR'}=     $glob_mysql_test_dir;
1413
1416
  $ENV{'MYSQLTEST_VARDIR'}=   $opt_vardir;
1414
 
  $ENV{'DRIZZLE_TMP_DIR'}=      $opt_tmpdir;
 
1417
  $ENV{'MYSQL_TMP_DIR'}=      $opt_tmpdir;
1415
1418
  $ENV{'MASTER_MYSOCK'}=      $master->[0]->{'path_sock'};
1416
1419
  $ENV{'MASTER_MYSOCK1'}=     $master->[1]->{'path_sock'};
1417
1420
  $ENV{'MASTER_MYPORT'}=      $master->[0]->{'port'};
1420
1423
  $ENV{'SLAVE_MYPORT'}=       $slave->[0]->{'port'};
1421
1424
  $ENV{'SLAVE_MYPORT1'}=      $slave->[1]->{'port'};
1422
1425
  $ENV{'SLAVE_MYPORT2'}=      $slave->[2]->{'port'};
1423
 
  $ENV{'DRIZZLE_TCP_PORT'}=     $mysqld_variables{'port'};
 
1426
  $ENV{'MYSQL_TCP_PORT'}=     $mysqld_variables{'port'};
1424
1427
 
1425
1428
  $ENV{MTR_BUILD_THREAD}=      $opt_mtr_build_thread;
1426
1429
 
1439
1442
    $cmdline_mysqlcheck .=
1440
1443
      " --debug=d:t:A,$path_vardir_trace/log/mysqlcheck.trace";
1441
1444
  }
1442
 
  $ENV{'DRIZZLE_CHECK'}=              $cmdline_mysqlcheck;
 
1445
  $ENV{'MYSQL_CHECK'}=              $cmdline_mysqlcheck;
1443
1446
 
1444
1447
  # ----------------------------------------------------
1445
1448
  # Setup env to childs can execute myqldump
1454
1457
    $cmdline_mysqldumpslave .=
1455
1458
      " --debug=d:t:A,$path_vardir_trace/log/mysqldump-slave.trace";
1456
1459
  }
1457
 
  $ENV{'DRIZZLE_DUMP'}= $cmdline_mysqldump;
1458
 
  $ENV{'DRIZZLE_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
 
1460
  $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
 
1461
  $ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
 
1462
 
1459
1463
 
1460
1464
  # ----------------------------------------------------
1461
1465
  # Setup env so childs can execute mysqlslap
1462
1466
  # ----------------------------------------------------
1463
 
  if ( $exe_drizzleslap )
 
1467
  if ( $exe_mysqlslap )
1464
1468
  {
1465
 
    my $cmdline_drizzleslap=
1466
 
      mtr_native_path($exe_drizzleslap) .
 
1469
    my $cmdline_mysqlslap=
 
1470
      mtr_native_path($exe_mysqlslap) .
1467
1471
      " -uroot " .
1468
1472
      "--port=$master->[0]->{'port'} ";
1469
1473
 
1470
1474
    if ( $opt_debug )
1471
1475
   {
1472
 
      $cmdline_drizzleslap .=
1473
 
        " --debug=d:t:A,$path_vardir_trace/log/drizzleslap.trace";
 
1476
      $cmdline_mysqlslap .=
 
1477
        " --debug=d:t:A,$path_vardir_trace/log/mysqlslap.trace";
1474
1478
    }
1475
 
    $ENV{'DRIZZLE_SLAP'}= $cmdline_drizzleslap;
 
1479
    $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap;
1476
1480
  }
1477
1481
 
1478
 
 
1479
 
 
1480
1482
  # ----------------------------------------------------
1481
1483
  # Setup env so childs can execute mysqlimport
1482
1484
  # ----------------------------------------------------
1490
1492
    $cmdline_mysqlimport .=
1491
1493
      " --debug=d:t:A,$path_vardir_trace/log/mysqlimport.trace";
1492
1494
  }
1493
 
  $ENV{'DRIZZLE_IMPORT'}= $cmdline_mysqlimport;
1494
 
 
 
1495
  $ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
 
1496
 
 
1497
 
 
1498
  # ----------------------------------------------------
 
1499
  # Setup env so childs can execute mysqlbinlog
 
1500
  # ----------------------------------------------------
 
1501
  my $cmdline_mysqlbinlog=
 
1502
    mtr_native_path($exe_drizzlebinlog) .
 
1503
      " --no-defaults --disable-force-if-open --debug-check";
 
1504
  if ( !$opt_extern && $mysql_version_id >= 50000 )
 
1505
  {
 
1506
    $cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
 
1507
  }
 
1508
 
 
1509
  if ( $opt_debug )
 
1510
  {
 
1511
    $cmdline_mysqlbinlog .=
 
1512
      " --debug=d:t:A,$path_vardir_trace/log/mysqlbinlog.trace";
 
1513
  }
 
1514
  $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
1495
1515
 
1496
1516
  # ----------------------------------------------------
1497
1517
  # Setup env so childs can execute mysql
1499
1519
  my $cmdline_mysql=
1500
1520
    mtr_native_path($exe_drizzle) .
1501
1521
    " --no-defaults --debug-check --host=localhost  --user=root --password= " .
1502
 
    "--port=$master->[0]->{'port'} ";
 
1522
    "--port=$master->[0]->{'port'} " .
 
1523
    "--character-sets-dir=$path_charsetsdir";
1503
1524
 
1504
1525
  $ENV{'MYSQL'}= $cmdline_mysql;
1505
1526
 
1506
1527
  # ----------------------------------------------------
1507
1528
  # Setup env so childs can execute bug25714
1508
1529
  # ----------------------------------------------------
1509
 
  $ENV{'DRIZZLE_BUG25714'}=  $exe_bug25714;
 
1530
  $ENV{'MYSQL_BUG25714'}=  $exe_bug25714;
1510
1531
 
1511
1532
  # ----------------------------------------------------
1512
1533
  # Setup env so childs can execute drizzle_client_test
1513
1534
  # ----------------------------------------------------
1514
 
  $ENV{'DRIZZLE_CLIENT_TEST'}=  drizzle_client_test_arguments();
 
1535
  $ENV{'MYSQL_CLIENT_TEST'}=  drizzle_client_test_arguments();
1515
1536
 
1516
1537
 
1517
1538
  # ----------------------------------------------------
1525
1546
      "--user=root --password= " .
1526
1547
      "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
1527
1548
      "--port=$master->[0]->{'port'} ";
1528
 
    $ENV{'DRIZZLE_FIX_SYSTEM_TABLES'}=  $cmdline_mysql_fix_system_tables;
 
1549
    $ENV{'MYSQL_FIX_SYSTEM_TABLES'}=  $cmdline_mysql_fix_system_tables;
1529
1550
 
1530
1551
  }
1531
1552
 
1532
1553
  # ----------------------------------------------------
1533
1554
  # Setup env so childs can execute my_print_defaults
1534
1555
  # ----------------------------------------------------
1535
 
  $ENV{'DRIZZLE_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults);
 
1556
  $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults);
1536
1557
 
1537
1558
  # ----------------------------------------------------
1538
1559
  # Setup env so childs can execute mysqladmin
1797
1818
  # the file will not return 0000
1798
1819
  my $file_mode= (stat($test_file))[2] & 07777;
1799
1820
 
1800
 
  $ENV{'DRIZZLE_TEST_ROOT'}= "NO";
 
1821
  $ENV{'MYSQL_TEST_ROOT'}= "NO";
1801
1822
  mtr_verbose("result: $result, file_mode: $file_mode");
1802
1823
  if ($result eq "MySQL" && $file_mode == 0)
1803
1824
  {
1804
1825
    mtr_warning("running this script as _root_ will cause some " .
1805
1826
                "tests to be skipped");
1806
 
    $ENV{'DRIZZLE_TEST_ROOT'}= "YES";
 
1827
    $ENV{'MYSQL_TEST_ROOT'}= "YES";
1807
1828
  }
1808
1829
 
1809
1830
  chmod(oct("0755"), $test_file);
2468
2489
  mtr_add_arg($args, "%s--no-defaults", $prefix);
2469
2490
 
2470
2491
  mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir);
2471
 
 
2472
 
  if ($opt_engine)
2473
 
  {
2474
 
    mtr_add_arg($args, "%s--default-storage-engine=%s", $prefix, $opt_engine);
2475
 
  }
 
2492
  mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir);
2476
2493
 
2477
2494
  if ( $mysql_version_id >= 50036)
2478
2495
  {
2480
2497
    mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir);
2481
2498
  }
2482
2499
 
 
2500
  if ( $mysql_version_id >= 50000 )
 
2501
  {
 
2502
    mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
 
2503
  }
 
2504
 
 
2505
  mtr_add_arg($args, "%s--default-character-set=latin1", $prefix);
2483
2506
  mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
2484
2507
 
2485
2508
  # Increase default connect_timeout to avoid intermittent
2506
2529
 
2507
2530
  my $log_base_path= "$opt_vardir/log/$mysqld->{'type'}$sidx";
2508
2531
  mtr_add_arg($args, "%s--log=%s.log", $prefix, $log_base_path);
 
2532
  mtr_add_arg($args,
 
2533
              "%s--log-slow-queries=%s-slow.log", $prefix, $log_base_path);
2509
2534
 
2510
2535
  # Check if "extra_opt" contains --skip-log-bin
2511
2536
  my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt, @opt_extra_mysqld_opt);
2548
2573
    mtr_add_arg($args, "%s--relay-log=%s/log/slave%s-relay-bin", $prefix,
2549
2574
                $opt_vardir, $sidx);
2550
2575
    mtr_add_arg($args, "%s--report-host=127.0.0.1", $prefix);
 
2576
    mtr_add_arg($args, "%s--report-port=%d", $prefix,
 
2577
                $mysqld->{'port'});
 
2578
#    mtr_add_arg($args, "%s--report-user=root", $prefix);
2551
2579
    mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
2552
2580
    mtr_add_arg($args, "%s--skip-slave-start", $prefix);
2553
2581
 
3059
3087
  mtr_add_arg($args, "--no-defaults");
3060
3088
  mtr_add_arg($args, "--silent");
3061
3089
  mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
 
3090
  mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
3062
3091
 
3063
3092
  mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
3064
3093
  mtr_add_arg($args, "--database=test");
3137
3166
  mtr_add_arg($args, "--no-defaults");
3138
3167
  mtr_add_arg($args, "--silent");
3139
3168
  mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
 
3169
  mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
3140
3170
  mtr_add_arg($args, "--logdir=%s/log", $opt_vardir);
3141
3171
 
3142
3172
  # Log line number and time  for each line in .test file
3180
3210
  }
3181
3211
 
3182
3212
  # ----------------------------------------------------------------------
3183
 
  # export DRIZZLE_TEST variable containing <path>/drizzletest <args>
 
3213
  # export MYSQL_TEST variable containing <path>/drizzletest <args>
3184
3214
  # ----------------------------------------------------------------------
3185
 
  $ENV{'DRIZZLE_TEST'}=
 
3215
  $ENV{'MYSQL_TEST'}=
3186
3216
    mtr_native_path($exe_drizzletest) . " " . join(" ", @$args);
3187
3217
 
3188
3218
  # ----------------------------------------------------------------------
3189
 
  # Add arguments that should not go into the DRIZZLE_TEST env var
 
3219
  # Add arguments that should not go into the MYSQL_TEST env var
3190
3220
  # ----------------------------------------------------------------------
3191
3221
 
3192
3222
  if ( $opt_valgrind_drizzletest )