Merge from 5.1 main.
This commit is contained in:
commit
02a5dd38f3
@ -280,6 +280,7 @@ enum enum_commands {
|
||||
Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR,
|
||||
Q_LIST_FILES, Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE,
|
||||
Q_SEND_SHUTDOWN, Q_SHUTDOWN_SERVER,
|
||||
Q_MOVE_FILE,
|
||||
|
||||
Q_UNKNOWN, /* Unknown command. */
|
||||
Q_COMMENT, /* Comments, ignored. */
|
||||
@ -376,6 +377,7 @@ const char *command_names[]=
|
||||
"list_files_append_file",
|
||||
"send_shutdown",
|
||||
"shutdown_server",
|
||||
"move_file",
|
||||
|
||||
0
|
||||
};
|
||||
@ -966,6 +968,7 @@ void check_command_args(struct st_command *command,
|
||||
for (i= 0; i < num_args; i++)
|
||||
{
|
||||
const struct command_arg *arg= &args[i];
|
||||
char delimiter;
|
||||
|
||||
switch (arg->type) {
|
||||
/* A string */
|
||||
@ -974,8 +977,15 @@ void check_command_args(struct st_command *command,
|
||||
while (*ptr && *ptr == ' ')
|
||||
ptr++;
|
||||
start= ptr;
|
||||
/* Find end of arg, terminated by "delimiter_arg" */
|
||||
while (*ptr && *ptr != delimiter_arg)
|
||||
delimiter = delimiter_arg;
|
||||
/* If start of arg is ' ` or " search to matching quote end instead */
|
||||
if (*ptr && strchr ("'`\"", *ptr))
|
||||
{
|
||||
delimiter= *ptr;
|
||||
start= ++ptr;
|
||||
}
|
||||
/* Find end of arg, terminated by "delimiter" */
|
||||
while (*ptr && *ptr != delimiter)
|
||||
ptr++;
|
||||
if (ptr > start)
|
||||
{
|
||||
@ -987,6 +997,11 @@ void check_command_args(struct st_command *command,
|
||||
/* Empty string */
|
||||
init_dynamic_string(arg->ds, "", 0, 0);
|
||||
}
|
||||
/* Find real end of arg, terminated by "delimiter_arg" */
|
||||
/* This will do nothing if arg was not closed by quotes */
|
||||
while (*ptr && *ptr != delimiter_arg)
|
||||
ptr++;
|
||||
|
||||
command->last_argument= (char*)ptr;
|
||||
|
||||
/* Step past the delimiter */
|
||||
@ -1798,7 +1813,7 @@ void check_result()
|
||||
log_file.file_name(), reject_file, errno);
|
||||
|
||||
show_diff(NULL, result_file_name, reject_file);
|
||||
die(mess);
|
||||
die("%s", mess);
|
||||
break;
|
||||
}
|
||||
default: /* impossible */
|
||||
@ -2893,6 +2908,42 @@ void do_copy_file(struct st_command *command)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SYNOPSIS
|
||||
do_move_file
|
||||
command command handle
|
||||
|
||||
DESCRIPTION
|
||||
move_file <from_file> <to_file>
|
||||
Move <from_file> to <to_file>
|
||||
*/
|
||||
|
||||
void do_move_file(struct st_command *command)
|
||||
{
|
||||
int error;
|
||||
static DYNAMIC_STRING ds_from_file;
|
||||
static DYNAMIC_STRING ds_to_file;
|
||||
const struct command_arg move_file_args[] = {
|
||||
{ "from_file", ARG_STRING, TRUE, &ds_from_file, "Filename to move from" },
|
||||
{ "to_file", ARG_STRING, TRUE, &ds_to_file, "Filename to move to" }
|
||||
};
|
||||
DBUG_ENTER("do_move_file");
|
||||
|
||||
check_command_args(command, command->first_argument,
|
||||
move_file_args,
|
||||
sizeof(move_file_args)/sizeof(struct command_arg),
|
||||
' ');
|
||||
|
||||
DBUG_PRINT("info", ("Move %s to %s", ds_from_file.str, ds_to_file.str));
|
||||
error= (my_rename(ds_from_file.str, ds_to_file.str,
|
||||
MYF(0)) != 0);
|
||||
handle_command_error(command, error);
|
||||
dynstr_free(&ds_from_file);
|
||||
dynstr_free(&ds_to_file);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SYNOPSIS
|
||||
do_chmod_file
|
||||
@ -4550,7 +4601,7 @@ void select_connection(struct st_command *command)
|
||||
};
|
||||
check_command_args(command, command->first_argument, connection_args,
|
||||
sizeof(connection_args)/sizeof(struct command_arg),
|
||||
',');
|
||||
' ');
|
||||
|
||||
DBUG_PRINT("info", ("changing connection: %s", ds_connection.str));
|
||||
select_connection_name(ds_connection.str);
|
||||
@ -7684,6 +7735,7 @@ int main(int argc, char **argv)
|
||||
case Q_CHANGE_USER: do_change_user(command); break;
|
||||
case Q_CAT_FILE: do_cat_file(command); break;
|
||||
case Q_COPY_FILE: do_copy_file(command); break;
|
||||
case Q_MOVE_FILE: do_move_file(command); break;
|
||||
case Q_CHMOD_FILE: do_chmod_file(command); break;
|
||||
case Q_PERL: do_perl(command); break;
|
||||
case Q_DELIMITER:
|
||||
|
@ -1,5 +1,5 @@
|
||||
perl mysql-test-run.pl --timer --force --comment=n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --comment=ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --comment=embedded --embedded --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --comment=rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --comment=funcs_1 --suite=funcs_1 --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --embedded --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental
|
||||
perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --suite=funcs_1 --experimental=collections/default.experimental
|
||||
|
@ -71,6 +71,8 @@ sub _mtr_report_test_name ($) {
|
||||
|
||||
print _name(), _timestamp();
|
||||
printf "%-40s ", $tname;
|
||||
my $worker = $tinfo->{worker};
|
||||
printf "w$worker " if $worker;
|
||||
|
||||
return $tname;
|
||||
}
|
||||
@ -219,8 +221,8 @@ sub mtr_report_test ($) {
|
||||
}
|
||||
|
||||
|
||||
sub mtr_report_stats ($) {
|
||||
my $tests= shift;
|
||||
sub mtr_report_stats ($;$) {
|
||||
my ($tests, $dont_error)= @_;
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Find out how we where doing
|
||||
@ -372,7 +374,7 @@ sub mtr_report_stats ($) {
|
||||
|
||||
if ( $tot_failed != 0 || $found_problems)
|
||||
{
|
||||
mtr_error("there were failing test cases");
|
||||
mtr_error("there were failing test cases") unless $dont_error;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,7 +313,7 @@ sub main {
|
||||
|
||||
#######################################################################
|
||||
my $num_tests= @$tests;
|
||||
if ( not defined $opt_parallel ) {
|
||||
if ( $opt_parallel eq "auto" ) {
|
||||
# Try to find a suitable value for number of workers
|
||||
my $sys_info= My::SysInfo->new();
|
||||
|
||||
@ -528,6 +528,8 @@ sub run_test_server ($$$) {
|
||||
elsif ($opt_max_test_fail > 0 and
|
||||
$num_failed_test >= $opt_max_test_fail) {
|
||||
$suite_timeout_proc->kill();
|
||||
push(@$completed, $result);
|
||||
mtr_report_stats($completed, 1);
|
||||
mtr_report("Too many tests($num_failed_test) failed!",
|
||||
"Terminating...");
|
||||
return undef;
|
||||
@ -659,6 +661,7 @@ sub run_test_server ($$$) {
|
||||
# ----------------------------------------------------
|
||||
if ( ! $suite_timeout_proc->wait_one(0) )
|
||||
{
|
||||
mtr_report_stats($completed, 1);
|
||||
mtr_report("Test suite timeout! Terminating...");
|
||||
return undef;
|
||||
}
|
||||
@ -723,6 +726,8 @@ sub run_worker ($) {
|
||||
delete($test->{'comment'});
|
||||
delete($test->{'logfile'});
|
||||
|
||||
$test->{worker} = $thread_num if $opt_parallel > 1;
|
||||
|
||||
run_testcase($test);
|
||||
#$test->{result}= 'MTR_RES_PASSED';
|
||||
# Send it back, now with results set
|
||||
@ -790,7 +795,7 @@ sub command_line_setup {
|
||||
'vs-config' => \$opt_vs_config,
|
||||
|
||||
# Max number of parallel threads to use
|
||||
'parallel=i' => \$opt_parallel,
|
||||
'parallel=s' => \$opt_parallel,
|
||||
|
||||
# Config file to use as template for all tests
|
||||
'defaults-file=s' => \&collect_option,
|
||||
@ -1130,9 +1135,9 @@ sub command_line_setup {
|
||||
# --------------------------------------------------------------------------
|
||||
# Check parallel value
|
||||
# --------------------------------------------------------------------------
|
||||
if ($opt_parallel < 1)
|
||||
if ($opt_parallel ne "auto" && $opt_parallel < 1)
|
||||
{
|
||||
mtr_error("0 or negative parallel value makes no sense, use positive number");
|
||||
mtr_error("0 or negative parallel value makes no sense, use 'auto' or positive number");
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
@ -5197,6 +5202,7 @@ Misc options
|
||||
fast Run as fast as possible, dont't wait for servers
|
||||
to shutdown etc.
|
||||
parallel=N Run tests in N parallel threads (default=1)
|
||||
Use parallel=auto for auto-setting of N
|
||||
repeat=N Run each test N number of times
|
||||
retry=N Retry tests that fail N times, limit number of failures
|
||||
to $opt_retry_failure
|
||||
|
@ -545,6 +545,8 @@ mysqltest: At line 1: Failed to open file 'non_existing_file'
|
||||
mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists'
|
||||
mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file'
|
||||
mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file'
|
||||
mysqltest: At line 1: Missing required argument 'from_file' to command 'move_file'
|
||||
mysqltest: At line 1: Missing required argument 'to_file' to command 'move_file'
|
||||
mysqltest: At line 1: Missing required argument 'mode' to command 'chmod'
|
||||
mysqltest: At line 1: You must write a 4 digit octal number for mode
|
||||
mysqltest: At line 1: You must write a 4 digit octal number for mode
|
||||
@ -697,6 +699,7 @@ statement="SHOW COLUMNS FROM t1" row_number=1, column_name="Type", Value=int(11)
|
||||
statement=SHOW COLUMNS FROM t1 row_number=1, column_name=Default, Value=NULL
|
||||
value= ->A B<-
|
||||
value= 1
|
||||
value= 2
|
||||
mysqltest: At line 1: query_get_value - argument list started with '(' must be ended with ')'
|
||||
mysqltest: At line 1: Missing required argument 'query' to command 'query_get_value'
|
||||
mysqltest: At line 1: Missing required argument 'column name' to command 'query_get_value'
|
||||
|
@ -212,7 +212,7 @@ GRANT PROCESS ON *.* TO ''@'localhost';
|
||||
--echo anonymous user with PROCESS privilege
|
||||
--echo SHOW/SELECT shows all processes/threads.
|
||||
--echo ####################################################################################
|
||||
connect (anonymous1,localhost,'',,information_schema);
|
||||
connect (anonymous1,localhost,"''",,information_schema);
|
||||
SHOW GRANTS;
|
||||
--replace_column 1 ID 3 HOST_NAME 6 TIME
|
||||
SHOW processlist;
|
||||
@ -253,7 +253,7 @@ REVOKE PROCESS ON *.* FROM ''@'localhost';
|
||||
|
||||
--echo ####################################################################################
|
||||
--echo 7.1 New connection (anonymous2,localhost,'',,information_schema)
|
||||
connect (anonymous2,localhost,'',,information_schema);
|
||||
connect (anonymous2,localhost,"''",,information_schema);
|
||||
--echo The anonymous user has no more the PROCESS privilege
|
||||
--echo Again only the processes of the anonymous user are visible.
|
||||
--echo ####################################################################################
|
||||
|
@ -55,7 +55,8 @@ disconnect con4;
|
||||
connect (fail_con,localhost,test,,test2);
|
||||
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
|
||||
--error ER_ACCESS_DENIED_ERROR
|
||||
connect (fail_con,localhost,test,,"");
|
||||
# Need to protect "" within '' so it's interpreted literally
|
||||
connect (fail_con,localhost,test,,'""');
|
||||
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
|
||||
--error ER_ACCESS_DENIED_ERROR
|
||||
connect (fail_con,localhost,test,zorro,test2);
|
||||
|
@ -1780,6 +1780,56 @@ remove_file $MYSQLTEST_VARDIR/tmp/file2.tmp;
|
||||
--error 1
|
||||
--exec echo "copy_file from_file;" | $MYSQL_TEST 2>&1
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# test for move_file
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# - Check that if source file does not exist, nothing will be created.
|
||||
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp;
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp;
|
||||
--error 1
|
||||
move_file $MYSQLTEST_VARDIR/tmp/file1.tmp $MYSQLTEST_VARDIR/tmp/file2.tmp;
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp;
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp;
|
||||
|
||||
# - Check that if source file exists, everything works properly.
|
||||
|
||||
--write_file $MYSQLTEST_VARDIR/tmp/file1.tmp
|
||||
file1
|
||||
EOF
|
||||
|
||||
move_file $MYSQLTEST_VARDIR/tmp/file1.tmp $MYSQLTEST_VARDIR/tmp/file2.tmp;
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp;
|
||||
file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp;
|
||||
|
||||
# - Check that if destination file exists, everything works properly.
|
||||
# (file2.tmp exists from the previous check; file1.tmp needs to be created)
|
||||
|
||||
--write_file $MYSQLTEST_VARDIR/tmp/file1.tmp
|
||||
file1
|
||||
EOF
|
||||
|
||||
move_file $MYSQLTEST_VARDIR/tmp/file1.tmp $MYSQLTEST_VARDIR/tmp/file2.tmp;
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp;
|
||||
file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp;
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/file2.tmp;
|
||||
|
||||
# - Check usage.
|
||||
|
||||
--error 1
|
||||
--exec echo "move_file ;" | $MYSQL_TEST 2>&1
|
||||
|
||||
--error 1
|
||||
--exec echo "move_file from_file;" | $MYSQL_TEST 2>&1
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# test for chmod
|
||||
# ----------------------------------------------------------------------------
|
||||
@ -2037,6 +2087,10 @@ let $value= query_get_value(SELECT 'A B' AS "MyColumn", MyColumn, 1);
|
||||
let $value= query_get_value(SELECT 1 AS "My Column", My Column, 1);
|
||||
--echo value= $value
|
||||
#
|
||||
# 4.1 Query containing , protected by quotes, quotes also on column
|
||||
let $value= query_get_value('SELECT 1 as a, 2 as b', "b", 1);
|
||||
--echo value= $value
|
||||
#
|
||||
#------------ Negative tests ------------
|
||||
# 5. Incomplete statement including missing parameters
|
||||
# 5.1 incomplete statement
|
||||
|
Loading…
x
Reference in New Issue
Block a user