Commit f12eb2ea authored by unknown's avatar unknown

mysqltest.c: don't hardcode variables to be taken from environment.

use MYSQL_TCP_PORT instead of 3306 in tests


client/mysqltest.c:
  don't hardcode variables to be taken from environment.
mysql-test/mysql-test-run.sh:
  MYSQL_TCP_PORT instead of 3306
mysql-test/t/rpl000015.test:
  MYSQL_TCP_PORT instead of 3306
parent b670b0b7
...@@ -318,6 +318,7 @@ TYPELIB command_typelib= {array_elements(command_names),"", ...@@ -318,6 +318,7 @@ TYPELIB command_typelib= {array_elements(command_names),"",
DYNAMIC_STRING ds_res; DYNAMIC_STRING ds_res;
static void die(const char *fmt, ...); static void die(const char *fmt, ...);
static void init_var_hash(); static void init_var_hash();
static VAR* var_from_env(const char *, const char *);
static byte* get_var_key(const byte* rec, uint* len, static byte* get_var_key(const byte* rec, uint* len,
my_bool __attribute__((unused)) t); my_bool __attribute__((unused)) t);
static VAR* var_init(VAR* v, const char *name, int name_len, const char *val, static VAR* var_init(VAR* v, const char *name, int name_len, const char *val,
...@@ -654,11 +655,10 @@ VAR* var_get(const char* var_name, const char** var_name_end, my_bool raw, ...@@ -654,11 +655,10 @@ VAR* var_get(const char* var_name, const char** var_name_end, my_bool raw,
if (!(v = (VAR*) hash_search(&var_hash, save_var_name, if (!(v = (VAR*) hash_search(&var_hash, save_var_name,
var_name - save_var_name))) var_name - save_var_name)))
{ {
if (ignore_not_existing) char c=*var_name, *s=(char*)var_name;;
DBUG_RETURN(0); *s=0;
if (end) v=var_from_env(save_var_name, "");
*(char*) end = 0; *s=c;
die("Variable '%s' used uninitialized", save_var_name);
} }
--var_name; /* Point at last character */ --var_name; /* Point at last character */
} }
...@@ -2580,7 +2580,7 @@ static void var_free(void *v) ...@@ -2580,7 +2580,7 @@ static void var_free(void *v)
} }
static void var_from_env(const char *name, const char *def_val) static VAR* var_from_env(const char *name, const char *def_val)
{ {
const char *tmp; const char *tmp;
VAR *v; VAR *v;
...@@ -2589,6 +2589,7 @@ static void var_from_env(const char *name, const char *def_val) ...@@ -2589,6 +2589,7 @@ static void var_from_env(const char *name, const char *def_val)
v = var_init(0, name, 0, tmp, 0); v = var_init(0, name, 0, tmp, 0);
my_hash_insert(&var_hash, (byte*)v); my_hash_insert(&var_hash, (byte*)v);
return v;
} }
...@@ -2599,10 +2600,8 @@ static void init_var_hash(MYSQL *mysql) ...@@ -2599,10 +2600,8 @@ static void init_var_hash(MYSQL *mysql)
if (hash_init(&var_hash, charset_info, if (hash_init(&var_hash, charset_info,
1024, 0, 0, get_var_key, var_free, MYF(0))) 1024, 0, 0, get_var_key, var_free, MYF(0)))
die("Variable hash initialization failed"); die("Variable hash initialization failed");
var_from_env("MASTER_MYPORT", "9306"); if (opt_big_test)
var_from_env("SLAVE_MYPORT", "9307"); my_hash_insert(&var_hash, (byte*) var_init(0,"BIG_TEST", 0, "1",0));
var_from_env("MYSQL_TEST_DIR", "/tmp");
var_from_env("BIG_TEST", opt_big_test ? "1" : "0");
v= var_init(0,"MAX_TABLES", 0, (sizeof(ulong) == 4) ? "31" : "62",0); v= var_init(0,"MAX_TABLES", 0, (sizeof(ulong) == 4) ? "31" : "62",0);
my_hash_insert(&var_hash, (byte*) v); my_hash_insert(&var_hash, (byte*) v);
v= var_init(0,"SERVER_VERSION", 0, mysql_get_server_info(mysql), 0); v= var_init(0,"SERVER_VERSION", 0, mysql_get_server_info(mysql), 0);
......
...@@ -16,6 +16,7 @@ USE_MANAGER=0 ...@@ -16,6 +16,7 @@ USE_MANAGER=0
MY_TZ=GMT-3 MY_TZ=GMT-3
TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work
LOCAL_SOCKET=@MYSQL_UNIX_ADDR@ LOCAL_SOCKET=@MYSQL_UNIX_ADDR@
MYSQL_TCP_PORT=@MYSQL_TCP_PORT@; export MYSQL_TCP_PORT
# For query_cache test # For query_cache test
case `uname` in case `uname` in
......
...@@ -12,7 +12,7 @@ show slave status; ...@@ -12,7 +12,7 @@ show slave status;
change master to master_host='127.0.0.1'; change master to master_host='127.0.0.1';
# The following needs to be cleaned up when change master is fixed # The following needs to be cleaned up when change master is fixed
--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT $MYSQL_TCP_PORT MASTER_PORT
--replace_column 1 # 33 # --replace_column 1 # 33 #
show slave status; show slave status;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment