List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:March 17 2011 1:52pm
Subject:bzr commit into mysql-5.5 branch (Georgi.Kodinov:3366) Bug#11766854
View as plain text  
#At file:///Users/kgeorge/mysql/work/B11766854-5.5/ based on revid:bjorn.munch@stripped

 3366 Georgi Kodinov	2011-03-17
      Bug #11766854: 60075: MYSQL_LOAD_CLIENT_PLUGIN DOESN'T CLEAR ERROR
      
      Added the cleanup code.
      Extended mysql_client_test to take --plugin-dir and --default_auth.
      Added a C test case.

    modified:
      mysql-test/t/mysql_client_test.test
      sql-common/client_plugin.c
      tests/mysql_client_test.c
=== modified file 'mysql-test/t/mysql_client_test.test'
--- a/mysql-test/t/mysql_client_test.test	2010-11-18 12:01:50 +0000
+++ b/mysql-test/t/mysql_client_test.test	2011-03-17 13:52:49 +0000
@@ -12,7 +12,7 @@ SET @old_slow_query_log= @@global.slow_q
 # var/log/mysql_client_test.trace
 
 --exec echo "$MYSQL_CLIENT_TEST" > $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1
---exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1
+--exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M $PLUGIN_AUTH_CLIENT_OPT >> $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1
 
 # End of 4.1 tests
 echo ok;

=== modified file 'sql-common/client_plugin.c'
--- a/sql-common/client_plugin.c	2011-01-11 09:07:37 +0000
+++ b/sql-common/client_plugin.c	2011-03-17 13:52:49 +0000
@@ -163,6 +163,7 @@ add_plugin(MYSQL *mysql, struct st_mysql
 
   p->next= plugin_list[plugin->type];
   plugin_list[plugin->type]= p;
+  net_clear_error(&mysql->net);
 
   return plugin;
 

=== modified file 'tests/mysql_client_test.c'
--- a/tests/mysql_client_test.c	2011-02-18 14:19:55 +0000
+++ b/tests/mysql_client_test.c	2011-03-17 13:52:49 +0000
@@ -34,6 +34,7 @@
 #include <m_string.h>
 #include <mysqld_error.h>
 #include <sql_common.h>
+#include <mysql/client_plugin.h>
 
 #define VER "2.1"
 #define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */
@@ -59,6 +60,7 @@ static unsigned int test_count= 0;
 static unsigned int opt_count= 0;
 static unsigned int iter_count= 0;
 static my_bool have_innodb= FALSE;
+static char *opt_plugin_dir= 0, *opt_default_auth= 0;
 
 static const char *opt_basedir= "./";
 static const char *opt_vardir= "mysql-test/var";
@@ -245,6 +247,11 @@ static MYSQL *mysql_client_init(MYSQL* c
   if (res && shared_memory_base_name)
     mysql_options(res, MYSQL_SHARED_MEMORY_BASE_NAME, shared_memory_base_name);
 #endif
+  if (opt_plugin_dir && *opt_plugin_dir)
+    mysql_options(res, MYSQL_PLUGIN_DIR, opt_plugin_dir);
+
+  if (opt_default_auth && *opt_default_auth)
+    mysql_options(res, MYSQL_DEFAULT_AUTH, opt_default_auth);
   return res;
 }
 
@@ -326,6 +333,11 @@ static MYSQL* client_connect(ulong flag,
   /* enable local infile, in non-binary builds often disabled by default */
   mysql_options(mysql, MYSQL_OPT_LOCAL_INFILE, 0);
   mysql_options(mysql, MYSQL_OPT_PROTOCOL, &protocol);
+  if (opt_plugin_dir && *opt_plugin_dir)
+    mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir);
+
+  if (opt_default_auth && *opt_default_auth)
+    mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
 
   if (!(mysql_real_connect(mysql, opt_host, opt_user,
                            opt_password, opt_db ? opt_db:"test", opt_port,
@@ -19502,6 +19514,28 @@ static void test_bug57058()
 }
 
 
+/**
+  Bug#11766854: 60075: MYSQL_LOAD_CLIENT_PLUGIN DOESN'T CLEAR ERROR 
+*/
+
+static void test_bug11766854()
+{
+  struct st_mysql_client_plugin *plugin;
+
+  DBUG_ENTER("test_bug11766854");
+  myheader("test_bug11766854");
+
+  plugin= mysql_load_plugin(mysql, "foo", -1, 0);
+  DIE_UNLESS(plugin == 0);
+
+  plugin= mysql_load_plugin(mysql, "qa_auth_client", -1, 0);
+  DIE_UNLESS(plugin != 0);
+  DIE_IF(mysql_errno(mysql));
+
+  DBUG_VOID_RETURN;
+}
+
+
 /*
   Read and parse arguments and MySQL options from my.cnf
 */
@@ -19559,6 +19593,12 @@ static struct my_option client_test_long
   {"getopt-ll-test", 'g', "Option for testing bug in getopt library",
    &opt_getopt_ll_test, &opt_getopt_ll_test, 0,
    GET_LL, REQUIRED_ARG, 0, 0, LONGLONG_MAX, 0, 0, 0},
+  {"plugin_dir", 0, "Directory for client-side plugins.",
+   (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"default_auth", 0, "Default authentication client-side plugin to use.",
+   (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 
@@ -19838,6 +19878,7 @@ static struct my_tests_st my_tests[]= {
   { "test_bug47485", test_bug47485 },
   { "test_bug58036", test_bug58036 },
   { "test_bug57058", test_bug57058 },
+  { "test_bug11766854", test_bug11766854 },
   { 0, 0 }
 };
 


Attachment: [text/bzr-bundle] bzr/georgi.kodinov@oracle.com-20110317135249-o5g7vab0q6tpf87r.bundle
Thread
bzr commit into mysql-5.5 branch (Georgi.Kodinov:3366) Bug#11766854Georgi Kodinov17 Mar