3195 Bjorn Munch 2011-04-07
Bug #12316050 MTR: --REPORT-TIMES GIVES TOO HIGH NUMBER FOR INITIALIZATION
Forgot that the main thread would be idle while waiting for tests
Added sub mark_time_idle() so ignore time spent waiting
Also added a new time category 'admin' to take some of 'init'
modified:
mysql-test/lib/mtr_misc.pl
mysql-test/mysql-test-run.pl
3194 Bjorn Munch 2011-04-07
Bug #11760361 52764: EXTEND MYSQL-TEST-RUN SUPPORT FOR SUN STUDIO DBX BY ADDING --DBX DEBUGGER
Added necessary options and variables
Added dbx_arguments() similar to gdb_arguments()
Unlike gdb, cannot use init file but must provide commands and args as
command line argument to dbx
Also simplified debugger behavior to always start with a breakpoint in main()
modified:
mysql-test/mysql-test-run.pl
3193 Bjorn Munch 2011-04-05 [merge]
null upmerge
=== modified file 'mysql-test/lib/mtr_misc.pl'
--- a/mysql-test/lib/mtr_misc.pl 2011-01-18 10:21:37 +0000
+++ b/mysql-test/lib/mtr_misc.pl 2011-04-07 08:12:52 +0000
@@ -1,5 +1,5 @@
# -*- cperl -*-
-# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -36,6 +36,7 @@ sub start_timer($);
sub has_expired($);
sub init_timers();
sub mark_time_used($);
+sub mark_time_idle();
sub add_total_times($);
sub print_times_used($$);
sub print_total_times($);
@@ -224,6 +225,7 @@ my %time_used= (
'ch-warn' => 0,
'test' => 0,
'init' => 0,
+ 'admin' => 0,
);
my %time_text= (
@@ -232,7 +234,8 @@ my %time_text= (
'check' => "Check-testcase",
'ch-warn' => "Check for warnings",
'test' => "Test execution",
- 'init' => "Initialization etc.",
+ 'init' => "Initialization/cleanup",
+ 'admin' => "Test administration",
);
# Counts number of reports from workers
@@ -255,6 +258,10 @@ sub mark_time_used($) {
$last_timer_set= $curr_time;
}
+sub mark_time_idle() {
+ $last_timer_set= gettimeofday() if $opt_report_times;
+}
+
sub add_total_times($) {
my ($dummy, $num, @line)= split (" ", $_[0]);
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2011-03-16 14:11:20 +0000
+++ b/mysql-test/mysql-test-run.pl 2011-04-07 08:12:52 +0000
@@ -219,9 +219,12 @@ our %gprof_dirs;
our $glob_debugger= 0;
our $opt_gdb;
our $opt_client_gdb;
+our $opt_dbx;
+our $opt_client_dbx;
our $opt_ddd;
our $opt_client_ddd;
our $opt_manual_gdb;
+our $opt_manual_dbx;
our $opt_manual_ddd;
our $opt_manual_debug;
our $opt_debugger;
@@ -546,7 +549,9 @@ sub run_test_server ($$$) {
my $s= IO::Select->new();
$s->add($server);
while (1) {
+ mark_time_used('admin');
my @ready = $s->can_read(1); # Wake up once every second
+ mark_time_idle();
foreach my $sock (@ready) {
if ($sock == $server) {
# New client connected
@@ -888,7 +893,7 @@ sub run_worker ($) {
if ( $opt_gprof ) {
gprof_collect (find_mysqld($basedir), keys %gprof_dirs);
}
- mark_time_used('init');
+ mark_time_used('admin');
print_times_used($server, $thread_num);
exit($valgrind_reports);
}
@@ -1001,6 +1006,9 @@ sub command_line_setup {
'ddd' => \$opt_ddd,
'client-ddd' => \$opt_client_ddd,
'manual-ddd' => \$opt_manual_ddd,
+ 'dbx' => \$opt_dbx,
+ 'client-dbx' => \$opt_client_dbx,
+ 'manual-dbx' => \$opt_manual_dbx,
'debugger=s' => \$opt_debugger,
'client-debugger=s' => \$opt_client_debugger,
'strace-client:s' => \$opt_strace_client,
@@ -1426,6 +1434,12 @@ sub command_line_setup {
$opt_ddd= undef;
}
+ if ($opt_dbx) {
+ mtr_warning("Silently converting --dbx to --client-dbx in embedded mode");
+ $opt_client_dbx= $opt_dbx;
+ $opt_dbx= undef;
+ }
+
if ($opt_debugger)
{
mtr_warning("Silently converting --debugger to --client-debugger in embedded mode");
@@ -1434,7 +1448,7 @@ sub command_line_setup {
}
if ( $opt_gdb || $opt_ddd || $opt_manual_gdb || $opt_manual_ddd ||
- $opt_manual_debug || $opt_debugger )
+ $opt_manual_debug || $opt_debugger || $opt_dbx || $opt_manual_dbx)
{
mtr_error("You need to use the client debug options for the",
"embedded server. Ex: --client-gdb");
@@ -1462,6 +1476,7 @@ sub command_line_setup {
# --------------------------------------------------------------------------
if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
$opt_manual_gdb || $opt_manual_ddd || $opt_manual_debug ||
+ $opt_dbx || $opt_client_dbx || $opt_manual_dbx ||
$opt_debugger || $opt_client_debugger )
{
# Indicate that we are using debugger
@@ -3762,7 +3777,7 @@ sub run_testcase ($) {
do_before_run_mysqltest($tinfo);
- mark_time_used('init');
+ mark_time_used('admin');
if ( $opt_check_testcases and check_testcase($tinfo, "before") ){
# Failed to record state of server or server crashed
@@ -4704,6 +4719,9 @@ sub mysqld_start ($$) {
{
ddd_arguments(\$args, \$exe, $mysqld->name());
}
+ if ( $opt_dbx || $opt_manual_dbx ) {
+ dbx_arguments(\$args, \$exe, $mysqld->name());
+ }
elsif ( $opt_debugger )
{
debugger_arguments(\$args, \$exe, $mysqld->name());
@@ -5232,7 +5250,7 @@ sub start_mysqltest ($) {
my $exe= $exe_mysqltest;
my $args;
- mark_time_used('init');
+ mark_time_used('admin');
mtr_init_args(\$args);
@@ -5374,6 +5392,9 @@ sub start_mysqltest ($) {
{
ddd_arguments(\$args, \$exe, "client");
}
+ if ( $opt_client_dbx ) {
+ dbx_arguments(\$args, \$exe, "client");
+ }
elsif ( $opt_client_debugger )
{
debugger_arguments(\$args, \$exe, "client");
@@ -5408,23 +5429,11 @@ sub gdb_arguments {
# Remove the old gdbinit file
unlink($gdb_init_file);
- if ( $type eq "client" )
- {
- # write init file for client
- mtr_tofile($gdb_init_file,
- "set args $str\n" .
- "break main\n");
- }
- else
- {
- # write init file for mysqld
- mtr_tofile($gdb_init_file,
- "set args $str\n" .
- "break mysql_parse\n" .
- "commands 1\n" .
- "disable 1\n" .
- "end\n");
- }
+ # write init file for mysqld or client
+ mtr_tofile($gdb_init_file,
+ "set args $str\n" .
+ "break main\n" .
+ "run");
if ( $opt_manual_gdb )
{
@@ -5471,24 +5480,12 @@ sub ddd_arguments {
# Remove the old gdbinit file
unlink($gdb_init_file);
- if ( $type eq "client" )
- {
- # write init file for client
- mtr_tofile($gdb_init_file,
- "set args $str\n" .
- "break main\n");
- }
- else
- {
- # write init file for mysqld
- mtr_tofile($gdb_init_file,
- "file $$exe\n" .
- "set args $str\n" .
- "break mysql_parse\n" .
- "commands 1\n" .
- "disable 1\n" .
- "end");
- }
+ # write init file for mysqld or client
+ mtr_tofile($gdb_init_file,
+ "file $$exe\n" .
+ "set args $str\n" .
+ "break main\n" .
+ "run");
if ( $opt_manual_ddd )
{
@@ -5518,6 +5515,46 @@ sub ddd_arguments {
#
+# Modify the exe and args so that program is run in dbx in xterm
+#
+sub dbx_arguments {
+ my $args= shift;
+ my $exe= shift;
+ my $type= shift;
+
+ # Put $args into a single string
+ my $str= join " ", @$$args;
+
+ if ( $opt_manual_dbx ) {
+ print "\nTo start dbx for $type, type in another window:\n";
+ print "cd $glob_mysql_test_dir; dbx -c \"stop in main; " .
+ "run $str\" $$exe\n";
+
+ # Indicate the exe should not be started
+ $$exe= undef;
+ return;
+ }
+
+ $$args= [];
+ mtr_add_arg($$args, "-title");
+ mtr_add_arg($$args, "$type");
+ mtr_add_arg($$args, "-e");
+
+ if ( $exe_libtool ) {
+ mtr_add_arg($$args, $exe_libtool);
+ mtr_add_arg($$args, "--mode=execute");
+ }
+
+ mtr_add_arg($$args, "dbx");
+ mtr_add_arg($$args, "-c");
+ mtr_add_arg($$args, "stop in main; run $str");
+ mtr_add_arg($$args, "$$exe");
+
+ $$exe= "xterm";
+}
+
+
+#
# Modify the exe and args so that program is run in the selected debugger
#
sub debugger_arguments {
@@ -5548,18 +5585,6 @@ sub debugger_arguments {
$$exe= $debugger;
}
- elsif ( $debugger eq "dbx" )
- {
- # xterm -e dbx -r exe arg1 .. argn
-
- unshift(@$$args, $$exe);
- unshift(@$$args, "-r");
- unshift(@$$args, $debugger);
- unshift(@$$args, "-e");
-
- $$exe= "xterm";
-
- }
else
{
mtr_error("Unknown argument \"$debugger\" passed to --debugger");
@@ -5860,6 +5885,7 @@ Options for debugging the product
client-ddd Start mysqltest client in ddd
client-debugger=NAME Start mysqltest in the selected debugger
client-gdb Start mysqltest client in gdb
+ client-dbx Start mysqltest client in dbx
ddd Start mysqld in ddd
debug Dump trace output for all servers and client programs
debug-common Same as debug, but sets 'd' debug flags to
@@ -5868,12 +5894,15 @@ Options for debugging the product
tracing
debugger=NAME Start mysqld in the selected debugger
gdb Start the mysqld(s) in gdb
+ dbx Start the mysqld(s) in dbx
manual-debug Let user manually start mysqld in debugger, before
running test(s)
manual-gdb Let user manually start mysqld in gdb, before running
test(s)
manual-ddd Let user manually start mysqld in ddd, before running
test(s)
+ manual-dbx Let user manually start mysqld in dbx, before running
+ test(s)
strace-client[=path] Create strace output for mysqltest client, optionally
specifying name and path to the trace program to use.
Example: $0 --strace-client=ktrace
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.5-mtr branch (bjorn.munch:3193 to 3195) Bug#12316050 | Bjorn Munch | 7 Apr |