summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorBjorn Munch <bjorn.munch@oracle.com>2011-01-11 10:51:31 +0100
committerBjorn Munch <bjorn.munch@oracle.com>2011-01-11 10:51:31 +0100
commit8645caf79d7e0c5b46fd539b1d29f43e53bc0eac (patch)
treee309d17827bf081b3a6542e82029c26c2c2b86ad /client
parent18073b1dec3d8cb04990435b84c419debc158f0c (diff)
downloadmariadb-git-8645caf79d7e0c5b46fd539b1d29f43e53bc0eac.tar.gz
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
Diffstat (limited to 'client')
-rw-r--r--client/mysqltest.cc27
1 files changed, 18 insertions, 9 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index a12c56c9657..38f8516f7da 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -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);