~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/test-run.pl

  • Committer: Jay Pipes
  • Date: 2008-07-21 17:52:33 UTC
  • mto: (201.2.1 drizzle)
  • mto: This revision was merged to the branch mainline in revision 204.
  • Revision ID: jay@mysql.com-20080721175233-mtyz298j8xl3v63y
cleanup of FAQ file

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
12
 
#  http://dev.mysql.com/doc/mysqltest/en/index.html
13
 
#  (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
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
112
our $path_drizzletest_log;
127
129
our $exe_master_mysqld;
128
130
our $exe_drizzle;
129
131
our $exe_drizzleadmin;
 
132
our $exe_drizzlebinlog;
130
133
our $exe_drizzle_client_test;
131
134
our $exe_bug25714;
132
135
our $exe_drizzled;
133
136
our $exe_drizzlecheck;
134
137
our $exe_drizzledump;
135
 
our $exe_drizzleslap;
 
138
our $exe_mysqlslap;
136
139
our $exe_drizzleimport;
137
140
our $exe_drizzle_fix_system_tables;
138
141
our $exe_drizzletest;
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;
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,
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_drizzled=       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";
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_drizzled --no-defaults --datadir=$tmpdir --language=$path_language --skip-grant-tables --verbose --help`;
1118
1123
 
1119
1124
  foreach my $line (split('\n', $list))
1120
1125
  {
1239
1244
  $exe_drizzlecheck= mtr_exe_exists("$path_client_bindir/drizzlecheck");
1240
1245
  $exe_drizzledump= mtr_exe_exists("$path_client_bindir/drizzledump");
1241
1246
  $exe_drizzleimport= mtr_exe_exists("$path_client_bindir/drizzleimport");
 
1247
  $exe_drizzlebinlog= mtr_exe_exists("$path_client_bindir/drizzlebinlog");
1242
1248
  $exe_drizzleadmin= mtr_exe_exists("$path_client_bindir/drizzleadmin");
1243
1249
  $exe_drizzle=          mtr_exe_exists("$path_client_bindir/drizzle");
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
1260
# Look for drizzletest executable
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
 
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
  # ----------------------------------------------------
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_drizzlebinlog) .
 
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
1497
1520
  my $cmdline_mysql=
1498
1521
    mtr_native_path($exe_drizzle) .
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
1534
  # Setup env so childs can execute drizzle_client_test
1511
1535
  # ----------------------------------------------------
1512
 
  $ENV{'DRIZZLE_CLIENT_TEST'}=  drizzle_client_test_arguments();
 
1536
  $ENV{'MYSQL_CLIENT_TEST'}=  drizzle_client_test_arguments();
1513
1537
 
1514
1538
 
1515
1539
  # ----------------------------------------------------
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
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);
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");
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
3181
3219
  }
3182
3220
 
3183
3221
  # ----------------------------------------------------------------------
3184
 
  # export DRIZZLE_TEST variable containing <path>/drizzletest <args>
 
3222
  # export MYSQL_TEST variable containing <path>/drizzletest <args>
3185
3223
  # ----------------------------------------------------------------------
3186
 
  $ENV{'DRIZZLE_TEST'}=
 
3224
  $ENV{'MYSQL_TEST'}=
3187
3225
    mtr_native_path($exe_drizzletest) . " " . join(" ", @$args);
3188
3226
 
3189
3227
  # ----------------------------------------------------------------------
3190
 
  # Add arguments that should not go into the DRIZZLE_TEST env var
 
3228
  # Add arguments that should not go into the MYSQL_TEST env var
3191
3229
  # ----------------------------------------------------------------------
3192
3230
 
3193
3231
  if ( $opt_valgrind_drizzletest )