Commit bdbe393d authored by Rafal Somla's avatar Rafal Somla

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
parent 05b6c271
...@@ -4647,6 +4647,10 @@ void safe_connect(MYSQL* mysql, const char *name, const char *host, ...@@ -4647,6 +4647,10 @@ void safe_connect(MYSQL* mysql, const char *name, const char *host,
int failed_attempts= 0; int failed_attempts= 0;
DBUG_ENTER("safe_connect"); 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, while(!mysql_real_connect(mysql, host,user, pass, db, port, sock,
CLIENT_MULTI_STATEMENTS | CLIENT_REMEMBER_OPTIONS)) CLIENT_MULTI_STATEMENTS | CLIENT_REMEMBER_OPTIONS))
{ {
...@@ -4678,6 +4682,7 @@ void safe_connect(MYSQL* mysql, const char *name, const char *host, ...@@ -4678,6 +4682,7 @@ void safe_connect(MYSQL* mysql, const char *name, const char *host,
} }
failed_attempts++; failed_attempts++;
} }
verbose_msg("... Connected.");
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -7511,8 +7516,12 @@ int main(int argc, char **argv) ...@@ -7511,8 +7516,12 @@ int main(int argc, char **argv)
parse_args(argc, argv); parse_args(argc, argv);
log_file.open(opt_logdir, result_file_name, ".log"); log_file.open(opt_logdir, result_file_name, ".log");
verbose_msg("Logging to '%s'.", log_file.file_name());
if (opt_mark_progress) if (opt_mark_progress)
{
progress_file.open(opt_logdir, result_file_name, ".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("$PS_PROTOCOL", ps_protocol);
var_set_int("$SP_PROTOCOL", sp_protocol); var_set_int("$SP_PROTOCOL", sp_protocol);
...@@ -7521,6 +7530,8 @@ int main(int argc, char **argv) ...@@ -7521,6 +7530,8 @@ int main(int argc, char **argv)
DBUG_PRINT("info",("result_file: '%s'", DBUG_PRINT("info",("result_file: '%s'",
result_file_name ? result_file_name : "")); 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, if (mysql_server_init(embedded_server_arg_count,
embedded_server_args, embedded_server_args,
(char**) embedded_server_groups)) (char**) embedded_server_groups))
...@@ -7591,6 +7602,7 @@ int main(int argc, char **argv) ...@@ -7591,6 +7602,7 @@ int main(int argc, char **argv)
open_file(opt_include); open_file(opt_include);
} }
verbose_msg("Start processing test commands from '%s' ...", cur_file->file_name);
while (!read_command(&command) && !abort_flag) while (!read_command(&command) && !abort_flag)
{ {
int current_line_inc = 1, processed = 0; int current_line_inc = 1, processed = 0;
...@@ -7908,6 +7920,7 @@ int main(int argc, char **argv) ...@@ -7908,6 +7920,7 @@ int main(int argc, char **argv)
log_file.close(); log_file.close();
start_lineno= 0; start_lineno= 0;
verbose_msg("... Done processing test commands.");
if (parsing_disabled) if (parsing_disabled)
die("Test ended with parsing disabled"); die("Test ended with parsing disabled");
...@@ -7958,6 +7971,7 @@ int main(int argc, char **argv) ...@@ -7958,6 +7971,7 @@ int main(int argc, char **argv)
if (!command_executed && result_file_name) if (!command_executed && result_file_name)
die("No queries executed but result file found!"); die("No queries executed but result file found!");
verbose_msg("Test has succeeded!");
timer_output(); timer_output();
/* Yes, if we got this far the test has suceeded! Sakila smiles */ /* Yes, if we got this far the test has suceeded! Sakila smiles */
cleanup_and_exit(0); cleanup_and_exit(0);
......
...@@ -2874,9 +2874,6 @@ test case was executed:\n"; ...@@ -2874,9 +2874,6 @@ test case was executed:\n";
$result= 2; $result= 2;
} }
# Remove the .err file the check generated
unlink($err_file);
# Remove the .result file the check generated # Remove the .result file the check generated
unlink("$base_file.result"); unlink("$base_file.result");
...@@ -3494,6 +3491,7 @@ sub start_check_warnings ($$) { ...@@ -3494,6 +3491,7 @@ sub start_check_warnings ($$) {
mtr_add_arg($args, "--skip-safemalloc"); mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--test-file=%s", "include/check-warnings.test"); mtr_add_arg($args, "--test-file=%s", "include/check-warnings.test");
mtr_add_arg($args, "--verbose");
if ( $opt_embedded_server ) if ( $opt_embedded_server )
{ {
...@@ -3583,10 +3581,9 @@ sub check_warnings ($) { ...@@ -3583,10 +3581,9 @@ sub check_warnings ($) {
if ( $res == 62 ) { if ( $res == 62 ) {
# Test case was ok and called "skip" # Test case was ok and called "skip"
;
}
# Remove the .err file the check generated # Remove the .err file the check generated
unlink($err_file); unlink($err_file);
}
if ( keys(%started) == 0){ if ( keys(%started) == 0){
# All checks completed # All checks completed
...@@ -3608,8 +3605,6 @@ sub check_warnings ($) { ...@@ -3608,8 +3605,6 @@ sub check_warnings ($) {
$result= 2; $result= 2;
} }
# Remove the .err file the check generated
unlink($err_file);
} }
elsif ( $proc eq $timeout_proc ) { elsif ( $proc eq $timeout_proc ) {
$tinfo->{comment}.= "Timeout $timeout_proc for ". $tinfo->{comment}.= "Timeout $timeout_proc for ".
...@@ -4493,6 +4488,7 @@ sub start_check_testcase ($$$) { ...@@ -4493,6 +4488,7 @@ sub start_check_testcase ($$$) {
mtr_add_arg($args, "--result-file=%s", "$opt_vardir/tmp/$name.result"); 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, "--test-file=%s", "include/check-testcase.test");
mtr_add_arg($args, "--verbose");
if ( $mode eq "before" ) if ( $mode eq "before" )
{ {
...@@ -4664,7 +4660,6 @@ sub start_mysqltest ($) { ...@@ -4664,7 +4660,6 @@ sub start_mysqltest ($) {
debugger_arguments(\$args, \$exe, "client"); debugger_arguments(\$args, \$exe, "client");
} }
my $proc= My::SafeProcess->new my $proc= My::SafeProcess->new
( (
name => "mysqltest", name => "mysqltest",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment