List:Internals« Previous MessageNext Message »
From:Jim Winstead Date:April 28 2005 12:50am
Subject:bk commit into 4.1 tree (jimw:1.2170) BUG#9634
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of jimw. When jimw 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.2170 05/04/27 17:50:48 jimw@stripped +2 -0
  Fix 'mysql_client_test' with embedded server. (Bug #9634)

  tests/mysql_client_test.c
    1.151 05/04/27 17:50:46 jimw@stripped +51 -2
    Add -A switch for passing arguments to the embedded server.

  mysql-test/mysql-test-run.sh
    1.249 05/04/27 17:50:46 jimw@stripped +6 -0
    Set up arguments for mysql_client_test when testing
    the embedded server.

# 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:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-4.1-9634

--- 1.248/mysql-test/mysql-test-run.sh	2005-04-01 16:43:33 -08:00
+++ 1.249/mysql-test/mysql-test-run.sh	2005-04-27 17:50:46 -07:00
@@ -685,6 +685,12 @@
 fi
 
 MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST --no-defaults --testcase --user=root --socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT --silent $EXTRA_MYSQL_CLIENT_TEST_OPT"
+# Need to pass additional arguments to MYSQL_CLIENT_TEST for embedded server
+# -A marks each argument for passing to the function which initializes the
+# embedded library
+if [ "x$USE_EMBEDDED_SERVER" = "x1" ]; then
+  MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST -A --language=$LANGUAGE -A --datadir=$SLAVE_MYDDIR -A --character-sets-dir=$CHARSETSDIR"
+fi
 MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
 MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT"
 MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"

--- 1.150/tests/mysql_client_test.c	2005-03-25 05:30:12 -08:00
+++ 1.151/tests/mysql_client_test.c	2005-04-27 17:50:46 -07:00
@@ -30,6 +30,7 @@
 
 #define VER "2.1"
 #define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */
+#define MAX_SERVER_ARGS 64
 
 /* set default options */
 static int   opt_testcase = 0;
@@ -48,6 +49,18 @@
 static unsigned int opt_count= 0;
 static unsigned int iter_count= 0;
 
+static const char *opt_basedir= "./";
+
+static int embedded_server_arg_count= 0;
+static char *embedded_server_args[MAX_SERVER_ARGS];
+
+static const char *embedded_server_groups[]= {
+  "server",
+  "embedded",
+  "mysql_client_test_SERVER",
+  NullS
+};
+
 static time_t start_time, end_time;
 static double total_time;
 
@@ -93,6 +106,8 @@
 
 #define DIE_UNLESS(expr) \
         ((void) ((expr) ? 0 : (die(__FILE__, __LINE__, #expr), 0)))
+#define DIE(expr) \
+        die(__FILE__, __LINE__, #expr)
 
 void die(const char *file, int line, const char *expr)
 {
@@ -11617,7 +11632,7 @@
 
 static void test_bug8378()
 {
-#ifdef HAVE_CHARSET_gbk
+#if defined(HAVE_CHARSET_gbk) && !defined(EMBEDDED_LIBRARY)
   MYSQL *lmysql;
   char out[9]; /* strlen(TEST_BUG8378)*2+1 */
   int len;
@@ -11664,6 +11679,8 @@
 
 static struct my_option client_test_long_options[] =
 {
+  {"basedir", 'b', "Basedir for tests.", (gptr*) &opt_basedir,
+   (gptr*) &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"count", 't', "Number of times test to be executed", (char **) &opt_count,
    (char **) &opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
   {"database", 'D', "Database to use", (char **) &opt_db, (char **) &opt_db,
@@ -11679,6 +11696,8 @@
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
   {"port", 'P', "Port number to use for connection", (char **) &opt_port,
    (char **) &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"server-arg", 'A', "Send embedded server this as a parameter.",
+   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"show-tests", 'T', "Show all tests' names", 0, 0, 0, GET_NO_ARG, NO_ARG,
    0, 0, 0, 0, 0, 0},
   {"silent", 's', "Be more silent", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0,
@@ -11899,6 +11918,25 @@
     else
       opt_silent++;
     break;
+  case 'A':
+    /*
+      When the embedded server is being tested, the test suite needs to be
+      able to pass command-line arguments to the embedded server so it can
+      locate the language files and data directory. The test suite
+      (mysql-test-run) never uses config files, just command-line options.
+    */
+    if (!embedded_server_arg_count)
+    {
+      embedded_server_arg_count= 1;
+      embedded_server_args[0]= (char*) "";
+    }
+    if (embedded_server_arg_count == MAX_SERVER_ARGS-1 ||
+        !(embedded_server_args[embedded_server_arg_count++]=
+          my_strdup(argument, MYF(MY_FAE))))
+    {
+      DIE("Can't use server argument");
+    }
+    break;
   case 'T':
     {
       struct my_tests_st *fptr;
@@ -11962,11 +12000,16 @@
 
   DEBUGGER_OFF;
   MY_INIT(argv[0]);
-  
+
   load_defaults("my", client_test_load_default_groups, &argc, &argv);
   defaults_argv= argv;
   get_options(&argc, &argv);
 
+  if (mysql_server_init(embedded_server_arg_count,
+                        embedded_server_args,
+                        (char**) embedded_server_groups))
+    DIE("Can't initialize MySQL server");
+
   client_connect();       /* connect to server */
 
   total_time= 0;
@@ -12019,6 +12062,12 @@
   client_disconnect();    /* disconnect from server */
   free_defaults(defaults_argv);
   print_test_output();
+
+  while (embedded_server_arg_count > 1)
+    my_free(embedded_server_args[--embedded_server_arg_count],MYF(0));
+
+  mysql_server_end();
+
   my_end(0);
 
   exit(0);
Thread
bk commit into 4.1 tree (jimw:1.2170) BUG#9634Jim Winstead28 Apr