~posulliv/drizzle/memcached_applier

« back to all changes in this revision

Viewing changes to tests/test-run.pl

Merge trunk

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;
124
125
 
125
126
our $default_vardir;
126
127
 
179
180
 
180
181
our $glob_debugger= 0;
181
182
our $opt_gdb;
 
183
our $opt_dbx;
182
184
our $opt_client_gdb;
 
185
our $opt_client_dbx;
 
186
our $opt_dbx_gdb;
183
187
our $opt_ddd;
184
188
our $opt_client_ddd;
185
189
our $opt_manual_gdb;
 
190
our $opt_manual_dbx;
186
191
our $opt_manual_ddd;
187
192
our $opt_manual_debug;
188
193
# Magic number -69.4 results in traditional test ports starting from 9306.
488
493
             # Run test on running server
489
494
             'extern'                   => \$opt_extern,
490
495
 
 
496
             # Output format
 
497
             'subunit'                  => \$opt_subunit,
 
498
 
491
499
             # Debugging
492
500
             'gdb'                      => \$opt_gdb,
 
501
             'dbx'                      => \$opt_dbx,
493
502
             'client-gdb'               => \$opt_client_gdb,
 
503
             'client-dbx'               => \$opt_client_dbx,
494
504
             'manual-gdb'               => \$opt_manual_gdb,
 
505
             'manual-dbx'               => \$opt_manual_dbx,
495
506
             'manual-debug'             => \$opt_manual_debug,
496
507
             'ddd'                      => \$opt_ddd,
497
508
             'client-ddd'               => \$opt_client_ddd,
570
581
 
571
582
  usage("") if $opt_usage;
572
583
 
 
584
  usage("you cannot specify --gdb and --dbx both!") if 
 
585
        ($opt_gdb && $opt_dbx) ||
 
586
        ($opt_manual_gdb && $opt_manual_dbx);
 
587
 
573
588
  $glob_scriptname=  basename($0);
574
589
 
575
590
  if ($opt_mtr_build_thread != 0)
790
805
  # --------------------------------------------------------------------------
791
806
  if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
792
807
       $opt_manual_gdb || $opt_manual_ddd || $opt_manual_debug ||
793
 
       $opt_debugger || $opt_client_debugger )
 
808
       $opt_debugger || $opt_client_debugger || $opt_gdb || $opt_manual_gdb)
794
809
  {
795
810
    # Indicate that we are using debugger
796
811
    $glob_debugger= 1;
2568
2583
  {
2569
2584
    ddd_arguments(\$args, \$exe, "$type"."_$idx");
2570
2585
  }
 
2586
  if ( $opt_dbx || $opt_manual_dbx)
 
2587
  {
 
2588
    dbx_arguments(\$args, \$exe, "$type"."_$idx");
 
2589
  }
2571
2590
  elsif ( $opt_debugger )
2572
2591
  {
2573
2592
    debugger_arguments(\$args, \$exe, "$type"."_$idx");
3156
3175
 
3157
3176
}
3158
3177
 
 
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
}
3159
3231
 
3160
3232
#
3161
3233
# Modify the exe and args so that program is run in gdb in xterm
3302
3374
    $$exe= $debugger;
3303
3375
 
3304
3376
  }
3305
 
  elsif ( $debugger eq "dbx" )
3306
 
  {
3307
 
    # xterm -e dbx -r exe arg1 .. argn
3308
 
 
3309
 
    unshift(@$$args, $$exe);
3310
 
    unshift(@$$args, "-r");
3311
 
    unshift(@$$args, $debugger);
3312
 
    unshift(@$$args, "-e");
3313
 
 
3314
 
    $$exe= "xterm";
3315
 
 
3316
 
  }
 
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
#  }
3317
3389
  else
3318
3390
  {
3319
3391
    mtr_error("Unknown argument \"$debugger\" passed to --debugger");