~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/test-run.pl

Extracted the LOAD command into its own class and implementation files.
Removed the corresponding case label from the switch statement.

Show diffs side-by-side

added added

removed removed

Lines of Context:
121
121
our $opt_tmpdir;                 # A path but set directly on cmd line
122
122
our $opt_testdir;
123
123
 
124
 
our $opt_subunit;
125
124
 
126
125
our $default_vardir;
127
126
 
138
137
our $exe_drizzle_client_test;
139
138
our $exe_bug25714;
140
139
our $exe_drizzled;
 
140
our $exe_drizzlecheck;
141
141
our $exe_drizzledump;
142
142
our $exe_drizzleslap;
143
143
our $exe_drizzleimport;
180
180
 
181
181
our $glob_debugger= 0;
182
182
our $opt_gdb;
183
 
our $opt_dbx;
184
183
our $opt_client_gdb;
185
 
our $opt_client_dbx;
186
 
our $opt_dbx_gdb;
187
184
our $opt_ddd;
188
185
our $opt_client_ddd;
189
186
our $opt_manual_gdb;
190
 
our $opt_manual_dbx;
191
187
our $opt_manual_ddd;
192
188
our $opt_manual_debug;
193
189
# Magic number -69.4 results in traditional test ports starting from 9306.
493
489
             # Run test on running server
494
490
             'extern'                   => \$opt_extern,
495
491
 
496
 
             # Output format
497
 
             'subunit'                  => \$opt_subunit,
498
 
 
499
492
             # Debugging
500
493
             'gdb'                      => \$opt_gdb,
501
 
             'dbx'                      => \$opt_dbx,
502
494
             'client-gdb'               => \$opt_client_gdb,
503
 
             'client-dbx'               => \$opt_client_dbx,
504
495
             'manual-gdb'               => \$opt_manual_gdb,
505
 
             'manual-dbx'               => \$opt_manual_dbx,
506
496
             'manual-debug'             => \$opt_manual_debug,
507
497
             'ddd'                      => \$opt_ddd,
508
498
             'client-ddd'               => \$opt_client_ddd,
581
571
 
582
572
  usage("") if $opt_usage;
583
573
 
584
 
  usage("you cannot specify --gdb and --dbx both!") if 
585
 
        ($opt_gdb && $opt_dbx) ||
586
 
        ($opt_manual_gdb && $opt_manual_dbx);
587
 
 
588
574
  $glob_scriptname=  basename($0);
589
575
 
590
576
  if ($opt_mtr_build_thread != 0)
805
791
  # --------------------------------------------------------------------------
806
792
  if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
807
793
       $opt_manual_gdb || $opt_manual_ddd || $opt_manual_debug ||
808
 
       $opt_debugger || $opt_client_debugger || $opt_gdb || $opt_manual_gdb)
 
794
       $opt_debugger || $opt_client_debugger )
809
795
  {
810
796
    # Indicate that we are using debugger
811
797
    $glob_debugger= 1;
1215
1201
  $exe_perror= "perror";
1216
1202
 
1217
1203
# Look for the client binaries
 
1204
  $exe_drizzlecheck= mtr_exe_exists("$path_client_bindir/drizzlecheck");
1218
1205
  $exe_drizzledump= mtr_exe_exists("$path_client_bindir/drizzledump");
1219
1206
  $exe_drizzleimport= mtr_exe_exists("$path_client_bindir/drizzleimport");
1220
1207
  $exe_drizzle=          mtr_exe_exists("$path_client_bindir/drizzle");
1404
1391
 
1405
1392
  $ENV{'EXE_MYSQL'}=          $exe_drizzle;
1406
1393
 
 
1394
  # ----------------------------------------------------
 
1395
  # Setup env so childs can execute mysqlcheck
 
1396
  # ----------------------------------------------------
 
1397
  my $cmdline_mysqlcheck=
 
1398
    mtr_native_path($exe_drizzlecheck) .
 
1399
    " --no-defaults --debug-check -uroot " .
 
1400
    "--port=$master->[0]->{'port'} ";
 
1401
 
 
1402
  if ( $opt_debug )
 
1403
  {
 
1404
    $cmdline_mysqlcheck .=
 
1405
      " --debug=d:t:A,$path_vardir_trace/log/mysqlcheck.trace";
 
1406
  }
 
1407
  $ENV{'DRIZZLE_CHECK'}=              $cmdline_mysqlcheck;
1407
1408
 
1408
1409
  # ----------------------------------------------------
1409
1410
  # Setup env to childs can execute myqldump
2583
2584
  {
2584
2585
    ddd_arguments(\$args, \$exe, "$type"."_$idx");
2585
2586
  }
2586
 
  if ( $opt_dbx || $opt_manual_dbx)
2587
 
  {
2588
 
    dbx_arguments(\$args, \$exe, "$type"."_$idx");
2589
 
  }
2590
2587
  elsif ( $opt_debugger )
2591
2588
  {
2592
2589
    debugger_arguments(\$args, \$exe, "$type"."_$idx");
3175
3172
 
3176
3173
}
3177
3174
 
3178
 
#
3179
 
# Modify the exe and args so that program is run in gdb in xterm
3180
 
#
3181
 
sub dbx_arguments {
3182
 
  my $args= shift;
3183
 
  my $exe=  shift;
3184
 
  my $type= shift;
3185
 
 
3186
 
  # Write $args to gdb init file
3187
 
  my $str= join(" ", @$$args);
3188
 
  my $dbx_init_file= "$opt_tmpdir/dbxinit.$type";
3189
 
 
3190
 
  # Remove the old gdbinit file
3191
 
  unlink($dbx_init_file);
3192
 
  if ( $type eq "client" )
3193
 
  {
3194
 
    # write init file for client
3195
 
    mtr_tofile($dbx_init_file,
3196
 
               "runargs $str\n" .
3197
 
               "run\n");
3198
 
  }
3199
 
  else
3200
 
  {
3201
 
    # write init file for drizzled
3202
 
    mtr_tofile($dbx_init_file,
3203
 
               "stop in mysql_parse\n" .
3204
 
               "runargs $str\n" .
3205
 
               "run\n" .
3206
 
               "\n");
3207
 
  }
3208
 
 
3209
 
  if ( $opt_manual_dbx )
3210
 
  {
3211
 
     print "\nTo start dbx for $type, type in another window:\n";
3212
 
     print "dbx -c 'source $dbx_init_file' $$exe\n";
3213
 
 
3214
 
     # Indicate the exe should not be started
3215
 
     $$exe= undef;
3216
 
     return;
3217
 
  }
3218
 
 
3219
 
  $$args= [];
3220
 
  mtr_add_arg($$args, "-title");
3221
 
  mtr_add_arg($$args, "$type");
3222
 
  mtr_add_arg($$args, "-e");
3223
 
 
3224
 
  mtr_add_arg($$args, "dbx");
3225
 
  mtr_add_arg($$args, "-c");
3226
 
  mtr_add_arg($$args, "source $dbx_init_file");
3227
 
  mtr_add_arg($$args, "$$exe");
3228
 
 
3229
 
  $$exe= "xterm";
3230
 
}
3231
3175
 
3232
3176
#
3233
3177
# Modify the exe and args so that program is run in gdb in xterm
3374
3318
    $$exe= $debugger;
3375
3319
 
3376
3320
  }
3377
 
  #elsif ( $debugger eq "dbx" )
3378
 
  #{
3379
 
  #  # xterm -e dbx -r exe arg1 .. argn
3380
 
#
3381
 
#    unshift(@$$args, $$exe);
3382
 
#    unshift(@$$args, "-r");
3383
 
#    unshift(@$$args, $debugger);
3384
 
#    unshift(@$$args, "-e");
3385
 
#
3386
 
#    $$exe= "xterm";
3387
 
#
3388
 
#  }
 
3321
  elsif ( $debugger eq "dbx" )
 
3322
  {
 
3323
    # xterm -e dbx -r exe arg1 .. argn
 
3324
 
 
3325
    unshift(@$$args, $$exe);
 
3326
    unshift(@$$args, "-r");
 
3327
    unshift(@$$args, $debugger);
 
3328
    unshift(@$$args, "-e");
 
3329
 
 
3330
    $$exe= "xterm";
 
3331
 
 
3332
  }
3389
3333
  else
3390
3334
  {
3391
3335
    mtr_error("Unknown argument \"$debugger\" passed to --debugger");