summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorserg@serg.mylan <>2004-06-11 18:26:13 +0200
committerserg@serg.mylan <>2004-06-11 18:26:13 +0200
commit683a8893a8a616199e658ab400831ccfc5158422 (patch)
treecdbcc355bebb19dcb05076af30cc530c780c3f11
parent78fa465b924836a402e58eebb3e2b7936d712a2d (diff)
downloadmariadb-git-683a8893a8a616199e658ab400831ccfc5158422.tar.gz
mysqltest.c: don't hardcode variables to be taken from environment.
use MYSQL_TCP_PORT instead of 3306 in tests
-rw-r--r--client/mysqltest.c19
-rw-r--r--mysql-test/mysql-test-run.sh1
-rw-r--r--mysql-test/t/rpl000015.test2
3 files changed, 11 insertions, 11 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 830846eda84..f638053b515 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -318,6 +318,7 @@ TYPELIB command_typelib= {array_elements(command_names),"",
DYNAMIC_STRING ds_res;
static void die(const char *fmt, ...);
static void init_var_hash();
+static VAR* var_from_env(const char *, const char *);
static byte* get_var_key(const byte* rec, uint* len,
my_bool __attribute__((unused)) t);
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,
if (!(v = (VAR*) hash_search(&var_hash, save_var_name,
var_name - save_var_name)))
{
- if (ignore_not_existing)
- DBUG_RETURN(0);
- if (end)
- *(char*) end = 0;
- die("Variable '%s' used uninitialized", save_var_name);
+ char c=*var_name, *s=(char*)var_name;;
+ *s=0;
+ v=var_from_env(save_var_name, "");
+ *s=c;
}
--var_name; /* Point at last character */
}
@@ -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;
VAR *v;
@@ -2589,6 +2589,7 @@ static void var_from_env(const char *name, const char *def_val)
v = var_init(0, name, 0, tmp, 0);
my_hash_insert(&var_hash, (byte*)v);
+ return v;
}
@@ -2599,10 +2600,8 @@ static void init_var_hash(MYSQL *mysql)
if (hash_init(&var_hash, charset_info,
1024, 0, 0, get_var_key, var_free, MYF(0)))
die("Variable hash initialization failed");
- var_from_env("MASTER_MYPORT", "9306");
- var_from_env("SLAVE_MYPORT", "9307");
- var_from_env("MYSQL_TEST_DIR", "/tmp");
- var_from_env("BIG_TEST", opt_big_test ? "1" : "0");
+ if (opt_big_test)
+ my_hash_insert(&var_hash, (byte*) var_init(0,"BIG_TEST", 0, "1",0));
v= var_init(0,"MAX_TABLES", 0, (sizeof(ulong) == 4) ? "31" : "62",0);
my_hash_insert(&var_hash, (byte*) v);
v= var_init(0,"SERVER_VERSION", 0, mysql_get_server_info(mysql), 0);
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 13ddb8f221e..eaa5d0b9da3 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -16,6 +16,7 @@ USE_MANAGER=0
MY_TZ=GMT-3
TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work
LOCAL_SOCKET=@MYSQL_UNIX_ADDR@
+MYSQL_TCP_PORT=@MYSQL_TCP_PORT@; export MYSQL_TCP_PORT
# For query_cache test
case `uname` in
diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test
index b0119526deb..b7fff94f7f3 100644
--- a/mysql-test/t/rpl000015.test
+++ b/mysql-test/t/rpl000015.test
@@ -12,7 +12,7 @@ show slave status;
change master to master_host='127.0.0.1';
# 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 #
show slave status;
--replace_result $MASTER_MYPORT MASTER_PORT