List:Internals« Previous MessageNext Message »
From:jani Date:September 20 2005 12:32pm
Subject:bk commit into 5.0 tree (jani:1.1989)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jani. When jani does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1989 05/09/20 13:32:33 jani@stripped +1 -0
  Merge jamppa@stripped:/home/bk/mysql-5.0
  into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0

  client/mysqltest.c
    1.161 05/09/20 13:32:25 jani@stripped +0 -0
    Auto merged

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jani
# Host:	ua141d10.elisa.omakaista.fi
# Root:	/home/my/bk/mysql-5.0/RESYNC

--- 1.160/client/mysqltest.c	2005-09-15 22:05:09 +03:00
+++ 1.161/client/mysqltest.c	2005-09-20 13:32:25 +03:00
@@ -98,6 +98,10 @@
 #define DEFAULT_DELIMITER ";"
 #define MAX_DELIMITER 16
 
+#define RESULT_OK 0
+#define RESULT_CONTENT_MISMATCH 1
+#define RESULT_LENGTH_MISMATCH 2
+
 enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD,
       OPT_MANAGER_PORT,OPT_MANAGER_WAIT_TIMEOUT, OPT_SKIP_SAFEMALLOC,
       OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH,
@@ -679,7 +683,7 @@
     DBUG_PRINT("info",("Size differs:  result size: %u  file size: %u",
 		       ds->length, stat_info.st_size));
     DBUG_PRINT("info",("result: '%s'", ds->str));
-    DBUG_RETURN(2);
+    DBUG_RETURN(RESULT_LENGTH_MISMATCH);
   }
   if (!(tmp = (char*) my_malloc(stat_info.st_size + 1, MYF(MY_WME))))
     die(NullS);
@@ -696,7 +700,7 @@
     res_ptr = res_ds.str;
     if ((res_len = res_ds.length) != ds->length)
     {
-      res = 2;
+      res= RESULT_LENGTH_MISMATCH;
       goto err;
     }
   }
@@ -706,7 +710,8 @@
     res_len = stat_info.st_size;
   }
 
-  res = (memcmp(res_ptr, ds->str, res_len)) ?  1 : 0;
+  res= (memcmp(res_ptr, ds->str, res_len)) ?
+    RESULT_CONTENT_MISMATCH : RESULT_OK;
 
 err:
   if (res && eval_result)
@@ -723,22 +728,23 @@
 static int check_result(DYNAMIC_STRING* ds, const char *fname,
 			my_bool require_option)
 {
-  int error = 0;
-  int res=dyn_string_cmp(ds, fname);
+  int error= RESULT_OK;
+  int res= dyn_string_cmp(ds, fname);
+
   DBUG_ENTER("check_result");
 
   if (res && require_option)
     abort_not_supported_test();
   switch (res) {
-  case 0:
+  case RESULT_OK:
     break; /* ok */
-  case 2:
+  case RESULT_LENGTH_MISMATCH:
     verbose_msg("Result length mismatch");
-    error = 1;
+    error= RESULT_LENGTH_MISMATCH;
     break;
-  case 1:
+  case RESULT_CONTENT_MISMATCH:
     verbose_msg("Result content mismatch");
-    error = 1;
+    error= RESULT_CONTENT_MISMATCH;
     break;
   default: /* impossible */
     die("Unknown error code from dyn_string_cmp()");
@@ -3944,8 +3950,10 @@
 {
   int error = 0;
   struct st_query *q;
-  my_bool require_file=0, q_send_flag=0, abort_flag= 0;
+  my_bool require_file=0, q_send_flag=0, abort_flag= 0,
+          query_executed= 0;
   char save_file[FN_REFLEN];
+  MY_STAT res_info;
   MY_INIT(argv[0]);
 
   /* Use all time until exit if no explicit 'start_timer' */
@@ -4141,6 +4149,7 @@
 	  save_file[0]=0;
 	}
 	error |= run_query(&cur_con->mysql, q, flags);
+	query_executed= 1;
         q->last_argument= q->end;
 	break;
       }
@@ -4161,6 +4170,7 @@
 	  is given on this connection.
 	 */
 	error |= run_query(&cur_con->mysql, q, QUERY_SEND);
+	query_executed= 1;
         q->last_argument= q->end;
 	break;
       case Q_RESULT:
@@ -4201,6 +4211,7 @@
 	break;
       case Q_EXEC:
 	do_exec(q);
+	query_executed= 1;
 	break;
       case Q_START_TIMER:
 	/* Overwrite possible earlier start of timer */
@@ -4280,6 +4291,18 @@
     parser.current_line += current_line_inc;
   }
 
+  if (!query_executed && result_file && my_stat(result_file,
&res_info, 0))
+  {
+    /*
+      my_stat() successful on result file. Check if we have not run a
+      single query, but we do have a result file that contains data.
+      Note that we don't care, if my_stat() fails. For example for
+      non-existing or non-readable file we assume it's fine to have
+      no query output from the test file, e.g. regarded as no error.
+    */
+    if (res_info.st_size)
+      error|= (RESULT_CONTENT_MISMATCH | RESULT_LENGTH_MISMATCH);
+  }
   if (result_file && ds_res.length && !error)
   {
     if (!record)
Thread
bk commit into 5.0 tree (jani:1.1989)jani20 Sep