~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/test-run.pl

  • Committer: Stewart Smith
  • Date: 2010-11-07 04:22:31 UTC
  • mto: (1911.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1912.
  • Revision ID: stewart@flamingspork.com-20101107042231-ola4sl7j0qvg58tz
fix ARCHIVE storage engine calling exit (lintian warning). Was because we were linking in libinternal into libazio, which links into archive plugin. Just link libinternal into the command line utilities.

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
148
132
 
149
133
our $opt_usage;
150
134
our $opt_suites;
151
 
our $opt_suites_default= "main"; # Default suites to run
 
135
our $opt_suites_default= "main,jp"; # Default suites to run
152
136
our $opt_script_debug= 0;  # Script debugging, enable with --script-debug
153
137
our $opt_verbose= 0;  # Verbose output, enable with --verbose
154
138
 
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
 
our $opt_rabbitmq_myport;
234
215
our $opt_record;
235
216
my $opt_report_features;
236
217
our $opt_check_testcases;
374
355
  }
375
356
  else
376
357
  {
377
 
 
 
358
    # Figure out which tests we are going to run
378
359
    if (!$opt_suites)
379
360
    {
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
 
        }
 
361
      $opt_suites= $opt_suites_default;
 
362
 
 
363
      # Check for any extra suites to enable based on the path name
 
364
      my %extra_suites= ();
 
365
 
 
366
      foreach my $dir ( reverse splitdir($glob_basedir) )
 
367
      {
 
368
        my $extra_suite= $extra_suites{$dir};
 
369
        if (defined $extra_suite){
 
370
          dtr_report("Found extra suite: $extra_suite");
 
371
          $opt_suites= "$extra_suite,$opt_suites";
 
372
          last;
 
373
        }
 
374
      }
394
375
    }
395
376
 
396
377
    my $tests= collect_test_cases($opt_suites);
508
489
             'master_port=i'            => \$opt_master_myport,
509
490
             'slave_port=i'             => \$opt_slave_myport,
510
491
             'memc_port=i'              => \$opt_memc_myport,
511
 
             'pbms_port=i'              => \$opt_pbms_myport,
512
 
             'rabbitmq_port=i'              => \$opt_rabbitmq_myport,
513
492
             'dtr-build-thread=i'       => \$opt_dtr_build_thread,
514
493
 
515
494
             # Test case authoring
615
594
             'help|h'                   => \$opt_usage,
616
595
            ) or usage("Can't read options");
617
596
 
 
597
  usage("") if $opt_usage;
 
598
 
618
599
  usage("you cannot specify --gdb and --dbx both!") if 
619
600
        ($opt_gdb && $opt_dbx) ||
620
601
        ($opt_manual_gdb && $opt_manual_dbx);
661
642
  # distributions, TAR binary distributions and some other packages.
662
643
  $glob_basedir= dirname($glob_drizzle_test_dir);
663
644
 
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
 
 
693
645
  # In the RPM case, binaries and libraries are installed in the
694
646
  # default system locations, instead of having our own private base
695
647
  # directory. And we install "/usr/share/drizzle-test". Moving up one
988
940
    }
989
941
  }
990
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
 
991
954
  $master->[0]=
992
955
  {
993
956
   pid            => 0,
996
959
   path_myddir    => "$opt_vardir/master-data",
997
960
   path_myerr     => "$opt_vardir/log/master.err",
998
961
   path_pid       => "$opt_vardir/run/master.pid",
999
 
   path_sock      => "$opt_vardir/master.sock",
 
962
   path_sock      => "$sockdir/master.sock",
1000
963
   port           =>  $opt_master_myport,
1001
964
   secondary_port =>  $opt_master_myport + $secondary_port_offset,
1002
965
   start_timeout  =>  400, # enough time create innodb tables
1012
975
   path_myddir    => "$opt_vardir/master1-data",
1013
976
   path_myerr     => "$opt_vardir/log/master1.err",
1014
977
   path_pid       => "$opt_vardir/run/master1.pid",
1015
 
   path_sock      => "$opt_vardir/master1.sock",
 
978
   path_sock      => "$sockdir/master1.sock",
1016
979
   port           => $opt_master_myport + 1,
1017
980
   secondary_port => $opt_master_myport + 1 + $secondary_port_offset,
1018
981
   start_timeout  => 400, # enough time create innodb tables
1028
991
   path_myddir    => "$opt_vardir/slave-data",
1029
992
   path_myerr     => "$opt_vardir/log/slave.err",
1030
993
   path_pid       => "$opt_vardir/run/slave.pid",
1031
 
   path_sock      => "$opt_vardir/slave.sock",
 
994
   path_sock      => "$sockdir/slave.sock",
1032
995
   port           => $opt_slave_myport,
1033
996
   secondary_port => $opt_slave_myport + $secondary_port_offset,
1034
997
   start_timeout  => 400,
1044
1007
   path_myddir    => "$opt_vardir/slave1-data",
1045
1008
   path_myerr     => "$opt_vardir/log/slave1.err",
1046
1009
   path_pid       => "$opt_vardir/run/slave1.pid",
1047
 
   path_sock      => "$opt_vardir/slave1.sock",
 
1010
   path_sock      => "$sockdir/slave1.sock",
1048
1011
   port           => $opt_slave_myport + 1,
1049
1012
   secondary_port => $opt_slave_myport + 1 + $secondary_port_offset,
1050
1013
   start_timeout  => 300,
1060
1023
   path_myddir    => "$opt_vardir/slave2-data",
1061
1024
   path_myerr     => "$opt_vardir/log/slave2.err",
1062
1025
   path_pid       => "$opt_vardir/run/slave2.pid",
1063
 
   path_sock      => "$opt_vardir/slave2.sock",
 
1026
   path_sock      => "$sockdir/slave2.sock",
1064
1027
   port           => $opt_slave_myport + 2,
1065
1028
   secondary_port => $opt_slave_myport + 2 + $secondary_port_offset,
1066
1029
   start_timeout  => 300,
1169
1132
 
1170
1133
  $opt_slave_myport=          gimme_a_good_port($opt_master_myport + 2);  # and 3 4
1171
1134
  $opt_memc_myport= gimme_a_good_port($opt_master_myport + 10);
1172
 
  $opt_pbms_myport= gimme_a_good_port($opt_master_myport + 11);
1173
 
  $opt_rabbitmq_myport= gimme_a_good_port($opt_master_myport + 12);
1174
1135
 
1175
1136
  if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 )
1176
1137
  {
1297
1258
  $exe_drizzledump= dtr_exe_exists("$path_client_bindir/drizzledump");
1298
1259
  $exe_drizzleimport= dtr_exe_exists("$path_client_bindir/drizzleimport");
1299
1260
  $exe_drizzle=          dtr_exe_exists("$path_client_bindir/drizzle");
1300
 
  $exe_drizzleadmin= dtr_exe_exists("$path_client_bindir/drizzleadmin");
1301
1261
 
1302
1262
  if (!$opt_extern)
1303
1263
  {
1352
1312
    " -uroot --port=$drizzled->{'port'} ";
1353
1313
}
1354
1314
 
1355
 
sub generate_cmdline_drizzleadmin ($) {
1356
 
  my($drizzled) = @_;
1357
 
  return
1358
 
    dtr_native_path($exe_drizzleadmin) .
1359
 
    " -uroot --port=$drizzled->{'port'} ";
1360
 
}
1361
1315
 
1362
1316
##############################################################################
1363
1317
#
1500
1454
  $ENV{'SLAVE_MYPORT1'}=      $slave->[1]->{'port'};
1501
1455
  $ENV{'SLAVE_MYPORT2'}=      $slave->[2]->{'port'};
1502
1456
  $ENV{'MC_PORT'}=            $opt_memc_myport;
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'};
 
1457
  $ENV{'DRIZZLE_TCP_PORT'}=     $drizzled_variables{'drizzle-protocol.port'};
1506
1458
 
1507
1459
  $ENV{'DTR_BUILD_THREAD'}=      $opt_dtr_build_thread;
1508
1460
 
1512
1464
  # ----------------------------------------------------
1513
1465
  # Setup env to childs can execute myqldump
1514
1466
  # ----------------------------------------------------
1515
 
  my $cmdline_drizzleadmin= generate_cmdline_drizzleadmin($master->[0]);
1516
1467
  my $cmdline_drizzledump= generate_cmdline_drizzledump($master->[0]);
1517
1468
  my $cmdline_drizzledumpslave= generate_cmdline_drizzledump($slave->[0]);
1518
1469
  my $cmdline_drizzledump_secondary= dtr_native_path($exe_drizzledump) .
1528
1479
    $cmdline_drizzledump_secondary .=
1529
1480
      " --debug=d:t:A,$path_vardir_trace/log/drizzledump-drizzle.trace";
1530
1481
  }
1531
 
  $ENV{'DRIZZLE_ADMIN'}= $cmdline_drizzleadmin;
1532
1482
  $ENV{'DRIZZLE_DUMP'}= $cmdline_drizzledump;
1533
1483
  $ENV{'DRIZZLE_DUMP_SLAVE'}= $cmdline_drizzledumpslave;
1534
1484
  $ENV{'DRIZZLE_DUMP_SECONDARY'}= $cmdline_drizzledump_secondary;
1659
1609
    print "Using SLAVE_MYPORT1         = $ENV{SLAVE_MYPORT1}\n";
1660
1610
    print "Using SLAVE_MYPORT2         = $ENV{SLAVE_MYPORT2}\n";
1661
1611
    print "Using MC_PORT               = $ENV{MC_PORT}\n";
1662
 
    print "Using PBMS_PORT             = $ENV{PBMS_PORT}\n";
1663
 
    print "Using RABBITMQ_NODE_PORT    = $ENV{RABBITMQ_NODE_PORT}\n";
1664
1612
  }
1665
1613
 
1666
1614
  # Create an environment variable to make it possible
2580
2528
  dtr_add_arg($args, "%s--datadir=%s", $prefix,
2581
2529
              $drizzled->{'path_myddir'});
2582
2530
 
2583
 
  dtr_add_arg($args, "%s--mysql-unix-socket-protocol.path=%s", $prefix,
2584
 
              $drizzled->{'path_sock'});
2585
 
 
2586
2531
  # Check if "extra_opt" contains --skip-log-bin
2587
2532
  if ( $drizzled->{'type'} eq 'master' )
2588
2533
  {
3327
3272
  {
3328
3273
    # write init file for drizzled
3329
3274
    dtr_tofile($dbx_init_file,
3330
 
               "stop in __1cIdrizzledLparse6Fpn0AHSession_pkcI_v_\n" .
 
3275
               "stop in __1cIdrizzledLmysql_parse6Fpn0AHSession_pkcI_v_\n" .
3331
3276
               "runargs $str\n" .
3332
3277
               "run\n" .
3333
3278
               "\n");
3398
3343
               "set args $str\n" .
3399
3344
               "$extra_gdb_init" .
3400
3345
               "set breakpoint pending on\n" .
3401
 
               "break drizzled::parse\n" .
 
3346
               "break drizzled::mysql_parse\n" .
3402
3347
               "commands 1\n" .
3403
3348
               "disable 1\n" .
3404
3349
               "end\n" .
3464
3409
    dtr_tofile($gdb_init_file,
3465
3410
               "file $$exe\n" .
3466
3411
               "set args $str\n" .
3467
 
               "break drizzled::parse\n" .
 
3412
               "break drizzled::mysql_parse\n" .
3468
3413
               "commands 1\n" .
3469
3414
               "disable 1\n" .
3470
3415
               "end");