Modifications to MTR and mysqltest to improve feedback from the latter when

testcase checks are made.
      
MTR spawns mysqltest to run check-testcase test before and after each testcase 
it runs. It can also run check-warnings using mysqltest. Since it happened on PB 
that these checks hanged, this patch provides additional feedback to help 
investigating such failures:
      
- mysqltest is modified to give feedback about main steps in execution of a 
testcase if run in verbose mode (including connection to the server),
     
- MTR is modified to run mysqltest in verbose mode when doing check-testcase or 
check-warnings. The diagnostic output from mysqltest is preserved so that it is 
saved upon test failure.

client/mysqltest.cc:
  Add verbose messages informing about main steps in execution of a testcase.
mysql-test/mysql-test-run.pl:
  - When doing check-testcase or check-warnings run mysqltest in verbose mode.
  - Do not delete the mysqltest's error log if errors are detected during these
This commit is contained in:
Rafal Somla 2009-02-13 16:27:33 +01:00
parent 05b6c2713e
commit bdbe393db1
2 changed files with 19 additions and 10 deletions

View File

@ -4647,6 +4647,10 @@ void safe_connect(MYSQL* mysql, const char *name, const char *host,
int failed_attempts= 0;
DBUG_ENTER("safe_connect");
verbose_msg("Connecting to server %s:%d (socket %s) as '%s'"
", connection '%s', attempt %d ...",
host, port, sock, user, name, failed_attempts);
while(!mysql_real_connect(mysql, host,user, pass, db, port, sock,
CLIENT_MULTI_STATEMENTS | CLIENT_REMEMBER_OPTIONS))
{
@ -4678,6 +4682,7 @@ void safe_connect(MYSQL* mysql, const char *name, const char *host,
}
failed_attempts++;
}
verbose_msg("... Connected.");
DBUG_VOID_RETURN;
}
@ -7511,8 +7516,12 @@ int main(int argc, char **argv)
parse_args(argc, argv);
log_file.open(opt_logdir, result_file_name, ".log");
verbose_msg("Logging to '%s'.", log_file.file_name());
if (opt_mark_progress)
{
progress_file.open(opt_logdir, result_file_name, ".progress");
verbose_msg("Tracing progress in '%s'.", progress_file.file_name());
}
var_set_int("$PS_PROTOCOL", ps_protocol);
var_set_int("$SP_PROTOCOL", sp_protocol);
@ -7521,6 +7530,8 @@ int main(int argc, char **argv)
DBUG_PRINT("info",("result_file: '%s'",
result_file_name ? result_file_name : ""));
verbose_msg("Results saved in '%s'.",
result_file_name ? result_file_name : "");
if (mysql_server_init(embedded_server_arg_count,
embedded_server_args,
(char**) embedded_server_groups))
@ -7591,6 +7602,7 @@ int main(int argc, char **argv)
open_file(opt_include);
}
verbose_msg("Start processing test commands from '%s' ...", cur_file->file_name);
while (!read_command(&command) && !abort_flag)
{
int current_line_inc = 1, processed = 0;
@ -7908,6 +7920,7 @@ int main(int argc, char **argv)
log_file.close();
start_lineno= 0;
verbose_msg("... Done processing test commands.");
if (parsing_disabled)
die("Test ended with parsing disabled");
@ -7958,6 +7971,7 @@ int main(int argc, char **argv)
if (!command_executed && result_file_name)
die("No queries executed but result file found!");
verbose_msg("Test has succeeded!");
timer_output();
/* Yes, if we got this far the test has suceeded! Sakila smiles */
cleanup_and_exit(0);

View File

@ -2874,9 +2874,6 @@ test case was executed:\n";
$result= 2;
}
# Remove the .err file the check generated
unlink($err_file);
# Remove the .result file the check generated
unlink("$base_file.result");
@ -3494,6 +3491,7 @@ sub start_check_warnings ($$) {
mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--test-file=%s", "include/check-warnings.test");
mtr_add_arg($args, "--verbose");
if ( $opt_embedded_server )
{
@ -3583,10 +3581,9 @@ sub check_warnings ($) {
if ( $res == 62 ) {
# Test case was ok and called "skip"
;
# Remove the .err file the check generated
unlink($err_file);
}
# Remove the .err file the check generated
unlink($err_file);
if ( keys(%started) == 0){
# All checks completed
@ -3608,8 +3605,6 @@ sub check_warnings ($) {
$result= 2;
}
# Remove the .err file the check generated
unlink($err_file);
}
elsif ( $proc eq $timeout_proc ) {
$tinfo->{comment}.= "Timeout $timeout_proc for ".
@ -4493,6 +4488,7 @@ sub start_check_testcase ($$$) {
mtr_add_arg($args, "--result-file=%s", "$opt_vardir/tmp/$name.result");
mtr_add_arg($args, "--test-file=%s", "include/check-testcase.test");
mtr_add_arg($args, "--verbose");
if ( $mode eq "before" )
{
@ -4662,8 +4658,7 @@ sub start_mysqltest ($) {
elsif ( $opt_client_debugger )
{
debugger_arguments(\$args, \$exe, "client");
}
}
my $proc= My::SafeProcess->new
(