summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2004-08-24 12:58:12 +0200
committerunknown <ingo@mysql.com>2004-08-24 12:58:12 +0200
commit7a48b7935552280ca4ac6dd27f8de93b82ab10b1 (patch)
tree26803228aee4b72f1123f50d3e04a9d3e4afdb3d
parent35d5744e8a868477416eaa232b647250a69668a9 (diff)
downloadmariadb-git-7a48b7935552280ca4ac6dd27f8de93b82ab10b1.tar.gz
Enabled mysqltest for MASTER_PORT replacement.
Replaced fixed port numbers by MASTER_PORT replacement. This allows for a set of ports per tree and hence parallel testing on multiple trees. client/mysqltest.c: Enabled mysqltest for MASTER_PORT replacement. mysql-test/r/rpl000014.result: Replaced fixed port numbers by MASTER_PORT. mysql-test/r/rpl000015.result: Replaced fixed port numbers by MASTER_PORT. mysql-test/r/rpl_rotate_logs.result: Replaced fixed port numbers by MASTER_PORT. mysql-test/t/rpl000001.test: Replaced fixed port numbers by MASTER_PORT replacement. Just in case it might get un-commented. mysql-test/t/rpl000014.test: Replaced fixed port numbers by MASTER_PORT replacement. mysql-test/t/rpl000015.test: Replaced fixed port numbers by MASTER_PORT replacement. mysql-test/t/rpl_rotate_logs.test: Replaced fixed port numbers by MASTER_PORT replacement. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
-rw-r--r--BitKeeper/etc/logging_ok1
-rw-r--r--client/mysqltest.c46
-rw-r--r--mysql-test/r/rpl000014.result8
-rw-r--r--mysql-test/r/rpl000015.result6
-rw-r--r--mysql-test/r/rpl_rotate_logs.result6
-rw-r--r--mysql-test/t/rpl000001.test2
-rw-r--r--mysql-test/t/rpl000014.test8
-rw-r--r--mysql-test/t/rpl000015.test6
-rw-r--r--mysql-test/t/rpl_rotate_logs.test6
9 files changed, 55 insertions, 34 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index e0a0f4304fb..d025a25f5c5 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -11,6 +11,7 @@ greg@mysql.com
guilhem@mysql.com
heikki@donna.mysql.fi
heikki@hundin.mysql.fi
+ingo@mysql.com
jani@hynda.mysql.fi
jorge@linux.jorge.mysql.com
konstantin@mysql.com
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 18fafff275e..afd78ac6fb4 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -220,7 +220,8 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char* fname);
void reject_dump(const char* record_file, char* buf, int size);
int close_connection(struct st_query* q);
-VAR* var_get(const char* var_name, const char** var_name_end, int raw);
+VAR* var_get(const char* var_name, const char** var_name_end, int raw,
+ my_bool ignore_not_existing);
int eval_expr(VAR* v, const char* p, const char** p_end);
/* Definitions for replace */
@@ -277,7 +278,7 @@ static void do_eval(DYNAMIC_STRING* query_eval, const char* query)
}
else
{
- if(!(v = var_get(p, &p, 0)))
+ if(!(v = var_get(p, &p, 0, 0)))
die("Bad variable in eval");
dynstr_append_mem(query_eval, v->str_val, v->str_val_len);
}
@@ -486,7 +487,8 @@ static int check_result(DYNAMIC_STRING* ds, const char* fname,
return error;
}
-VAR* var_get(const char* var_name, const char** var_name_end, int raw)
+VAR* var_get(const char* var_name, const char** var_name_end, int raw,
+ my_bool ignore_not_existing)
{
int digit;
VAR* v;
@@ -507,7 +509,11 @@ VAR* var_get(const char* var_name, const char** var_name_end, int raw)
++var_name;
}
if(var_name == save_var_name)
+ {
+ if (ignore_not_existing)
+ return 0;
die("Empty variable");
+ }
if(!(v = (VAR*)hash_search(&var_hash, save_var_name,
var_name - save_var_name)))
@@ -629,7 +635,7 @@ int eval_expr(VAR* v, const char* p, const char** p_end)
VAR* vp;
if (*p == '$')
{
- if ((vp = var_get(p,p_end,0)))
+ if ((vp = var_get(p,p_end,0, 0)))
{
memcpy(v, vp, sizeof(*v));
return 0;
@@ -671,7 +677,7 @@ int do_inc(struct st_query* q)
{
char* p=q->first_argument;
VAR* v;
- v = var_get(p, 0, 1);
+ v = var_get(p, 0, 1, 0);
v->int_val++;
v->int_dirty = 1;
return 0;
@@ -681,7 +687,7 @@ int do_dec(struct st_query* q)
{
char* p=q->first_argument;
VAR* v;
- v = var_get(p, 0, 1);
+ v = var_get(p, 0, 1, 0);
v->int_val--;
v->int_dirty = 1;
return 0;
@@ -909,14 +915,16 @@ static void get_ints(uint *to,struct st_query* q)
/*
Get a string; Return ptr to end of string
Strings may be surrounded by " or '
+
+ If string is a '$variable', return the value of the variable.
*/
-static void get_string(char **to_ptr, char **from_ptr,
- struct st_query* q)
+static char *get_string(char **to_ptr, char **from_ptr,
+ struct st_query* q)
{
reg1 char c,sep;
- char *to= *to_ptr, *from= *from_ptr;
+ char *to= *to_ptr, *from= *from_ptr, *start=to;
DBUG_ENTER("get_string");
/* Find separator */
@@ -969,6 +977,19 @@ static void get_string(char **to_ptr, char **from_ptr,
*to++ =0; /* End of string marker */
*to_ptr= to;
*from_ptr= from;
+
+ /* Check if this was a variable */
+ if (*start == '$')
+ {
+ const char *end= --to;
+ VAR *var=var_get(start, &end, 0, 1);
+ if (var && to == (char*) end+1)
+ {
+ DBUG_PRINT("info",("get_string: '%s' -> '%s'", start, var->str_val));
+ DBUG_RETURN(var->str_val); /* return found variable value */
+ }
+ }
+ DBUG_RETURN(start);
}
@@ -994,13 +1015,12 @@ static void get_replace(struct st_query *q)
start=buff=my_malloc(strlen(from)+1,MYF(MY_WME | MY_FAE));
while (*from)
{
- char *to=buff;
- get_string(&buff, &from, q);
+ char *to;
+ to= get_string(&buff, &from, q);
if (!*from)
die("Wrong number of arguments to replace in %s\n", q->query);
insert_pointer_name(&from_array,to);
- to=buff;
- get_string(&buff, &from, q);
+ to= get_string(&buff, &from, q);
insert_pointer_name(&to_array,to);
}
for (i=1,pos=word_end_chars ; i < 256 ; i++)
diff --git a/mysql-test/r/rpl000014.result b/mysql-test/r/rpl000014.result
index a47c3c91c1d..2a2a9bafa11 100644
--- a/mysql-test/r/rpl000014.result
+++ b/mysql-test/r/rpl000014.result
@@ -1,13 +1,13 @@
File Position Binlog_do_db Binlog_ignore_db
master-bin.001 73
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 1 master-bin.001 73 Yes 0 0
+127.0.0.1 root MASTER_PORT 1 master-bin.001 73 Yes 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 1 master-bin.001 73 No 0 0
+127.0.0.1 root MASTER_PORT 1 master-bin.001 73 No 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 1 master-bin.001 73 Yes 0 0
+127.0.0.1 root MASTER_PORT 1 master-bin.001 73 Yes 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 1 master-bin.001 173 Yes 0 0
+127.0.0.1 root MASTER_PORT 1 master-bin.001 173 Yes 0 0
File Position Binlog_do_db Binlog_ignore_db
master-bin.001 73
n
diff --git a/mysql-test/r/rpl000015.result b/mysql-test/r/rpl000015.result
index 58487af27f8..79856748f58 100644
--- a/mysql-test/r/rpl000015.result
+++ b/mysql-test/r/rpl000015.result
@@ -3,11 +3,11 @@ master-bin.001 73
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
0 0 0 No 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 test 9998 60 4 No 0 0
+127.0.0.1 test MASTER_PORT 60 4 No 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 60 4 No 0 0
+127.0.0.1 root MASTER_PORT 60 4 No 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 60 master-bin.001 73 Yes 0 0
+127.0.0.1 root MASTER_PORT 60 master-bin.001 73 Yes 0 0
n
10
45
diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result
index cf432d07b08..a711811d768 100644
--- a/mysql-test/r/rpl_rotate_logs.result
+++ b/mysql-test/r/rpl_rotate_logs.result
@@ -1,5 +1,5 @@
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 60 master-bin.001 387 Yes 0 0
+127.0.0.1 root MASTER_PORT 60 master-bin.001 387 Yes 0 0
s
Could not break slave
Tried hard
@@ -12,7 +12,7 @@ testing temporary tables
Log_name
master-bin.003
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 60 master-bin.003 329 Yes 0 0
+127.0.0.1 root MASTER_PORT 60 master-bin.003 329 Yes 0 0
m
34
65
@@ -29,6 +29,6 @@ master-bin.006 490
a
testing temporary tables part 2
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
-127.0.0.1 root 9999 60 master-bin.006 490 Yes 0 0
+127.0.0.1 root MASTER_PORT 60 master-bin.006 490 Yes 0 0
count(*)
100
diff --git a/mysql-test/t/rpl000001.test b/mysql-test/t/rpl000001.test
index 6a827368fa4..e69ed9987d1 100644
--- a/mysql-test/t/rpl000001.test
+++ b/mysql-test/t/rpl000001.test
@@ -61,7 +61,7 @@ sleep 2;
# The following test can't be done because the result of Pos will differ
# on different computers
-# --replace_result 9306 9999 3334 9999 3335 9999
+# --replace_result $MASTER_MYPORT MASTER_PORT
# show slave status;
set sql_slave_skip_counter=1;
diff --git a/mysql-test/t/rpl000014.test b/mysql-test/t/rpl000014.test
index b501d63b10e..e98471657ac 100644
--- a/mysql-test/t/rpl000014.test
+++ b/mysql-test/t/rpl000014.test
@@ -4,18 +4,18 @@ show master status;
save_master_pos;
connection slave;
sync_with_master;
---replace_result 9306 9999 3334 9999 3335 9999
+--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
change master to master_log_pos=73;
slave stop;
change master to master_log_pos=73;
---replace_result 9306 9999 3334 9999 3335 9999
+--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
slave start;
---replace_result 9306 9999 3334 9999 3335 9999
+--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
change master to master_log_pos=173;
---replace_result 9306 9999 3334 9999 3335 9999
+--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
connection master;
show master status;
diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test
index 73a10bed7b3..d3c30c19cc1 100644
--- a/mysql-test/t/rpl000015.test
+++ b/mysql-test/t/rpl000015.test
@@ -8,15 +8,15 @@ connection slave;
reset slave;
show slave status;
change master to master_host='127.0.0.1';
---replace_result 3306 9998 9306 9999 3334 9999 3335 9999
+--replace_result $MASTER_MYPORT MASTER_PORT 3306 MASTER_PORT
show slave status;
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT;
---replace_result 9306 9999 3334 9999 3335 9999
+--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
slave start;
sync_with_master;
---replace_result 9306 9999 3334 9999 3335 9999
+--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
connection master;
drop table if exists t1;
diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test
index ab88def5b2d..92baba5f737 100644
--- a/mysql-test/t/rpl_rotate_logs.test
+++ b/mysql-test/t/rpl_rotate_logs.test
@@ -40,7 +40,7 @@ insert into t1 values('Could not break slave'),('Tried hard');
save_master_pos;
connection slave;
sync_with_master;
---replace_result 9306 9999 3334 9999 3335 9999
+--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
select * from t1;
connection master;
@@ -96,7 +96,7 @@ insert into t2 values (65);
save_master_pos;
connection slave;
sync_with_master;
---replace_result 9306 9999 3334 9999 3335 9999
+--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
select * from t2;
@@ -126,7 +126,7 @@ connection slave;
sync_with_master;
select * from t4;
---replace_result 9306 9999 3334 9999 3335 9999
+--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
# because of concurrent insert, the table may not be up to date
# if we do not lock