mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
Portability fixes
Removed \r from new tests Fixes to get new sustem_mysql_db... tests to work client/mysqltest.c: More debug information innobase/que/que0que.c: Fixed wrong usage of __attribute mysql-test/mysql-test-run.sh: Portability fix; Added CLIENT_BINDIR mysql-test/t/system_mysql_db_fix.test: Removed \r mysql-test/t/system_mysql_db_refs.test: Removed \r scripts/mysql_fix_privilege_tables.sh: Don't set root password from first option Added --bindir option
This commit is contained in:
parent
00ff1f609e
commit
9935110b30
6 changed files with 70 additions and 54 deletions
|
@ -861,18 +861,22 @@ int do_exec(struct st_query* q)
|
|||
char buf[1024];
|
||||
FILE *res_file;
|
||||
char *cmd= q->first_argument;
|
||||
DBUG_ENTER("do_exec");
|
||||
|
||||
while (*cmd && my_isspace(charset_info, *cmd))
|
||||
cmd++;
|
||||
if (!*cmd)
|
||||
die("Missing argument in exec\n");
|
||||
|
||||
DBUG_PRINT("info", ("Executing '%s'", cmd));
|
||||
|
||||
if (!(res_file= popen(cmd, "r")) && q->abort_on_error)
|
||||
die("popen() failed\n");
|
||||
|
||||
if (disable_result_log)
|
||||
{
|
||||
if (!(res_file= popen(cmd, "r")) && q->abort_on_error)
|
||||
die("popen() failed\n");
|
||||
while (fgets(buf, sizeof(buf), res_file));
|
||||
pclose(res_file);
|
||||
while (fgets(buf, sizeof(buf), res_file))
|
||||
{}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -884,11 +888,8 @@ int do_exec(struct st_query* q)
|
|||
else
|
||||
ds= &ds_res;
|
||||
|
||||
if (!(res_file= popen(cmd, "r")) && q->abort_on_error)
|
||||
die("popen() failed\n");
|
||||
while (fgets(buf, sizeof(buf), res_file))
|
||||
replace_dynstr_append_mem(ds, buf, strlen(buf));
|
||||
pclose(res_file);
|
||||
|
||||
if (glob_replace)
|
||||
free_replace();
|
||||
|
@ -907,8 +908,9 @@ int do_exec(struct st_query* q)
|
|||
if (ds == &ds_tmp)
|
||||
dynstr_free(&ds_tmp);
|
||||
}
|
||||
pclose(res_file);
|
||||
|
||||
return error;
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
int var_query_set(VAR* v, const char* p, const char** p_end)
|
||||
|
@ -1043,7 +1045,7 @@ int do_system(struct st_query* q)
|
|||
eval_expr(&v, p, 0); /* NULL terminated */
|
||||
if (v.str_val_len)
|
||||
{
|
||||
char expr_buf[512];
|
||||
char expr_buf[1024];
|
||||
if ((uint)v.str_val_len > sizeof(expr_buf) - 1)
|
||||
v.str_val_len = sizeof(expr_buf) - 1;
|
||||
memcpy(expr_buf, v.str_val, v.str_val_len);
|
||||
|
@ -1774,11 +1776,12 @@ int read_query(struct st_query** q_ptr)
|
|||
char *p = read_query_buf, * p1 ;
|
||||
int expected_errno;
|
||||
struct st_query* q;
|
||||
DBUG_ENTER("read_query_buf");
|
||||
|
||||
if (parser.current_line < parser.read_lines)
|
||||
{
|
||||
get_dynamic(&q_lines, (gptr) q_ptr, parser.current_line) ;
|
||||
return 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
if (!(*q_ptr=q=(struct st_query*) my_malloc(sizeof(*q), MYF(MY_WME))) ||
|
||||
insert_dynamic(&q_lines, (gptr) &q))
|
||||
|
@ -1797,7 +1800,7 @@ int read_query(struct st_query** q_ptr)
|
|||
q->type = Q_UNKNOWN;
|
||||
q->query_buf=q->query=0;
|
||||
if (read_line(read_query_buf, sizeof(read_query_buf)))
|
||||
return 1;
|
||||
DBUG_RETURN(1);
|
||||
|
||||
if (*p == '#')
|
||||
{
|
||||
|
@ -1851,7 +1854,7 @@ int read_query(struct st_query** q_ptr)
|
|||
q->first_argument=p;
|
||||
q->end = strend(q->query);
|
||||
parser.read_lines++;
|
||||
return 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2306,10 +2309,12 @@ void get_query_type(struct st_query* q)
|
|||
{
|
||||
char save;
|
||||
uint type;
|
||||
DBUG_ENTER("get_query_type");
|
||||
|
||||
if (*q->query == '}')
|
||||
{
|
||||
q->type = Q_END_BLOCK;
|
||||
return;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
if (q->type != Q_COMMENT_WITH_COMMAND)
|
||||
q->type = Q_QUERY;
|
||||
|
@ -2320,8 +2325,10 @@ void get_query_type(struct st_query* q)
|
|||
q->query[q->first_word_len]=save;
|
||||
if (type > 0)
|
||||
q->type=(enum enum_commands) type; /* Found command */
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
static byte *get_var_key(const byte* var, uint* len,
|
||||
my_bool __attribute__((unused)) t)
|
||||
{
|
||||
|
|
|
@ -668,15 +668,15 @@ does nothing! */
|
|||
void
|
||||
que_thr_handle_error(
|
||||
/*=================*/
|
||||
que_thr_t* thr __attribute((unused)),
|
||||
que_thr_t* thr __attribute__((unused)),
|
||||
/* in: query thread */
|
||||
ulint err_no __attribute((unused)),
|
||||
ulint err_no __attribute__((unused)),
|
||||
/* in: error number */
|
||||
byte* err_str __attribute((unused)),
|
||||
byte* err_str __attribute__((unused)),
|
||||
/* in, own: error string or NULL; NOTE: the
|
||||
function will take care of freeing of the
|
||||
string! */
|
||||
ulint err_len __attribute((unused)))
|
||||
ulint err_len __attribute__((unused)))
|
||||
/* in: error string length */
|
||||
{
|
||||
/* Does nothing */
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# Access Definitions
|
||||
#--
|
||||
DB=test
|
||||
DBPASSWD=
|
||||
DBPASSWD=""
|
||||
VERBOSE=""
|
||||
USE_MANAGER=0
|
||||
MY_TZ=GMT-3
|
||||
|
@ -461,12 +461,13 @@ if [ x$SOURCE_DIST = x1 ] ; then
|
|||
MYSQL_TEST="strace -o $MYSQL_TEST_DIR/var/log/mysqltest.strace $MYSQL_TEST"
|
||||
fi
|
||||
|
||||
MYSQLADMIN="$BASEDIR/client/mysqladmin"
|
||||
CLIENT_BINDIR="$BASEDIR/client"
|
||||
MYSQLADMIN="$CLIENT_BINDIR/mysqladmin"
|
||||
WAIT_PID="$BASEDIR/extra/mysql_waitpid"
|
||||
MYSQL_MANAGER_CLIENT="$BASEDIR/client/mysqlmanagerc"
|
||||
MYSQL_MANAGER_CLIENT="$CLIENT_BINDIR/mysqlmanagerc"
|
||||
MYSQL_MANAGER="$BASEDIR/tools/mysqlmanager"
|
||||
MYSQL_MANAGER_PWGEN="$BASEDIR/client/mysqlmanager-pwgen"
|
||||
MYSQL="$BASEDIR/client/mysql"
|
||||
MYSQL_MANAGER_PWGEN="$CLIENT_BINDIR/mysqlmanager-pwgen"
|
||||
MYSQL="$CLIENT_BINDIR/mysql"
|
||||
LANGUAGE="$BASEDIR/sql/share/english/"
|
||||
CHARSETSDIR="$BASEDIR/sql/share/charsets"
|
||||
INSTALL_DB="./install_test_db"
|
||||
|
@ -478,17 +479,18 @@ else
|
|||
else
|
||||
MYSQLD="$VALGRIND $BASEDIR/bin/mysqld"
|
||||
fi
|
||||
MYSQL_TEST="$BASEDIR/bin/mysqltest"
|
||||
MYSQL_DUMP="$BASEDIR/bin/mysqldump"
|
||||
MYSQL_BINLOG="$BASEDIR/bin/mysqlbinlog"
|
||||
MYSQLADMIN="$BASEDIR/bin/mysqladmin"
|
||||
WAIT_PID="$BASEDIR/bin/mysql_waitpid"
|
||||
MYSQL_MANAGER="$BASEDIR/bin/mysqlmanager"
|
||||
MYSQL_MANAGER_CLIENT="$BASEDIR/bin/mysqlmanagerc"
|
||||
MYSQL_MANAGER_PWGEN="$BASEDIR/bin/mysqlmanager-pwgen"
|
||||
MYSQL="$BASEDIR/bin/mysql"
|
||||
CLIENT_BINDIR="$BASEDIR/bin"
|
||||
MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
|
||||
MYSQL_DUMP="$CLIENT_BINDIR/mysqldump"
|
||||
MYSQL_BINLOG="$CLIENT_BINDIR/mysqlbinlog"
|
||||
MYSQLADMIN="$CLIENT_BINDIR/mysqladmin"
|
||||
WAIT_PID="$CLIENT_BINDIR/mysql_waitpid"
|
||||
MYSQL_MANAGER="$CLIENT_BINDIR/mysqlmanager"
|
||||
MYSQL_MANAGER_CLIENT="$CLIENT_BINDIR/mysqlmanagerc"
|
||||
MYSQL_MANAGER_PWGEN="$CLIENT_BINDIR/mysqlmanager-pwgen"
|
||||
MYSQL="$CLIENT_BINDIR/mysql"
|
||||
INSTALL_DB="./install_test_db --bin"
|
||||
MYSQL_FIX_SYSTEM_TABLES="$BASEDIR/bin/mysql_fix_privilege_tables"
|
||||
MYSQL_FIX_SYSTEM_TABLES="$CLIENT_BINDIR/mysql_fix_privilege_tables"
|
||||
if test -d "$BASEDIR/share/mysql/english"
|
||||
then
|
||||
LANGUAGE="$BASEDIR/share/mysql/english/"
|
||||
|
@ -499,14 +501,11 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK"
|
||||
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD"
|
||||
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR"
|
||||
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password="
|
||||
MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password="
|
||||
export MYSQL
|
||||
export MYSQL_DUMP
|
||||
export MYSQL_BINLOG
|
||||
export MYSQL_FIX_SYSTEM_TABLES
|
||||
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --bindir=$CLIENT_BINDIR"
|
||||
MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
|
||||
export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR
|
||||
|
||||
if [ -z "$MASTER_MYSQLD" ]
|
||||
then
|
||||
|
@ -534,9 +533,9 @@ fi
|
|||
|
||||
if [ -w / ]
|
||||
then
|
||||
# We are running as root; We need to add the --root argument
|
||||
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --user=root"
|
||||
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --user=root"
|
||||
# We are running as root; We need to add the --root argument
|
||||
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --user=root"
|
||||
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --user=root"
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ CREATE TABLE db (
|
|||
KEY User (User)
|
||||
)
|
||||
type=ISAM;
|
||||
|
||||
|
||||
INSERT INTO db VALUES ('%','test', '','Y','Y','Y','Y','Y','Y');
|
||||
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y');
|
||||
|
||||
|
||||
CREATE TABLE host (
|
||||
Host char(60) binary DEFAULT '' NOT NULL,
|
||||
Db char(32) binary DEFAULT '' NOT NULL,
|
||||
|
@ -39,7 +39,7 @@ CREATE TABLE host (
|
|||
PRIMARY KEY Host (Host,Db)
|
||||
)
|
||||
type=ISAM;
|
||||
|
||||
|
||||
CREATE TABLE user (
|
||||
Host char(60) binary DEFAULT '' NOT NULL,
|
||||
User char(16) binary DEFAULT '' NOT NULL,
|
||||
|
@ -56,7 +56,7 @@ CREATE TABLE user (
|
|||
PRIMARY KEY Host (Host,User)
|
||||
)
|
||||
type=ISAM;
|
||||
|
||||
|
||||
INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y');
|
||||
INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','N');
|
||||
|
||||
|
|
|
@ -34,13 +34,13 @@ insert into test_columns_priv (Host,Db,User,Table_name,Column_name) values (@nam
|
|||
|
||||
# 'Host' field must be the same for all the tables:
|
||||
|
||||
select
|
||||
select
|
||||
if(isnull(test_db.Host),'WRONG!!!','ok') as test_db_Host,
|
||||
if(isnull(test_host.Host),'WRONG!!!','ok') as test_host_Host,
|
||||
if(isnull(test_user.Host),'WRONG!!!','ok') as test_user_Host,
|
||||
if(isnull(test_tables_priv.Host),'WRONG!!!','ok') as test_tables_priv_Host,
|
||||
if(isnull(test_columns_priv.Host),'WRONG!!!','ok') as test_columns_priv_Host
|
||||
|
||||
|
||||
from test_db
|
||||
left join test_host on test_db.Host=test_host.Host
|
||||
left join test_user on test_db.Host=test_user.Host
|
||||
|
@ -49,12 +49,12 @@ left join test_columns_priv on test_db.Host=test_columns_priv.Host;
|
|||
|
||||
# 'Db' field must be the same for all the tables:
|
||||
|
||||
select
|
||||
select
|
||||
if(isnull(test_db.Db),'WRONG!!!','ok') as test_db_Db,
|
||||
if(isnull(test_host.Db),'WRONG!!!','ok') as test_host_Db,
|
||||
if(isnull(test_tables_priv.Db),'WRONG!!!','ok') as test_tables_priv_Db,
|
||||
if(isnull(test_columns_priv.Db),'WRONG!!!','ok') as est_columns_priv_Db
|
||||
|
||||
|
||||
from test_db
|
||||
left join test_host on test_db.Db=test_host.Db
|
||||
left join test_tables_priv on test_db.Db=test_tables_priv.Db
|
||||
|
@ -67,7 +67,7 @@ select
|
|||
if(isnull(test_user.User),'WRONG!!!','ok') as test_user_User,
|
||||
if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
|
||||
if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
|
||||
|
||||
|
||||
from test_db
|
||||
left join test_user on test_db.User=test_user.User
|
||||
left join test_tables_priv on test_db.User=test_tables_priv.User
|
||||
|
@ -87,4 +87,3 @@ drop table test_func;
|
|||
drop table test_host;
|
||||
drop table test_user;
|
||||
drop table test_db;
|
||||
|
||||
|
|
|
@ -32,13 +32,23 @@
|
|||
# --password=<password>
|
||||
# --database=<database>
|
||||
|
||||
root_password="$1"
|
||||
root_password=""
|
||||
host="localhost"
|
||||
user="root"
|
||||
port=""
|
||||
socket=""
|
||||
comment=""
|
||||
database="mysql"
|
||||
bindir="@bindir@"
|
||||
|
||||
# Old format where there is only one argument and it's the password
|
||||
if test "$#" == 1
|
||||
then
|
||||
case "$1" in
|
||||
--*) ;;
|
||||
*) root_password="$1" ; shift ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# read all the options
|
||||
parse_arguments()
|
||||
|
@ -52,6 +62,7 @@ parse_arguments()
|
|||
--socket=*) socket=`echo "$arg" | sed -e "s;--socket=;;"` ;;
|
||||
--password=*) root_password=`echo "$arg" | sed -e "s;--password=;;"` ;;
|
||||
--database=*) database=`echo "$arg" | sed -e "s;--database=;;"` ;;
|
||||
--bindir=*) bindir=`echo "$arg" | sed -e "s;--bindir=;;"` ;;
|
||||
*)
|
||||
echo "Unknown argument '$arg'"
|
||||
exit 1
|
||||
|
@ -63,7 +74,7 @@ parse_arguments()
|
|||
parse_arguments "$@"
|
||||
|
||||
if test -z "$cmd"; then
|
||||
cmd="@bindir@/mysql -f --user=$user --host=$host"
|
||||
cmd="$bindir/mysql -f --user=$user --host=$host"
|
||||
if test ! -z "$root_password"; then
|
||||
cmd="$cmd --password=$root_password"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue