456
534
Getopt::Long::Configure("pass_through");
458
536
# Control what engine/variation to run
537
'embedded-server' => \$opt_embedded_server,
538
'ps-protocol' => \$opt_ps_protocol,
539
'sp-protocol' => \$opt_sp_protocol,
540
'view-protocol' => \$opt_view_protocol,
541
'cursor-protocol' => \$opt_cursor_protocol,
542
'ssl|with-openssl' => \$opt_ssl,
543
'skip-ssl' => \$opt_skip_ssl,
459
544
'compress' => \$opt_compress,
460
545
'bench' => \$opt_bench,
461
546
'small-bench' => \$opt_small_bench,
547
'with-ndbcluster|ndb' => \$opt_with_ndbcluster,
548
'vs-config' => \$opt_vs_config,
463
550
# Control what test suites or cases to run
464
551
'force' => \$opt_force,
552
'with-ndbcluster-only' => \$opt_with_ndbcluster_only,
553
'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster,
554
'skip-ndbcluster-slave|skip-ndb-slave'
555
=> \$opt_skip_ndbcluster_slave,
556
'ndb-extra-test' => \$opt_ndb_extra_test,
465
557
'skip-master-binlog' => \$opt_skip_master_binlog,
466
558
'skip-slave-binlog' => \$opt_skip_slave_binlog,
467
559
'do-test=s' => \$opt_do_test,
625
727
$glob_timers= mtr_init_timers();
729
# --------------------------------------------------------------------------
730
# Embedded server flag
731
# --------------------------------------------------------------------------
732
if ( $opt_embedded_server )
734
$glob_use_embedded_server= 1;
735
# Add the location for libmysqld.dll to the path.
739
mtr_path_exists(vs_config_dirs('libmysqld',''));
740
$lib_mysqld= $glob_cygwin_perl ? ":".`cygpath "$lib_mysqld"`
743
$ENV{'PATH'}="$ENV{'PATH'}".$lib_mysqld;
746
push(@glob_test_mode, "embedded");
747
$opt_skip_rpl= 1; # We never run replication with embedded
748
$opt_skip_ndbcluster= 1; # Turn off use of NDB cluster
749
$opt_skip_ssl= 1; # Turn off use of SSL
751
# Turn off use of bin log
752
push(@opt_extra_mysqld_opt, "--skip-log-bin");
756
mtr_error("Can't use --extern with --embedded-server");
628
761
# Find the mysqld executable to be able to find the mysqld version
629
762
# number as early as possible
632
765
# Look for the client binaries directory
633
$path_client_bindir= mtr_path_exists("$glob_basedir/client",
766
$path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
767
"$glob_basedir/client_debug",
768
vs_config_dirs('client', ''),
769
"$glob_basedir/client",
634
770
"$glob_basedir/bin");
772
# Look for language files and charsetsdir, use same share
773
$path_share= mtr_path_exists("$glob_basedir/share/mysql",
774
"$glob_basedir/sql/share",
775
"$glob_basedir/share");
777
$path_language= mtr_path_exists("$path_share/english");
778
$path_charsetsdir= mtr_path_exists("$path_share/charsets");
636
781
if (!$opt_extern)
638
$exe_drizzled= mtr_exe_exists ("$glob_basedir/drizzled/drizzled",
639
"$path_client_bindir/drizzled",
640
"$glob_basedir/libexec/drizzled",
641
"$glob_basedir/bin/drizzled",
642
"$glob_basedir/sbin/drizzled");
783
$exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
784
vs_config_dirs('sql', 'mysqld-debug'),
785
"$glob_basedir/sql/mysqld",
786
"$path_client_bindir/mysqld-max-nt",
787
"$path_client_bindir/mysqld-max",
788
"$path_client_bindir/mysqld-nt",
789
"$path_client_bindir/mysqld",
790
"$path_client_bindir/mysqld-debug",
791
"$path_client_bindir/mysqld-max",
792
"$glob_basedir/libexec/mysqld",
793
"$glob_basedir/bin/mysqld",
794
"$glob_basedir/sbin/mysqld");
644
796
# Use the mysqld found above to find out what features are available
645
797
collect_mysqld_features();
649
$mysqld_variables{'port'}= 4427;
801
$mysqld_variables{'port'}= 3306;
652
804
if ( $opt_comment )
1016
$path_timefile= "$opt_vardir/log/drizzletest-time";
1017
$path_drizzletest_log= "$opt_vardir/log/drizzletest.log";
1229
# --------------------------------------------------------------------------
1230
# ndbconnectstring and ndbconnectstring_slave
1231
# --------------------------------------------------------------------------
1232
if ( $opt_ndbconnectstring )
1234
# ndbconnectstring was supplied by user, the tests shoudl be run
1235
# against an already started cluster, change settings
1236
my $cluster= $clusters->[0]; # Master cluster
1237
$cluster->{'connect_string'}= $opt_ndbconnectstring;
1238
$cluster->{'use_running'}= 1;
1240
mtr_error("Can't specify --ndb-connectstring and --skip-ndbcluster")
1241
if $opt_skip_ndbcluster;
1243
$ENV{'NDB_CONNECTSTRING'}= $clusters->[0]->{'connect_string'};
1246
if ( $opt_ndbconnectstring_slave )
1248
# ndbconnectstring-slave was supplied by user, the tests should be run
1249
# agains an already started slave cluster, change settings
1250
my $cluster= $clusters->[1]; # Slave cluster
1251
$cluster->{'connect_string'}= $opt_ndbconnectstring_slave;
1252
$cluster->{'use_running'}= 1;
1254
mtr_error("Can't specify ndb-connectstring_slave and " .
1255
"--skip-ndbcluster-slave")
1256
if $opt_skip_ndbcluster_slave;
1260
$path_timefile= "$opt_vardir/log/mysqltest-time";
1261
$path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
1018
1262
$path_current_test_log= "$opt_vardir/log/current_test";
1263
$path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log";
1020
1265
$path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/";
1222
# Look for my_print_defaults
1507
# Look for my_print_defaults
1223
1508
$exe_my_print_defaults=
1225
"$path_client_bindir/my_print_defaults",
1226
"$glob_basedir/extra/my_print_defaults");
1509
mtr_exe_exists(vs_config_dirs('extra', 'my_print_defaults'),
1510
"$path_client_bindir/my_print_defaults",
1511
"$glob_basedir/extra/my_print_defaults");
1229
1514
$exe_perror= "perror";
1231
# Look for the client binaries
1232
$exe_drizzlecheck= mtr_exe_exists("$path_client_bindir/drizzlecheck");
1233
$exe_drizzledump= mtr_exe_exists("$path_client_bindir/drizzledump");
1234
$exe_drizzleimport= mtr_exe_exists("$path_client_bindir/drizzleimport");
1235
$exe_drizzleadmin= mtr_exe_exists("$path_client_bindir/drizzleadmin");
1236
$exe_drizzle= mtr_exe_exists("$path_client_bindir/drizzle");
1516
# Look for the client binaries
1517
$exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
1518
$exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump");
1519
$exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport");
1520
$exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow");
1521
$exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
1522
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
1523
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
1238
1525
if (!$opt_extern)
1240
# Look for SQL scripts directory
1241
if ( $mysql_version_id >= 50100 )
1243
$exe_drizzleslap= mtr_exe_exists("$path_client_bindir/drizzleslap");
1247
# Look for drizzletest executable
1249
$exe_drizzletest= mtr_exe_exists("$path_client_bindir/drizzletest");
1252
# Look for drizzle_client_test executable which may _not_ exist in
1253
# some versions, test using it should be skipped
1255
$exe_drizzle_client_test=
1527
# Look for SQL scripts directory
1528
if ( $mysql_version_id >= 50100 )
1530
$exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
1534
if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
1536
mtr_warning("Could not find all required ndb binaries, " .
1537
"all ndb tests will fail, use --skip-ndbcluster to " .
1538
"skip testing it.");
1540
foreach my $cluster (@{$clusters})
1542
$cluster->{"executable_setup_failed"}= 1;
1547
# Look for the udf_example library
1549
mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
1550
"$glob_basedir/sql/.libs/udf_example.so",);
1552
# Look for the ha_example library
1553
$lib_example_plugin=
1554
mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
1555
"$glob_basedir/storage/example/.libs/ha_example.so",);
1559
# Look for mysqltest executable
1560
if ( $glob_use_embedded_server )
1563
mtr_exe_exists(vs_config_dirs('libmysqld/examples','mysqltest_embedded'),
1564
"$glob_basedir/libmysqld/examples/mysqltest_embedded",
1565
"$path_client_bindir/mysqltest_embedded");
1569
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
1572
# Look for mysql_client_test executable which may _not_ exist in
1573
# some versions, test using it should be skipped
1574
if ( $glob_use_embedded_server )
1576
$exe_mysql_client_test=
1256
1577
mtr_exe_maybe_exists(
1257
"$glob_basedir/tests/drizzle_client_test",
1258
"$glob_basedir/bin/drizzle_client_test");
1578
vs_config_dirs('libmysqld/examples', 'mysql_client_test_embedded'),
1579
"$glob_basedir/libmysqld/examples/mysql_client_test_embedded");
1583
$exe_mysql_client_test=
1584
mtr_exe_maybe_exists(vs_config_dirs('tests', 'mysql_client_test'),
1585
"$glob_basedir/tests/mysql_client_test",
1586
"$glob_basedir/bin/mysql_client_test");
1261
# Look for bug25714 executable which may _not_ exist in
1262
# some versions, test using it should be skipped
1589
# Look for bug25714 executable which may _not_ exist in
1590
# some versions, test using it should be skipped
1264
mtr_exe_maybe_exists(
1265
"$glob_basedir/tests/bug25714");
1592
mtr_exe_maybe_exists(vs_config_dirs('tests', 'bug25714'),
1593
"$glob_basedir/tests/bug25714");
1270
1597
sub generate_cmdline_mysqldump ($) {
1271
1598
my($mysqld) = @_;
1273
mtr_native_path($exe_drizzledump) .
1600
mtr_native_path($exe_mysqldump) .
1274
1601
" --no-defaults -uroot --debug-check " .
1275
1602
"--port=$mysqld->{'port'} ";
1411
1756
$ENV{'SLAVE_MYPORT'}= $slave->[0]->{'port'};
1412
1757
$ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'port'};
1413
1758
$ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'port'};
1414
$ENV{'DRIZZLE_TCP_PORT'}= $mysqld_variables{'port'};
1759
$ENV{'MYSQL_TCP_PORT'}= $mysqld_variables{'port'};
1416
1761
$ENV{MTR_BUILD_THREAD}= $opt_mtr_build_thread;
1418
$ENV{'EXE_MYSQL'}= $exe_drizzle;
1763
$ENV{'EXE_MYSQL'}= $exe_mysql;
1766
# ----------------------------------------------------
1768
# ----------------------------------------------------
1769
if ( ! $opt_skip_ndbcluster )
1771
$ENV{'NDB_MGM'}= $exe_ndb_mgm;
1773
$ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port;
1774
$ENV{'NDBCLUSTER_PORT_SLAVE'}= $opt_ndbcluster_port_slave;
1776
$ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test;
1778
$ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'};
1779
$ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'};
1780
$ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir;
1781
$ENV{'NDB_TOOLS_OUTPUT'}= $path_ndb_testrun_log;
1783
if ( $mysql_version_id >= 50000 )
1785
$ENV{'NDB_EXAMPLES_DIR'}= $path_ndb_examples_dir;
1786
$ENV{'MY_NDB_EXAMPLES_BINARY'}= $exe_ndb_example;
1788
$ENV{'NDB_EXAMPLES_OUTPUT'}= $path_ndb_testrun_log;
1420
1791
# ----------------------------------------------------
1421
1792
# Setup env so childs can execute mysqlcheck
1422
1793
# ----------------------------------------------------
1423
1794
my $cmdline_mysqlcheck=
1424
mtr_native_path($exe_drizzlecheck) .
1795
mtr_native_path($exe_mysqlcheck) .
1425
1796
" --no-defaults --debug-check -uroot " .
1426
1797
"--port=$master->[0]->{'port'} ";
1481
1851
$cmdline_mysqlimport .=
1482
1852
" --debug=d:t:A,$path_vardir_trace/log/mysqlimport.trace";
1484
$ENV{'DRIZZLE_IMPORT'}= $cmdline_mysqlimport;
1854
$ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
1857
# ----------------------------------------------------
1858
# Setup env so childs can execute mysqlshow
1859
# ----------------------------------------------------
1860
my $cmdline_mysqlshow=
1861
mtr_native_path($exe_mysqlshow) .
1862
" -uroot --debug-check " .
1863
"--port=$master->[0]->{'port'} ";
1867
$cmdline_mysqlshow .=
1868
" --debug=d:t:A,$path_vardir_trace/log/mysqlshow.trace";
1870
$ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
1872
# ----------------------------------------------------
1873
# Setup env so childs can execute mysqlbinlog
1874
# ----------------------------------------------------
1875
my $cmdline_mysqlbinlog=
1876
mtr_native_path($exe_mysqlbinlog) .
1877
" --no-defaults --disable-force-if-open --debug-check";
1878
if ( !$opt_extern && $mysql_version_id >= 50000 )
1880
$cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
1885
$cmdline_mysqlbinlog .=
1886
" --debug=d:t:A,$path_vardir_trace/log/mysqlbinlog.trace";
1888
$ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
1487
1890
# ----------------------------------------------------
1488
1891
# Setup env so childs can execute mysql
1489
1892
# ----------------------------------------------------
1490
1893
my $cmdline_mysql=
1491
mtr_native_path($exe_drizzle) .
1894
mtr_native_path($exe_mysql) .
1492
1895
" --no-defaults --debug-check --host=localhost --user=root --password= " .
1493
"--port=$master->[0]->{'port'} ";
1896
"--port=$master->[0]->{'port'} " .
1897
"--character-sets-dir=$path_charsetsdir";
1495
1899
$ENV{'MYSQL'}= $cmdline_mysql;
1497
1901
# ----------------------------------------------------
1498
1902
# Setup env so childs can execute bug25714
1499
1903
# ----------------------------------------------------
1500
$ENV{'DRIZZLE_BUG25714'}= $exe_bug25714;
1904
$ENV{'MYSQL_BUG25714'}= $exe_bug25714;
1502
1906
# ----------------------------------------------------
1503
# Setup env so childs can execute drizzle_client_test
1907
# Setup env so childs can execute mysql_client_test
1504
1908
# ----------------------------------------------------
1505
$ENV{'DRIZZLE_CLIENT_TEST'}= drizzle_client_test_arguments();
1909
$ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments();
1508
1912
# ----------------------------------------------------
1509
1913
# Setup env so childs can execute mysql_fix_system_tables
1510
1914
# ----------------------------------------------------
1915
#if ( !$opt_extern && ! $glob_win32 )
1514
1918
my $cmdline_mysql_fix_system_tables=
1515
"$exe_drizzle_fix_system_tables --no-defaults --host=localhost " .
1919
"$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
1516
1920
"--user=root --password= " .
1517
1921
"--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
1518
1922
"--port=$master->[0]->{'port'} ";
1519
$ENV{'DRIZZLE_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
1923
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
1523
1927
# ----------------------------------------------------
1524
1928
# Setup env so childs can execute my_print_defaults
1525
1929
# ----------------------------------------------------
1526
$ENV{'DRIZZLE_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults);
1930
$ENV{'MYSQL_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults);
1528
1932
# ----------------------------------------------------
1529
1933
# Setup env so childs can execute mysqladmin
1530
1934
# ----------------------------------------------------
1531
$ENV{'MYSQLADMIN'}= mtr_native_path($exe_drizzleadmin);
1935
$ENV{'MYSQLADMIN'}= mtr_native_path($exe_mysqladmin);
1533
1937
# ----------------------------------------------------
1534
1938
# Setup env so childs can execute perror
1821
2302
$debug_compiled_binaries= 1;
2305
##############################################################################
2307
# Helper function to handle configuration-based subdirectories which Visual
2308
# Studio uses for storing binaries. If opt_vs_config is set, this returns
2309
# a path based on that setting; if not, it returns paths for the default
2310
# /release/ and /debug/ subdirectories.
2312
# $exe can be undefined, if the directory itself will be used
2314
###############################################################################
2316
sub vs_config_dirs ($$) {
2317
my ($path_part, $exe) = @_;
2319
$exe = "" if not defined $exe;
2323
return ("$glob_basedir/$path_part/$opt_vs_config/$exe");
2326
return ("$glob_basedir/$path_part/release/$exe",
2327
"$glob_basedir/$path_part/relwithdebinfo/$exe",
2328
"$glob_basedir/$path_part/debug/$exe");
2331
##############################################################################
2333
# Start the ndb cluster
2335
##############################################################################
2337
sub check_ndbcluster_support ($) {
2338
my $mysqld_variables= shift;
2340
if ($opt_skip_ndbcluster || $opt_extern)
2344
mtr_report("Skipping ndbcluster");
2346
$opt_skip_ndbcluster_slave= 1;
2350
if ( ! $mysqld_variables->{'ndb-connectstring'} )
2352
mtr_report("Skipping ndbcluster, mysqld not compiled with ndbcluster");
2353
$opt_skip_ndbcluster= 1;
2354
$opt_skip_ndbcluster_slave= 1;
2357
$glob_ndbcluster_supported= 1;
2358
mtr_report("Using ndbcluster when necessary, mysqld supports it");
2360
if ( $mysql_version_id < 50100 )
2362
# Slave cluster is not supported until 5.1
2363
$opt_skip_ndbcluster_slave= 1;
2371
sub ndbcluster_start_install ($) {
2374
mtr_report("Installing $cluster->{'name'} Cluster");
2376
mkdir($cluster->{'data_dir'});
2378
# Create a config file from template
2380
my $ndb_no_attr=2048;
2381
my $ndb_con_op=105000;
2384
my $ndb_pbmem="32M";
2385
my $nodes= $cluster->{'nodes'};
2386
my $ndb_host= "localhost";
2387
my $ndb_diskless= 0;
2391
# Use a smaller configuration
2392
if ( $mysql_version_id < 50100 )
2394
# 4.1 and 5.0 is using a "larger" --small configuration
2410
my $config_file_template= "ndb/ndb_config_${nodes}_node.ini";
2411
my $config_file= "$cluster->{'data_dir'}/config.ini";
2413
open(IN, $config_file_template)
2414
or mtr_error("Can't open $config_file_template: $!");
2415
open(OUT, ">", $config_file)
2416
or mtr_error("Can't write to $config_file: $!");
2421
s/CHOOSE_MaxNoOfAttributes/$ndb_no_attr/;
2422
s/CHOOSE_MaxNoOfOrderedIndexes/$ndb_no_ord/;
2423
s/CHOOSE_MaxNoOfConcurrentOperations/$ndb_con_op/;
2424
s/CHOOSE_DataMemory/$ndb_dmem/;
2425
s/CHOOSE_IndexMemory/$ndb_imem/;
2426
s/CHOOSE_Diskless/$ndb_diskless/;
2427
s/CHOOSE_HOSTNAME_.*/$ndb_host/;
2428
s/CHOOSE_FILESYSTEM/$cluster->{'data_dir'}/;
2429
s/CHOOSE_PORT_MGM/$cluster->{'port'}/;
2430
if ( $mysql_version_id < 50000 )
2432
my $base_port= $cluster->{'port'} + 1;
2433
s/CHOOSE_PORT_TRANSPORTER/$base_port/;
2435
s/CHOOSE_DiskPageBufferMemory/$ndb_pbmem/;
2443
# Start cluster with "--initial"
2445
ndbcluster_start($cluster, "--initial");
2451
sub ndbcluster_wait_started($$){
2453
my $ndb_waiter_extra_opt= shift;
2454
my $path_waiter_log= "$cluster->{'data_dir'}/ndb_waiter.log";
2457
mtr_init_args(\$args);
2459
mtr_add_arg($args, "--no-defaults");
2460
mtr_add_arg($args, "--core");
2461
mtr_add_arg($args, "--ndb-connectstring=%s", $cluster->{'connect_string'});
2462
mtr_add_arg($args, "--timeout=60");
2464
if ($ndb_waiter_extra_opt)
2466
mtr_add_arg($args, "$ndb_waiter_extra_opt");
2469
# Start the ndb_waiter which will connect to the ndb_mgmd
2470
# and poll it for state of the ndbd's, will return when
2471
# all nodes in the cluster is started
2472
my $res= mtr_run($exe_ndb_waiter, $args,
2473
"", $path_waiter_log, $path_waiter_log, "");
2474
mtr_verbose("ndbcluster_wait_started, returns: $res") if $res;
2480
sub mysqld_wait_started($){
2483
if (sleep_until_file_created($mysqld->{'path_pid'},
2484
$mysqld->{'start_timeout'},
2485
$mysqld->{'pid'}) == 0)
2487
# Failed to wait for pid file
2491
# Get the "real pid" of the process, it will be used for killing
2492
# the process in ActiveState's perl on windows
2493
$mysqld->{'real_pid'}= mtr_get_pid_from_file($mysqld->{'path_pid'});
2499
sub ndb_mgmd_wait_started($) {
2503
while (ndbcluster_wait_started($cluster, "--no-contact") and
2506
# Millisceond sleep emulated with select
2507
select(undef, undef, undef, (0.1));
2512
return $retries == 0;
2516
sub ndb_mgmd_start ($) {
2519
my $args; # Arg vector
2522
mtr_init_args(\$args);
2523
mtr_add_arg($args, "--no-defaults");
2524
mtr_add_arg($args, "--core");
2525
mtr_add_arg($args, "--nodaemon");
2526
mtr_add_arg($args, "--config-file=%s", "$cluster->{'data_dir'}/config.ini");
2529
my $path_ndb_mgmd_log= "$cluster->{'data_dir'}/\l$cluster->{'name'}_ndb_mgmd.log";
2530
$pid= mtr_spawn($exe_ndb_mgmd, $args, "",
2534
{ append_log_file => 1 });
2536
# FIXME Should not be needed
2537
# Unfortunately the cluster nodes will fail to start
2538
# if ndb_mgmd has not started properly
2539
if (ndb_mgmd_wait_started($cluster))
2541
mtr_error("Failed to wait for start of ndb_mgmd");
2544
# Remember pid of ndb_mgmd
2545
$cluster->{'pid'}= $pid;
2547
mtr_verbose("ndb_mgmd_start, pid: $pid");
2553
sub ndbd_start ($$$) {
2556
my $extra_args= shift;
2558
my $args; # Arg vector
2561
mtr_init_args(\$args);
2562
mtr_add_arg($args, "--no-defaults");
2563
mtr_add_arg($args, "--core");
2564
mtr_add_arg($args, "--ndb-connectstring=%s", "$cluster->{'connect_string'}");
2565
if ( $mysql_version_id >= 50000)
2567
mtr_add_arg($args, "--character-sets-dir=%s", "$path_charsetsdir");
2569
mtr_add_arg($args, "--nodaemon");
2570
mtr_add_arg($args, "$extra_args");
2572
my $nodeid= $cluster->{'ndbds'}->[$idx]->{'nodeid'};
2573
my $path_ndbd_log= "$cluster->{'data_dir'}/ndb_${nodeid}.log";
2574
$pid= mtr_spawn($exe_ndbd, $args, "",
2578
{ append_log_file => 1 });
2580
# Add pid to list of pids for this cluster
2581
$cluster->{'ndbds'}->[$idx]->{'pid'}= $pid;
2583
# Rememeber options used when starting
2584
$cluster->{'ndbds'}->[$idx]->{'start_extra_args'}= $extra_args;
2585
$cluster->{'ndbds'}->[$idx]->{'idx'}= $idx;
2587
mtr_verbose("ndbd_start, pid: $pid");
2593
sub ndbcluster_start ($$) {
2595
my $extra_args= shift;
2597
mtr_verbose("ndbcluster_start '$cluster->{'name'}'");
2599
if ( $cluster->{'use_running'} )
2604
if ( $cluster->{'pid'} )
2606
mtr_error("Cluster '$cluster->{'name'}' already started");
2609
ndb_mgmd_start($cluster);
2611
for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ )
2613
ndbd_start($cluster, $idx, $extra_args);
2620
sub rm_ndbcluster_tables ($) {
2622
foreach my $bin ( glob("$dir/mysql/ndb_apply_status*"),
2623
glob("$dir/mysql/ndb_schema*"))
1825
2630
##############################################################################
1991
2806
copy_install_db("slave".($idx+1), $slave->[$idx]->{'path_myddir'});
2809
my $cluster_started_ok= 1; # Assume it can be started
2811
my $cluster= $clusters->[0]; # Master cluster
2812
if ($opt_skip_ndbcluster ||
2813
$cluster->{'use_running'} ||
2814
$cluster->{executable_setup_failed})
2816
# Don't install master cluster
2818
elsif (ndbcluster_start_install($cluster))
2820
mtr_warning("Failed to start install of $cluster->{name}");
2821
$cluster_started_ok= 0;
2824
$cluster= $clusters->[1]; # Slave cluster
2825
if ($max_slave_num == 0 ||
2826
$opt_skip_ndbcluster_slave ||
2827
$cluster->{'use_running'} ||
2828
$cluster->{executable_setup_failed})
2830
# Don't install slave cluster
2832
elsif (ndbcluster_start_install($cluster))
2834
mtr_warning("Failed to start install of $cluster->{name}");
2835
$cluster_started_ok= 0;
2838
foreach $cluster (@{$clusters})
2841
next if !$cluster->{'pid'};
2843
$cluster->{'installed_ok'}= 1; # Assume install suceeds
2845
if (ndbcluster_wait_started($cluster, ""))
2847
# failed to install, disable usage and flag that its no ok
2848
mtr_report("ndbcluster_install of $cluster->{'name'} failed");
2849
$cluster->{"installed_ok"}= 0;
2851
$cluster_started_ok= 0;
2855
if ( ! $cluster_started_ok )
2859
# Continue without cluster
2863
mtr_error("To continue, re-run with '--force'.");
2883
sub install_db ($$) {
2885
my $data_dir= shift;
2887
mtr_report("Installing \u$type Database");
2891
mtr_init_args(\$args);
2892
mtr_add_arg($args, "--no-defaults");
2893
mtr_add_arg($args, "--bootstrap");
2894
mtr_add_arg($args, "--basedir=%s", $path_my_basedir);
2895
mtr_add_arg($args, "--datadir=%s", $data_dir);
2896
mtr_add_arg($args, "--loose-skip-innodb");
2897
mtr_add_arg($args, "--tmpdir=.");
2898
mtr_add_arg($args, "--core-file");
2902
mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap_%s.trace",
2903
$path_vardir_trace, $type);
2906
if ( ! $glob_netware )
2908
mtr_add_arg($args, "--language=%s", $path_language);
2909
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
2912
# If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
2913
# configure --disable-grant-options), mysqld will not recognize the
2914
# --bootstrap or --skip-grant-tables options. The user can set
2915
# MYSQLD_BOOTSTRAP to the full path to a mysqld which does accept
2916
# --bootstrap, to accommodate this.
2917
my $exe_mysqld_bootstrap = $ENV{'MYSQLD_BOOTSTRAP'} || $exe_mysqld;
2919
# ----------------------------------------------------------------------
2920
# export MYSQLD_BOOTSTRAP_CMD variable containing <path>/mysqld <args>
2921
# ----------------------------------------------------------------------
2922
$ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args);
2011
2927
# Restore snapshot of the installed slave databases
2012
2928
# if the snapshot exists
2964
if ($tinfo->{'ndb_test'})
2966
foreach my $cluster (@{$clusters})
2968
# Slave cluster is skipped and thus not
2969
# installed, no need to perform checks
2970
last if ($opt_skip_ndbcluster_slave and
2971
$cluster->{'name'} eq 'Slave');
2973
# Using running cluster - no need
2974
# to check if test should be skipped
2975
# will be done by test itself
2976
last if ($cluster->{'use_running'});
2978
# If test needs this cluster, check binaries was found ok
2979
if ( $cluster->{'executable_setup_failed'} )
2981
mtr_report_test_name($tinfo);
2983
"Failed to find cluster binaries";
2984
mtr_report_test_failed($tinfo);
2988
# If test needs this cluster, check it was installed ok
2989
if ( !$cluster->{'installed_ok'} )
2991
mtr_report_test_name($tinfo);
2993
"Cluster $cluster->{'name'} was not installed ok";
2994
mtr_report_test_failed($tinfo);
2052
sub do_before_run_drizzletest($)
3005
sub do_before_run_mysqltest($)
2054
3007
my $tinfo= shift;
2057
# Remove old files produced by drizzletest
3010
# Remove old files produced by mysqltest
2058
3011
my $base_file= mtr_match_extension($tinfo->{'result_file'},
2059
3012
"result"); # Trim extension
2060
3013
unlink("$base_file.reject");
3165
4417
if ( $opt_debug )
3167
mtr_add_arg($args, "--debug=d:t:A,%s/log/drizzletest.trace",
4419
mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace",
3168
4420
$path_vardir_trace);
3171
# ----------------------------------------------------------------------
3172
# export DRIZZLE_TEST variable containing <path>/drizzletest <args>
3173
# ----------------------------------------------------------------------
3174
$ENV{'DRIZZLE_TEST'}=
3175
mtr_native_path($exe_drizzletest) . " " . join(" ", @$args);
3177
# ----------------------------------------------------------------------
3178
# Add arguments that should not go into the DRIZZLE_TEST env var
3179
# ----------------------------------------------------------------------
3181
if ( $opt_valgrind_drizzletest )
4423
if ( $opt_ssl_supported )
4425
mtr_add_arg($args, "--ssl-ca=%s/std_data/cacert.pem",
4426
$glob_mysql_test_dir);
4427
mtr_add_arg($args, "--ssl-cert=%s/std_data/client-cert.pem",
4428
$glob_mysql_test_dir);
4429
mtr_add_arg($args, "--ssl-key=%s/std_data/client-key.pem",
4430
$glob_mysql_test_dir);
4435
# Turn on SSL for _all_ test cases if option --ssl was used
4436
mtr_add_arg($args, "--ssl");
4438
elsif ( $opt_ssl_supported )
4440
mtr_add_arg($args, "--skip-ssl");
4443
# ----------------------------------------------------------------------
4444
# If embedded server, we create server args to give mysqltest to pass on
4445
# ----------------------------------------------------------------------
4447
if ( $glob_use_embedded_server )
4449
mysqld_arguments($args,$master->[0],$tinfo->{'master_opt'},[]);
4452
# ----------------------------------------------------------------------
4453
# export MYSQL_TEST variable containing <path>/mysqltest <args>
4454
# ----------------------------------------------------------------------
4456
mtr_native_path($exe_mysqltest) . " " . join(" ", @$args);
4458
# ----------------------------------------------------------------------
4459
# Add arguments that should not go into the MYSQL_TEST env var
4460
# ----------------------------------------------------------------------
4462
if ( $opt_valgrind_mysqltest )
3183
4464
# Prefix the Valgrind options to the argument list.
3184
4465
# We do this here, since we do not want to Valgrind the nested invocations
3185
# of drizzletest; that would mess up the stderr output causing test failure.
4466
# of mysqltest; that would mess up the stderr output causing test failure.
3186
4467
my @args_saved = @$args;
3187
4468
mtr_init_args(\$args);
3188
4469
valgrind_arguments($args, \$exe);