MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:msvensson Date:September 27 2005 2:40pm
Subject:bk commit into 5.0 tree (msvensson:1.1975)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson 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.1975 05/09/27 16:40:29 msvensson@neptunus.(none) +5 -0
  Merge neptunus.(none):/home/msvensson/mysql/fix_mysqltest/my41-fix_mysqltest
  into  neptunus.(none):/home/msvensson/mysql/fix_mysqltest/my50-fix_mysqltest

  mysys/my_init.c
    1.42 05/09/27 16:40:24 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/t/mysqltest.test
    1.18 05/09/27 16:40:24 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/r/mysqltest.result
    1.13 05/09/27 16:40:24 msvensson@neptunus.(none) +0 -0
    Auto merged

  mysql-test/mysql-test-run.pl
    1.42 05/09/27 16:40:24 msvensson@neptunus.(none) +0 -0
    Auto merged

  client/mysqltest.c
    1.159 05/09/27 16:40:23 msvensson@neptunus.(none) +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:	msvensson
# Host:	neptunus.(none)
# Root:	/home/msvensson/mysql/fix_mysqltest/my50-fix_mysqltest/RESYNC

--- 1.41/mysys/my_init.c	2005-08-09 15:57:31 +02:00
+++ 1.42/mysys/my_init.c	2005-09-27 16:40:24 +02:00
@@ -127,11 +127,23 @@
 
 void my_end(int infoflag)
 {
-  FILE *info_file;
-  if (!(info_file=DBUG_FILE))
-    info_file=stderr;
-  DBUG_PRINT("info",("Shutting down"));
-  if (infoflag & MY_CHECK_ERROR || info_file != stderr)
+  /*
+    this code is suboptimal to workaround a bug in
+    Sun CC: Sun C++ 5.6 2004/06/02 for x86, and should not be
+    optimized until this compiler is not in use anymore
+  */
+  FILE *info_file= DBUG_FILE;
+  my_bool print_info= (info_file != stderr);
+  DBUG_ENTER("my_end");
+  if (!info_file)
+  {
+    info_file= stderr;
+    print_info= 0;
+  }
+
+  DBUG_PRINT("info",("Shutting down: print_info: %d", print_info));
+  if ((infoflag & MY_CHECK_ERROR) || print_info)
+
   {					/* Test if some file is left open */
     if (my_file_opened | my_stream_opened)
     {
@@ -141,7 +153,8 @@
     }
   }
   my_once_free();
-  if (infoflag & MY_GIVE_INFO || info_file != stderr)
+
+  if ((infoflag & MY_GIVE_INFO) || print_info)
   {
 #ifdef HAVE_GETRUSAGE
     struct rusage rus;

--- 1.41/mysql-test/mysql-test-run.pl	2005-09-01 23:23:25 +02:00
+++ 1.42/mysql-test/mysql-test-run.pl	2005-09-27 16:40:24 +02:00
@@ -2442,11 +2442,6 @@
     mtr_add_arg($args, "--big-test");
   }
 
-  if ( $opt_record )
-  {
-    mtr_add_arg($args, "--record");
-  }
-
   if ( $opt_compress )
   {
     mtr_add_arg($args, "--compress");
@@ -2472,8 +2467,6 @@
                 $glob_mysql_test_dir);
   }
 
-  mtr_add_arg($args, "-R");
-  mtr_add_arg($args, $tinfo->{'result_file'});
 
   # ----------------------------------------------------------------------
   # If embedded server, we create server args to give mysqltest to pass on
@@ -2488,6 +2481,18 @@
   # export MYSQL_TEST variable containing <path>/mysqltest <args>
   # ----------------------------------------------------------------------
   $ENV{'MYSQL_TEST'}= "$exe_mysqltest " . join(" ", @$args);
+
+  # ----------------------------------------------------------------------
+  # Add arguments that should not go into the MYSQL_TEST env var
+  # ----------------------------------------------------------------------
+
+  mtr_add_arg($args, "-R");
+  mtr_add_arg($args, $tinfo->{'result_file'});
+
+  if ( $opt_record )
+  {
+    mtr_add_arg($args, "--record");
+  }
 
   return mtr_run_test($exe,$args,$tinfo->{'path'},"",$path_timefile,"");
 }

--- 1.12/mysql-test/r/mysqltest.result	2005-09-06 12:33:31 +02:00
+++ 1.13/mysql-test/r/mysqltest.result	2005-09-27 16:40:24 +02:00
@@ -180,6 +180,7 @@
 echo message echo message
 
 mysqltest: At line 1: Empty variable
+mysqltest: At line 1: command "false" failed
 mysqltest: At line 1: Missing argument in exec
 MySQL
 "MySQL"
@@ -301,6 +302,7 @@
 mysqltest: At line 1: End of line junk detected: "1000"
 mysqltest: At line 1: Missing arguments to system, nothing to do!
 mysqltest: At line 1: Missing arguments to system, nothing to do!
+mysqltest: At line 1: system command 'false' failed
 test
 test2
 test3
@@ -344,6 +346,10 @@
 mysqltest: At line 1: Invalid integer argument "10!"
 mysqltest: At line 1: End of line junk detected: "!"
 mysqltest: At line 1: Invalid integer argument "a"
+Output from mysqltest-x.inc
+Output from mysqltest-x.inc
+Output from mysqltest-x.inc
+mysqltest: Could not open ./non_existing_file.inc: errno = 2
 failing_statement;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing_statement' at line 1
 failing_statement;

--- 1.17/mysql-test/t/mysqltest.test	2005-09-07 09:33:20 +02:00
+++ 1.18/mysql-test/t/mysqltest.test	2005-09-27 16:40:24 +02:00
@@ -428,9 +428,8 @@
 # ----------------------------------------------------------------------------
 
 # Illegal use of exec
-# Disabled, some shells prints the failed command regardless of pipes
-#--error 1
-#--exec echo "--exec ';' 2> /dev/null" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "--exec false" | $MYSQL_TEST 2>&1
 
 --error 1
 --exec echo "--exec " | $MYSQL_TEST 2>&1
@@ -677,9 +676,8 @@
 --exec echo "system;" | $MYSQL_TEST 2>&1
 --error 1
 --exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1
-# Disabled, some shells prints the failed command regardless of pipes
-#--error 1
-#--exec echo "system NonExistsinfComamdn 2> /dev/null;" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "system false;" | $MYSQL_TEST 2>&1
 
 --disable_abort_on_error
 system NonExistsinfComamdn;
@@ -814,11 +812,11 @@
 # ----------------------------------------------------------------------------
 
 # -x <file_name>, use the file specified after -x as the test file
-#--exec $MYSQL_TEST < $MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1
-#--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1
-#--exec $MYSQL_TEST --result_file=$MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1
-#--error 1
-#--exec $MYSQL_TEST -x non_existing_file.inc 2>&1
+--exec $MYSQL_TEST < $MYSQL_TEST_DIR/include/mysqltest-x.inc
+--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/include/mysqltest-x.inc
+--exec $MYSQL_TEST --test_file=$MYSQL_TEST_DIR/include/mysqltest-x.inc
+--error 1
+--exec $MYSQL_TEST -x non_existing_file.inc 2>&1
 
 
 # ----------------------------------------------------------------------------

--- 1.158/client/mysqltest.c	2005-09-07 09:35:43 +02:00
+++ 1.159/client/mysqltest.c	2005-09-27 16:40:23 +02:00
@@ -605,7 +605,8 @@
     if (cur_file && cur_file != file_stack)
       fprintf(stderr, "In included file \"%s\": ",
               cur_file->file_name);
-    fprintf(stderr, "At line %u: ", start_lineno);
+    if (start_lineno != 0)
+      fprintf(stderr, "At line %u: ", start_lineno);
     vfprintf(stderr, fmt, args);
     fprintf(stderr, "\n");
     fflush(stderr);
@@ -638,7 +639,9 @@
 
   va_start(args, fmt);
 
-  fprintf(stderr, "mysqltest: At line %u: ", start_lineno);
+  fprintf(stderr, "mysqltest: ");
+  if (start_lineno > 0)
+    fprintf(stderr, "At line %u: ", start_lineno);
   vfprintf(stderr, fmt, args);
   fprintf(stderr, "\n");
   va_end(args);
@@ -1091,8 +1094,8 @@
           (query->expected_errno[i].code.errnum == status))
       {
         ok= 1;
-        verbose_msg("command \"%s\" failed with expected error: %d",
-                    cmd, status);
+        DBUG_PRINT("info", ("command \"%s\" failed with expected error: %d",
+                            cmd, status));
       }
     }
     if (!ok)
@@ -1377,9 +1380,7 @@
   int rpl_parse;
 
   if (!master_pos.file[0])
-  {
-    die("Line %u: Calling 'sync_with_master' without calling 'save_master_pos'", start_lineno);
-  }
+    die("Calling 'sync_with_master' without calling 'save_master_pos'");
   rpl_parse= mysql_rpl_parse_enabled(mysql);
   mysql_disable_rpl_parse(mysql);
 
@@ -1389,14 +1390,13 @@
 wait_for_position:
 
   if (mysql_query(mysql, query_buf))
-    die("line %u: failed in %s: %d: %s", start_lineno, query_buf,
-	mysql_errno(mysql), mysql_error(mysql));
+    die("failed in %s: %d: %s", query_buf, mysql_errno(mysql),
+        mysql_error(mysql));
 
   if (!(last_result= res= mysql_store_result(mysql)))
-    die("line %u: mysql_store_result() returned NULL for '%s'", start_lineno,
-	query_buf);
+    die("mysql_store_result() returned NULL for '%s'", query_buf);
   if (!(row= mysql_fetch_row(res)))
-    die("line %u: empty result in %s", start_lineno, query_buf);
+    die("empty result in %s", query_buf);
   if (!row[0])
   {
     /*
@@ -1404,10 +1404,7 @@
       SLAVE has been issued ?
     */
     if (tries++ == 3)
-    {
-      die("line %u: could not sync with master ('%s' returned NULL)", 
-          start_lineno, query_buf);
-    }
+      die("could not sync with master ('%s' returned NULL)", query_buf);
     sleep(1); /* So at most we will wait 3 seconds and make 4 tries */
     mysql_free_result(res);
     goto wait_for_position;
@@ -1453,10 +1450,9 @@
 	mysql_errno(mysql), mysql_error(mysql));
 
   if (!(last_result =res = mysql_store_result(mysql)))
-    die("line %u: mysql_store_result() retuned NULL for '%s'", start_lineno,
-	query);
+    die("mysql_store_result() retuned NULL for '%s'", query);
   if (!(row = mysql_fetch_row(res)))
-    die("line %u: empty result in show master status", start_lineno);
+    die("empty result in show master status");
   strnmov(master_pos.file, row[0], sizeof(master_pos.file)-1);
   master_pos.pos = strtoul(row[1], (char**) 0, 10);
   mysql_free_result(res); last_result=0;
@@ -2761,7 +2757,7 @@
       fn_format(buff, argument, "", "", 4);
       DBUG_ASSERT(cur_file == file_stack && cur_file->file == 0);
       if (!(cur_file->file=
-            my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(MY_WME))))
+            my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(0))))
 	die("Could not open %s: errno = %d", buff, errno);
       cur_file->file_name= my_strdup(buff, MYF(MY_FAE));
       break;
@@ -2867,7 +2863,7 @@
     fname=buff;
   }
   fn_format(buff,fname,"","",4);
-
+  
   if ((fd = my_open(buff, O_WRONLY | O_CREAT | O_TRUNC,
 		    MYF(MY_WME | MY_FFNF))) < 0)
     die("Could not open %s: errno = %d", buff, errno);
@@ -4279,12 +4275,20 @@
     parser.current_line += current_line_inc;
   }
 
-  if (result_file && ds_res.length && !error)
+  if (ds_res.length && !error)
   {
-    if (!record)
-      error |= check_result(&ds_res, result_file, q->require_file);
+    if (result_file)
+    {
+      if (!record)
+        error |= check_result(&ds_res, result_file, q->require_file);
+      else
+        str_to_file(result_file, ds_res.str, ds_res.length);
+    }
     else
-      str_to_file(result_file, ds_res.str, ds_res.length);
+    {
+      // Print the result to stdout
+      printf("%s", ds_res.str);
+    }
   }
   dynstr_free(&ds_res);
 
Thread
bk commit into 5.0 tree (msvensson:1.1975)msvensson27 Sep