~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/test-run.pl

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

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
#
7
23
##############################################################################
8
24
#
9
25
#  drizzle-test-run.pl
132
148
 
133
149
our $opt_usage;
134
150
our $opt_suites;
135
 
our $opt_suites_default= "main,jp"; # Default suites to run
 
151
our $opt_suites_default= "main"; # Default suites to run
136
152
our $opt_script_debug= 0;  # Script debugging, enable with --script-debug
137
153
our $opt_verbose= 0;  # Verbose output, enable with --verbose
138
154
 
140
156
 
141
157
our $exe_master_drizzled;
142
158
our $exe_drizzle;
 
159
our $exe_drizzleadmin;
143
160
our $exe_drizzle_client_test;
144
161
our $exe_bug25714;
145
162
our $exe_drizzled;
213
230
our $opt_slave_myport;
214
231
our $opt_memc_myport;
215
232
our $opt_pbms_myport;
 
233
our $opt_rabbitmq_myport;
216
234
our $opt_record;
217
235
my $opt_report_features;
218
236
our $opt_check_testcases;
356
374
  }
357
375
  else
358
376
  {
359
 
    # Figure out which tests we are going to run
 
377
 
360
378
    if (!$opt_suites)
361
379
    {
362
 
      $opt_suites= $opt_suites_default;
363
 
 
364
 
      # Check for any extra suites to enable based on the path name
365
 
      my %extra_suites= ();
366
 
 
367
 
      foreach my $dir ( reverse splitdir($glob_basedir) )
368
 
      {
369
 
        my $extra_suite= $extra_suites{$dir};
370
 
        if (defined $extra_suite){
371
 
          dtr_report("Found extra suite: $extra_suite");
372
 
          $opt_suites= "$extra_suite,$opt_suites";
373
 
          last;
374
 
        }
375
 
      }
 
380
 
 
381
        $opt_suites= $opt_suites_default;
 
382
 
 
383
        my %extra_suites= ();
 
384
 
 
385
        foreach my $dir ( reverse splitdir($glob_basedir) )
 
386
        {
 
387
            my $extra_suite= $extra_suites{$dir};
 
388
            if (defined $extra_suite){
 
389
                dtr_report("Found extra suite: $extra_suite");
 
390
                $opt_suites= "$extra_suite,$opt_suites";
 
391
                last;
 
392
            }
 
393
        }
376
394
    }
377
395
 
378
396
    my $tests= collect_test_cases($opt_suites);
491
509
             'slave_port=i'             => \$opt_slave_myport,
492
510
             'memc_port=i'              => \$opt_memc_myport,
493
511
             'pbms_port=i'              => \$opt_pbms_myport,
 
512
             'rabbitmq_port=i'              => \$opt_rabbitmq_myport,
494
513
             'dtr-build-thread=i'       => \$opt_dtr_build_thread,
495
514
 
496
515
             # Test case authoring
596
615
             'help|h'                   => \$opt_usage,
597
616
            ) or usage("Can't read options");
598
617
 
599
 
  usage("") if $opt_usage;
600
 
 
601
618
  usage("you cannot specify --gdb and --dbx both!") if 
602
619
        ($opt_gdb && $opt_dbx) ||
603
620
        ($opt_manual_gdb && $opt_manual_dbx);
644
661
  # distributions, TAR binary distributions and some other packages.
645
662
  $glob_basedir= dirname($glob_drizzle_test_dir);
646
663
 
 
664
  # Figure out which tests we are going to run
 
665
  my $suitedir= "$glob_drizzle_test_dir/suite";
 
666
  if ( -d $suitedir )
 
667
  {
 
668
      opendir(SUITE_DIR, $suitedir)
 
669
          or dtr_error("can't open directory \"$suitedir\": $!");
 
670
 
 
671
      while ( my $elem= readdir(SUITE_DIR) )
 
672
      {
 
673
          next if $elem eq ".";
 
674
          next if $elem eq "..";
 
675
          next if $elem eq "big"; # Eats up too much disk
 
676
          next if $elem eq "large_tests"; # Eats up too much disk
 
677
          next if $elem eq "stress"; # Currently fails
 
678
          next if $elem eq "broken"; # Old broken test, mainly unsupported featurs
 
679
 
 
680
          my $local_dir= "$suitedir/$elem";
 
681
 
 
682
          next unless -d $local_dir;
 
683
          next unless -d "$local_dir/t"; # We want to make sure it has tests
 
684
          next unless -d "$local_dir/r"; # Ditto, results
 
685
 
 
686
          $opt_suites_default.= ",$elem";
 
687
      }
 
688
      closedir(SUITE_DIR);
 
689
  }
 
690
 
 
691
  usage("") if $opt_usage;
 
692
 
647
693
  # In the RPM case, binaries and libraries are installed in the
648
694
  # default system locations, instead of having our own private base
649
695
  # directory. And we install "/usr/share/drizzle-test". Moving up one
942
988
    }
943
989
  }
944
990
 
945
 
  # On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be
946
 
  # considered different, so avoid the extra slash (/) in the socket
947
 
  # paths.
948
 
  my $sockdir = $opt_tmpdir;
949
 
  $sockdir =~ s|/+$||;
950
 
 
951
 
  # On some operating systems, there is a limit to the length of a
952
 
  # UNIX domain socket's path far below PATH_MAX, so try to avoid long
953
 
  # socket path names.
954
 
  $sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) >= 70 );
955
 
 
956
991
  $master->[0]=
957
992
  {
958
993
   pid            => 0,
961
996
   path_myddir    => "$opt_vardir/master-data",
962
997
   path_myerr     => "$opt_vardir/log/master.err",
963
998
   path_pid       => "$opt_vardir/run/master.pid",
964
 
   path_sock      => "$sockdir/master.sock",
 
999
   path_sock      => "$opt_vardir/master.sock",
965
1000
   port           =>  $opt_master_myport,
966
1001
   secondary_port =>  $opt_master_myport + $secondary_port_offset,
967
1002
   start_timeout  =>  400, # enough time create innodb tables
977
1012
   path_myddir    => "$opt_vardir/master1-data",
978
1013
   path_myerr     => "$opt_vardir/log/master1.err",
979
1014
   path_pid       => "$opt_vardir/run/master1.pid",
980
 
   path_sock      => "$sockdir/master1.sock",
 
1015
   path_sock      => "$opt_vardir/master1.sock",
981
1016
   port           => $opt_master_myport + 1,
982
1017
   secondary_port => $opt_master_myport + 1 + $secondary_port_offset,
983
1018
   start_timeout  => 400, # enough time create innodb tables
993
1028
   path_myddir    => "$opt_vardir/slave-data",
994
1029
   path_myerr     => "$opt_vardir/log/slave.err",
995
1030
   path_pid       => "$opt_vardir/run/slave.pid",
996
 
   path_sock      => "$sockdir/slave.sock",
 
1031
   path_sock      => "$opt_vardir/slave.sock",
997
1032
   port           => $opt_slave_myport,
998
1033
   secondary_port => $opt_slave_myport + $secondary_port_offset,
999
1034
   start_timeout  => 400,
1009
1044
   path_myddir    => "$opt_vardir/slave1-data",
1010
1045
   path_myerr     => "$opt_vardir/log/slave1.err",
1011
1046
   path_pid       => "$opt_vardir/run/slave1.pid",
1012
 
   path_sock      => "$sockdir/slave1.sock",
 
1047
   path_sock      => "$opt_vardir/slave1.sock",
1013
1048
   port           => $opt_slave_myport + 1,
1014
1049
   secondary_port => $opt_slave_myport + 1 + $secondary_port_offset,
1015
1050
   start_timeout  => 300,
1025
1060
   path_myddir    => "$opt_vardir/slave2-data",
1026
1061
   path_myerr     => "$opt_vardir/log/slave2.err",
1027
1062
   path_pid       => "$opt_vardir/run/slave2.pid",
1028
 
   path_sock      => "$sockdir/slave2.sock",
 
1063
   path_sock      => "$opt_vardir/slave2.sock",
1029
1064
   port           => $opt_slave_myport + 2,
1030
1065
   secondary_port => $opt_slave_myport + 2 + $secondary_port_offset,
1031
1066
   start_timeout  => 300,
1135
1170
  $opt_slave_myport=          gimme_a_good_port($opt_master_myport + 2);  # and 3 4
1136
1171
  $opt_memc_myport= gimme_a_good_port($opt_master_myport + 10);
1137
1172
  $opt_pbms_myport= gimme_a_good_port($opt_master_myport + 11);
 
1173
  $opt_rabbitmq_myport= gimme_a_good_port($opt_master_myport + 12);
1138
1174
 
1139
1175
  if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 )
1140
1176
  {
1261
1297
  $exe_drizzledump= dtr_exe_exists("$path_client_bindir/drizzledump");
1262
1298
  $exe_drizzleimport= dtr_exe_exists("$path_client_bindir/drizzleimport");
1263
1299
  $exe_drizzle=          dtr_exe_exists("$path_client_bindir/drizzle");
 
1300
  $exe_drizzleadmin= dtr_exe_exists("$path_client_bindir/drizzleadmin");
1264
1301
 
1265
1302
  if (!$opt_extern)
1266
1303
  {
1315
1352
    " -uroot --port=$drizzled->{'port'} ";
1316
1353
}
1317
1354
 
 
1355
sub generate_cmdline_drizzleadmin ($) {
 
1356
  my($drizzled) = @_;
 
1357
  return
 
1358
    dtr_native_path($exe_drizzleadmin) .
 
1359
    " -uroot --port=$drizzled->{'port'} ";
 
1360
}
1318
1361
 
1319
1362
##############################################################################
1320
1363
#
1457
1500
  $ENV{'SLAVE_MYPORT1'}=      $slave->[1]->{'port'};
1458
1501
  $ENV{'SLAVE_MYPORT2'}=      $slave->[2]->{'port'};
1459
1502
  $ENV{'MC_PORT'}=            $opt_memc_myport;
1460
 
  $ENV{'PBMS_PORT'}=            $opt_pbms_myport;
1461
 
  $ENV{'DRIZZLE_TCP_PORT'}=     $drizzled_variables{'drizzle-protocol.port'};
 
1503
  $ENV{'PBMS_PORT'}=          $opt_pbms_myport;
 
1504
  $ENV{'RABBITMQ_NODE_PORT'}= $opt_rabbitmq_myport;
 
1505
  $ENV{'DRIZZLE_TCP_PORT'}=   $drizzled_variables{'drizzle-protocol.port'};
1462
1506
 
1463
1507
  $ENV{'DTR_BUILD_THREAD'}=      $opt_dtr_build_thread;
1464
1508
 
1468
1512
  # ----------------------------------------------------
1469
1513
  # Setup env to childs can execute myqldump
1470
1514
  # ----------------------------------------------------
 
1515
  my $cmdline_drizzleadmin= generate_cmdline_drizzleadmin($master->[0]);
1471
1516
  my $cmdline_drizzledump= generate_cmdline_drizzledump($master->[0]);
1472
1517
  my $cmdline_drizzledumpslave= generate_cmdline_drizzledump($slave->[0]);
1473
1518
  my $cmdline_drizzledump_secondary= dtr_native_path($exe_drizzledump) .
1483
1528
    $cmdline_drizzledump_secondary .=
1484
1529
      " --debug=d:t:A,$path_vardir_trace/log/drizzledump-drizzle.trace";
1485
1530
  }
 
1531
  $ENV{'DRIZZLE_ADMIN'}= $cmdline_drizzleadmin;
1486
1532
  $ENV{'DRIZZLE_DUMP'}= $cmdline_drizzledump;
1487
1533
  $ENV{'DRIZZLE_DUMP_SLAVE'}= $cmdline_drizzledumpslave;
1488
1534
  $ENV{'DRIZZLE_DUMP_SECONDARY'}= $cmdline_drizzledump_secondary;
1614
1660
    print "Using SLAVE_MYPORT2         = $ENV{SLAVE_MYPORT2}\n";
1615
1661
    print "Using MC_PORT               = $ENV{MC_PORT}\n";
1616
1662
    print "Using PBMS_PORT             = $ENV{PBMS_PORT}\n";
 
1663
    print "Using RABBITMQ_NODE_PORT    = $ENV{RABBITMQ_NODE_PORT}\n";
1617
1664
  }
1618
1665
 
1619
1666
  # Create an environment variable to make it possible
2533
2580
  dtr_add_arg($args, "%s--datadir=%s", $prefix,
2534
2581
              $drizzled->{'path_myddir'});
2535
2582
 
 
2583
  dtr_add_arg($args, "%s--mysql-unix-socket-protocol.path=%s", $prefix,
 
2584
              $drizzled->{'path_sock'});
 
2585
 
2536
2586
  # Check if "extra_opt" contains --skip-log-bin
2537
2587
  if ( $drizzled->{'type'} eq 'master' )
2538
2588
  {
3277
3327
  {
3278
3328
    # write init file for drizzled
3279
3329
    dtr_tofile($dbx_init_file,
3280
 
               "stop in __1cIdrizzledLmysql_parse6Fpn0AHSession_pkcI_v_\n" .
 
3330
               "stop in __1cIdrizzledLparse6Fpn0AHSession_pkcI_v_\n" .
3281
3331
               "runargs $str\n" .
3282
3332
               "run\n" .
3283
3333
               "\n");
3348
3398
               "set args $str\n" .
3349
3399
               "$extra_gdb_init" .
3350
3400
               "set breakpoint pending on\n" .
3351
 
               "break drizzled::mysql_parse\n" .
 
3401
               "break drizzled::parse\n" .
3352
3402
               "commands 1\n" .
3353
3403
               "disable 1\n" .
3354
3404
               "end\n" .
3414
3464
    dtr_tofile($gdb_init_file,
3415
3465
               "file $$exe\n" .
3416
3466
               "set args $str\n" .
3417
 
               "break drizzled::mysql_parse\n" .
 
3467
               "break drizzled::parse\n" .
3418
3468
               "commands 1\n" .
3419
3469
               "disable 1\n" .
3420
3470
               "end");