List:Internals« Previous MessageNext Message »
From:Konstantin Osipov Date:April 8 2005 7:32pm
Subject:Re: bk commit into 4.1 tree (jimw:1.2170) BUG#9634
View as plain text  
* Jim Winstead <jimw@stripped> [05/04/08 07:03]:

> ChangeSet
>   1.2170 05/04/07 18:01:56 jimw@stripped +2 -0
>   Fix mysql_client_test.test by adding support for passing server
>   flags to mysql_client_test. (Bug #9634)

>  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

I'd also add the line

# -A will mark the following argument for passing to the function
# that initializes the embedded library).

> +static int embedded_server_arg_count=0;

Please fix the coding style here (there are other places in the patch where
it's wrong).


> +static int read_server_arguments(const char *name)

This function is currently not utiilized, and we can add it back anytime
we need it (by copy-pasting from mysqltest), so now let's drop it.

>  {
> -#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 +11726,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 +11743,10 @@
>     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},
> +  {"server-file", 'F', "Read embedded server arguments from file.",
> +   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 +11967,23 @@
>      else
>        opt_silent++;
>      break;

Please add a comment describing what and why exactly is going on:

  We have a need to initialize the embeeded library with a path to
  character sets and language files.
  In case when mysql_client_test is called from the test suite by
  mysql-test-run these paths are local to the test suite. They needs to be
  passed in.  'mysql-test-run' doesn't create or supply a defaults file
  for the server instances it runs, all the server options are passed in
  the command line. Therefore options for  mysql_client_test when it is
  compiled with the embedded library should be passed in the command line
  as well.

> +  case 'A':
> +    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 'F':
> +    if (read_server_arguments(argument))
> +      DIE(NullS);
> +    break;
>    case 'T':
>      {
>        struct my_tests_st *fptr;
> @@ -11962,11 +12047,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 +12109,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();
> +

OK to push with the described (and prior to that discussed) fixes.

-- 
Konstantin Osipov, Software Developer
MySQL AB, www.mysql.com
Thread
bk commit into 4.1 tree (jimw:1.2170) BUG#9634Jim Winstead8 Apr
  • Re: bk commit into 4.1 tree (jimw:1.2170) BUG#9634Konstantin Osipov8 Apr