Dump result to .log file at test failure

client/mysqltest.c:
  Dump accumulated result upuntil test failure into a <testname>.log file for later examination
mysql-test/lib/mtr_report.pl:
  Inform about the <testname>.log file's existence
This commit is contained in:
unknown 2006-03-23 21:48:31 +01:00
parent 6662707f74
commit 636064c0ba
2 changed files with 18 additions and 3 deletions

View file

@ -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);
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*);
static void set_charset(struct st_query*);
@ -634,9 +635,9 @@ static void die(const char *fmt, ...)
}
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)
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 */
free_used_memory();
@ -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);
}
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__

View file

@ -36,6 +36,7 @@ sub mtr_show_failed_diff ($) {
my $reject_file= "r/$tname.reject";
my $result_file= "r/$tname.result";
my $log_file= "r/$tname.log";
my $eval_file= "r/$tname.eval";
if ( $::opt_suite ne "main" )
@ -43,10 +44,11 @@ sub mtr_show_failed_diff ($) {
$reject_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$reject_file";
$result_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$result_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 )
{
{
$result_file= $eval_file;
}
elsif ( $::opt_result_ext and
@ -70,6 +72,12 @@ sub mtr_show_failed_diff ($) {
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";
}
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 ($) {