~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/test-run.pl

  • Committer: Monty Taylor
  • Date: 2010-10-19 21:51:42 UTC
  • mto: This revision was merged to the branch mainline in revision 1870.
  • Revision ID: mordred@inaugust.com-20101019215142-bwof1oqrswj9ms3v
Add a constrained_value class which allows us to set compile-time
constraints on a value.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
use utf8;
5
5
 
6
6
#
7
 
# Copyright (C) 2008
8
 
9
 
# This program is free software; you can redistribute it and/or modify
10
 
# it under the terms of the GNU General Public License as published by
11
 
# the Free Software Foundation; version 2 of the License.
12
 
13
 
# This program is distributed in the hope that it will be useful,
14
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 
# GNU General Public License for more details.
17
 
18
 
# You should have received a copy of the GNU General Public License
19
 
# along with this program; if not, write to the Free Software
20
 
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
21
 
#
22
 
#
23
7
##############################################################################
24
8
#
25
9
#  drizzle-test-run.pl
156
140
 
157
141
our $exe_master_drizzled;
158
142
our $exe_drizzle;
159
 
our $exe_drizzleadmin;
160
143
our $exe_drizzle_client_test;
161
144
our $exe_bug25714;
162
145
our $exe_drizzled;
229
212
our $opt_master_myport;
230
213
our $opt_slave_myport;
231
214
our $opt_memc_myport;
232
 
our $opt_pbms_myport;
233
215
our $opt_record;
234
216
my $opt_report_features;
235
217
our $opt_check_testcases;
507
489
             'master_port=i'            => \$opt_master_myport,
508
490
             'slave_port=i'             => \$opt_slave_myport,
509
491
             'memc_port=i'              => \$opt_memc_myport,
510
 
             'pbms_port=i'              => \$opt_pbms_myport,
511
492
             'dtr-build-thread=i'       => \$opt_dtr_build_thread,
512
493
 
513
494
             # Test case authoring
959
940
    }
960
941
  }
961
942
 
 
943
  # On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be
 
944
  # considered different, so avoid the extra slash (/) in the socket
 
945
  # paths.
 
946
  my $sockdir = $opt_tmpdir;
 
947
  $sockdir =~ s|/+$||;
 
948
 
 
949
  # On some operating systems, there is a limit to the length of a
 
950
  # UNIX domain socket's path far below PATH_MAX, so try to avoid long
 
951
  # socket path names.
 
952
  $sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) >= 70 );
 
953
 
962
954
  $master->[0]=
963
955
  {
964
956
   pid            => 0,
967
959
   path_myddir    => "$opt_vardir/master-data",
968
960
   path_myerr     => "$opt_vardir/log/master.err",
969
961
   path_pid       => "$opt_vardir/run/master.pid",
970
 
   path_sock      => "$opt_vardir/master.sock",
 
962
   path_sock      => "$sockdir/master.sock",
971
963
   port           =>  $opt_master_myport,
972
964
   secondary_port =>  $opt_master_myport + $secondary_port_offset,
973
965
   start_timeout  =>  400, # enough time create innodb tables
983
975
   path_myddir    => "$opt_vardir/master1-data",
984
976
   path_myerr     => "$opt_vardir/log/master1.err",
985
977
   path_pid       => "$opt_vardir/run/master1.pid",
986
 
   path_sock      => "$opt_vardir/master1.sock",
 
978
   path_sock      => "$sockdir/master1.sock",
987
979
   port           => $opt_master_myport + 1,
988
980
   secondary_port => $opt_master_myport + 1 + $secondary_port_offset,
989
981
   start_timeout  => 400, # enough time create innodb tables
999
991
   path_myddir    => "$opt_vardir/slave-data",
1000
992
   path_myerr     => "$opt_vardir/log/slave.err",
1001
993
   path_pid       => "$opt_vardir/run/slave.pid",
1002
 
   path_sock      => "$opt_vardir/slave.sock",
 
994
   path_sock      => "$sockdir/slave.sock",
1003
995
   port           => $opt_slave_myport,
1004
996
   secondary_port => $opt_slave_myport + $secondary_port_offset,
1005
997
   start_timeout  => 400,
1015
1007
   path_myddir    => "$opt_vardir/slave1-data",
1016
1008
   path_myerr     => "$opt_vardir/log/slave1.err",
1017
1009
   path_pid       => "$opt_vardir/run/slave1.pid",
1018
 
   path_sock      => "$opt_vardir/slave1.sock",
 
1010
   path_sock      => "$sockdir/slave1.sock",
1019
1011
   port           => $opt_slave_myport + 1,
1020
1012
   secondary_port => $opt_slave_myport + 1 + $secondary_port_offset,
1021
1013
   start_timeout  => 300,
1031
1023
   path_myddir    => "$opt_vardir/slave2-data",
1032
1024
   path_myerr     => "$opt_vardir/log/slave2.err",
1033
1025
   path_pid       => "$opt_vardir/run/slave2.pid",
1034
 
   path_sock      => "$opt_vardir/slave2.sock",
 
1026
   path_sock      => "$sockdir/slave2.sock",
1035
1027
   port           => $opt_slave_myport + 2,
1036
1028
   secondary_port => $opt_slave_myport + 2 + $secondary_port_offset,
1037
1029
   start_timeout  => 300,
1140
1132
 
1141
1133
  $opt_slave_myport=          gimme_a_good_port($opt_master_myport + 2);  # and 3 4
1142
1134
  $opt_memc_myport= gimme_a_good_port($opt_master_myport + 10);
1143
 
  $opt_pbms_myport= gimme_a_good_port($opt_master_myport + 11);
1144
1135
 
1145
1136
  if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 )
1146
1137
  {
1267
1258
  $exe_drizzledump= dtr_exe_exists("$path_client_bindir/drizzledump");
1268
1259
  $exe_drizzleimport= dtr_exe_exists("$path_client_bindir/drizzleimport");
1269
1260
  $exe_drizzle=          dtr_exe_exists("$path_client_bindir/drizzle");
1270
 
  $exe_drizzleadmin= dtr_exe_exists("$path_client_bindir/drizzleadmin");
1271
1261
 
1272
1262
  if (!$opt_extern)
1273
1263
  {
1322
1312
    " -uroot --port=$drizzled->{'port'} ";
1323
1313
}
1324
1314
 
1325
 
sub generate_cmdline_drizzleadmin ($) {
1326
 
  my($drizzled) = @_;
1327
 
  return
1328
 
    dtr_native_path($exe_drizzleadmin) .
1329
 
    " -uroot --port=$drizzled->{'port'} ";
1330
 
}
1331
1315
 
1332
1316
##############################################################################
1333
1317
#
1470
1454
  $ENV{'SLAVE_MYPORT1'}=      $slave->[1]->{'port'};
1471
1455
  $ENV{'SLAVE_MYPORT2'}=      $slave->[2]->{'port'};
1472
1456
  $ENV{'MC_PORT'}=            $opt_memc_myport;
1473
 
  $ENV{'PBMS_PORT'}=            $opt_pbms_myport;
1474
1457
  $ENV{'DRIZZLE_TCP_PORT'}=     $drizzled_variables{'drizzle-protocol.port'};
1475
1458
 
1476
1459
  $ENV{'DTR_BUILD_THREAD'}=      $opt_dtr_build_thread;
1481
1464
  # ----------------------------------------------------
1482
1465
  # Setup env to childs can execute myqldump
1483
1466
  # ----------------------------------------------------
1484
 
  my $cmdline_drizzleadmin= generate_cmdline_drizzleadmin($master->[0]);
1485
1467
  my $cmdline_drizzledump= generate_cmdline_drizzledump($master->[0]);
1486
1468
  my $cmdline_drizzledumpslave= generate_cmdline_drizzledump($slave->[0]);
1487
1469
  my $cmdline_drizzledump_secondary= dtr_native_path($exe_drizzledump) .
1497
1479
    $cmdline_drizzledump_secondary .=
1498
1480
      " --debug=d:t:A,$path_vardir_trace/log/drizzledump-drizzle.trace";
1499
1481
  }
1500
 
  $ENV{'DRIZZLE_ADMIN'}= $cmdline_drizzleadmin;
1501
1482
  $ENV{'DRIZZLE_DUMP'}= $cmdline_drizzledump;
1502
1483
  $ENV{'DRIZZLE_DUMP_SLAVE'}= $cmdline_drizzledumpslave;
1503
1484
  $ENV{'DRIZZLE_DUMP_SECONDARY'}= $cmdline_drizzledump_secondary;
1628
1609
    print "Using SLAVE_MYPORT1         = $ENV{SLAVE_MYPORT1}\n";
1629
1610
    print "Using SLAVE_MYPORT2         = $ENV{SLAVE_MYPORT2}\n";
1630
1611
    print "Using MC_PORT               = $ENV{MC_PORT}\n";
1631
 
    print "Using PBMS_PORT             = $ENV{PBMS_PORT}\n";
1632
1612
  }
1633
1613
 
1634
1614
  # Create an environment variable to make it possible
2548
2528
  dtr_add_arg($args, "%s--datadir=%s", $prefix,
2549
2529
              $drizzled->{'path_myddir'});
2550
2530
 
2551
 
  dtr_add_arg($args, "%s--mysql-unix-socket-protocol.path=%s", $prefix,
2552
 
              $drizzled->{'path_sock'});
2553
 
 
2554
2531
  # Check if "extra_opt" contains --skip-log-bin
2555
2532
  if ( $drizzled->{'type'} eq 'master' )
2556
2533
  {