mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Bug #59002 Please make mtr print correct file and line number when tests fail
This patchs adds printing of a file stack (with line numbers) It does not fix the problem of a failure in the non-first iteration of a loop
This commit is contained in:
parent
18073b1dec
commit
8645caf79d
1 changed files with 18 additions and 9 deletions
|
@ -1238,6 +1238,17 @@ static void cleanup_and_exit(int exit_code)
|
|||
exit(exit_code);
|
||||
}
|
||||
|
||||
void print_file_stack()
|
||||
{
|
||||
for (struct st_test_file* err_file= cur_file;
|
||||
err_file != file_stack;
|
||||
err_file--)
|
||||
{
|
||||
fprintf(stderr, "included from %s at line %d:\n",
|
||||
err_file->file_name, err_file->lineno);
|
||||
}
|
||||
}
|
||||
|
||||
void die(const char *fmt, ...)
|
||||
{
|
||||
static int dying= 0;
|
||||
|
@ -1257,8 +1268,12 @@ void die(const char *fmt, ...)
|
|||
/* Print the error message */
|
||||
fprintf(stderr, "mysqltest: ");
|
||||
if (cur_file && cur_file != file_stack)
|
||||
fprintf(stderr, "In included file \"%s\": ",
|
||||
{
|
||||
fprintf(stderr, "In included file \"%s\": \n",
|
||||
cur_file->file_name);
|
||||
print_file_stack();
|
||||
}
|
||||
|
||||
if (start_lineno > 0)
|
||||
fprintf(stderr, "At line %u: ", start_lineno);
|
||||
if (fmt)
|
||||
|
@ -1288,20 +1303,14 @@ void die(const char *fmt, ...)
|
|||
void abort_not_supported_test(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
struct st_test_file* err_file= cur_file;
|
||||
DBUG_ENTER("abort_not_supported_test");
|
||||
|
||||
/* Print include filestack */
|
||||
fprintf(stderr, "The test '%s' is not supported by this installation\n",
|
||||
file_stack->file_name);
|
||||
fprintf(stderr, "Detected in file %s at line %d\n",
|
||||
err_file->file_name, err_file->lineno);
|
||||
while (err_file != file_stack)
|
||||
{
|
||||
err_file--;
|
||||
fprintf(stderr, "included from %s at line %d\n",
|
||||
err_file->file_name, err_file->lineno);
|
||||
}
|
||||
cur_file->file_name, cur_file->lineno);
|
||||
print_file_stack();
|
||||
|
||||
/* Print error message */
|
||||
va_start(args, fmt);
|
||||
|
|
Loading…
Reference in a new issue