mirror of
https://github.com/MariaDB/server.git
synced 2025-08-05 13:16:09 +03: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:
@@ -1238,6 +1238,17 @@ static void cleanup_and_exit(int exit_code)
|
|||||||
exit(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, ...)
|
void die(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
static int dying= 0;
|
static int dying= 0;
|
||||||
@@ -1257,8 +1268,12 @@ void die(const char *fmt, ...)
|
|||||||
/* Print the error message */
|
/* Print the error message */
|
||||||
fprintf(stderr, "mysqltest: ");
|
fprintf(stderr, "mysqltest: ");
|
||||||
if (cur_file && cur_file != file_stack)
|
if (cur_file && cur_file != file_stack)
|
||||||
fprintf(stderr, "In included file \"%s\": ",
|
{
|
||||||
|
fprintf(stderr, "In included file \"%s\": \n",
|
||||||
cur_file->file_name);
|
cur_file->file_name);
|
||||||
|
print_file_stack();
|
||||||
|
}
|
||||||
|
|
||||||
if (start_lineno > 0)
|
if (start_lineno > 0)
|
||||||
fprintf(stderr, "At line %u: ", start_lineno);
|
fprintf(stderr, "At line %u: ", start_lineno);
|
||||||
if (fmt)
|
if (fmt)
|
||||||
@@ -1288,20 +1303,14 @@ void die(const char *fmt, ...)
|
|||||||
void abort_not_supported_test(const char *fmt, ...)
|
void abort_not_supported_test(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
struct st_test_file* err_file= cur_file;
|
|
||||||
DBUG_ENTER("abort_not_supported_test");
|
DBUG_ENTER("abort_not_supported_test");
|
||||||
|
|
||||||
/* Print include filestack */
|
/* Print include filestack */
|
||||||
fprintf(stderr, "The test '%s' is not supported by this installation\n",
|
fprintf(stderr, "The test '%s' is not supported by this installation\n",
|
||||||
file_stack->file_name);
|
file_stack->file_name);
|
||||||
fprintf(stderr, "Detected in file %s at line %d\n",
|
fprintf(stderr, "Detected in file %s at line %d\n",
|
||||||
err_file->file_name, err_file->lineno);
|
cur_file->file_name, cur_file->lineno);
|
||||||
while (err_file != file_stack)
|
print_file_stack();
|
||||||
{
|
|
||||||
err_file--;
|
|
||||||
fprintf(stderr, "included from %s at line %d\n",
|
|
||||||
err_file->file_name, err_file->lineno);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Print error message */
|
/* Print error message */
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
|
Reference in New Issue
Block a user