Dump result to .log file at test failure

parent 3495ba51
...@@ -427,6 +427,7 @@ static VAR* var_init(VAR* v, const char *name, int name_len, const char *val, ...@@ -427,6 +427,7 @@ static VAR* var_init(VAR* v, const char *name, int name_len, const char *val,
static void var_free(void* v); static void var_free(void* v);
void dump_result_to_reject_file(const char *record_file, char *buf, int size); void dump_result_to_reject_file(const char *record_file, char *buf, int size);
void dump_result_to_log_file(const char *record_file, char *buf, int size);
int close_connection(struct st_query*); int close_connection(struct st_query*);
static void set_charset(struct st_query*); static void set_charset(struct st_query*);
...@@ -634,9 +635,9 @@ static void die(const char *fmt, ...) ...@@ -634,9 +635,9 @@ static void die(const char *fmt, ...)
} }
va_end(args); va_end(args);
/* Dump the result that has been accumulated so far to reject file */ /* Dump the result that has been accumulated so far to .log file */
if (result_file && ds_res.length) if (result_file && ds_res.length)
dump_result_to_reject_file(result_file, ds_res.str, ds_res.length); dump_result_to_log_file(result_file, ds_res.str, ds_res.length);
/* Clean up and exit */ /* Clean up and exit */
free_used_memory(); free_used_memory();
...@@ -3139,6 +3140,12 @@ void dump_result_to_reject_file(const char *record_file, char *buf, int size) ...@@ -3139,6 +3140,12 @@ void dump_result_to_reject_file(const char *record_file, char *buf, int size)
str_to_file(fn_format(reject_file, record_file,"",".reject",2), buf, size); str_to_file(fn_format(reject_file, record_file,"",".reject",2), buf, size);
} }
void dump_result_to_log_file(const char *record_file, char *buf, int size)
{
char log_file[FN_REFLEN];
str_to_file(fn_format(log_file, record_file,"",".log",2), buf, size);
}
#ifdef __WIN__ #ifdef __WIN__
......
...@@ -36,6 +36,7 @@ sub mtr_show_failed_diff ($) { ...@@ -36,6 +36,7 @@ sub mtr_show_failed_diff ($) {
my $reject_file= "r/$tname.reject"; my $reject_file= "r/$tname.reject";
my $result_file= "r/$tname.result"; my $result_file= "r/$tname.result";
my $log_file= "r/$tname.log";
my $eval_file= "r/$tname.eval"; my $eval_file= "r/$tname.eval";
if ( $::opt_suite ne "main" ) if ( $::opt_suite ne "main" )
...@@ -43,10 +44,11 @@ sub mtr_show_failed_diff ($) { ...@@ -43,10 +44,11 @@ sub mtr_show_failed_diff ($) {
$reject_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$reject_file"; $reject_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$reject_file";
$result_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$result_file"; $result_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$result_file";
$eval_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$eval_file"; $eval_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$eval_file";
$log_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$log_file";
} }
if ( -f $eval_file ) if ( -f $eval_file )
{ {
$result_file= $eval_file; $result_file= $eval_file;
} }
elsif ( $::opt_result_ext and elsif ( $::opt_result_ext and
...@@ -70,6 +72,12 @@ sub mtr_show_failed_diff ($) { ...@@ -70,6 +72,12 @@ sub mtr_show_failed_diff ($) {
print "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html\n"; print "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html\n";
print "to find the reason to this problem and how to report this.\n\n"; print "to find the reason to this problem and how to report this.\n\n";
} }
if ( -f $log_file )
{
print "Result from queries before failure can be found in $log_file\n";
# FIXME Maybe a tail -f -n 10 $log_file here
}
} }
sub mtr_report_test_name ($) { sub mtr_report_test_name ($) {
......
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