List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:January 11 2011 9:52am
Subject:bzr commit into mysql-5.1-mtr branch (bjorn.munch:2964) Bug#59002
View as plain text  
#At file:///home/bm136801/my/lineno-51/ based on revid:bjorn.munch@stripped

 2964 Bjorn Munch	2011-01-11
      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

    modified:
      client/mysqltest.cc
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2010-12-29 15:01:07 +0000
+++ b/client/mysqltest.cc	2011-01-11 09:51:31 +0000
@@ -1238,6 +1238,17 @@ static void cleanup_and_exit(int exit_co
   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);


Attachment: [text/bzr-bundle] bzr/bjorn.munch@oracle.com-20110111095131-hha018k75s513ubi.bundle
Thread
bzr commit into mysql-5.1-mtr branch (bjorn.munch:2964) Bug#59002Bjorn Munch11 Jan