Commit d6f8da6e authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

merge

parents 6efcf9e3 7ba05466
This diff is collapsed.
...@@ -774,6 +774,7 @@ connection default; ...@@ -774,6 +774,7 @@ connection default;
handler t1 read a next; handler t1 read a next;
handler t1 close; handler t1 close;
connection con1; connection con1;
--reap # Since last in this connection was a send
drop table t1; drop table t1;
disconnect con1; disconnect con1;
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
......
...@@ -194,6 +194,27 @@ INSERT INTO global_suppressions VALUES ...@@ -194,6 +194,27 @@ INSERT INTO global_suppressions VALUES
("Slave I/O: Get master COLLATION_SERVER failed with error:.*"), ("Slave I/O: Get master COLLATION_SERVER failed with error:.*"),
("Slave I/O: Get master TIME_ZONE failed with error:.*"), ("Slave I/O: Get master TIME_ZONE failed with error:.*"),
/* Messages from valgrind */
("==[0-9]*== Memcheck,"),
("==[0-9]*== Copyright"),
("==[0-9]*== Using"),
("==[0-9]*== For more details"),
/* This comes with innodb plugin tests */
("==[0-9]*== Warning: set address range perms: large range"),
/* valgrind warnings: invalid file descriptor -1 in syscall
write()/read(). Bug #50414 */
("==[0-9]*== Warning: invalid file descriptor -1 in syscall write()"),
("==[0-9]*== Warning: invalid file descriptor -1 in syscall read()"),
/*
Transient network failures that cause warnings on reconnect.
BUG#47743 and BUG#47983.
*/
("Slave I/O: Get master SERVER_ID failed with error:.*"),
("Slave I/O: Get master clock failed with error:.*"),
("Slave I/O: Get master COLLATION_SERVER failed with error:.*"),
("Slave I/O: Get master TIME_ZONE failed with error:.*"),
/* /*
BUG#42147 - Concurrent DML and LOCK TABLE ... READ for InnoDB BUG#42147 - Concurrent DML and LOCK TABLE ... READ for InnoDB
table cause warnings in errlog table cause warnings in errlog
......
...@@ -81,7 +81,6 @@ sub is_child { ...@@ -81,7 +81,6 @@ sub is_child {
} }
# Find the safe process binary or script
my @safe_process_cmd; my @safe_process_cmd;
my $safe_kill; my $safe_kill;
my $bindir; my $bindir;
...@@ -96,21 +95,26 @@ else ...@@ -96,21 +95,26 @@ else
$bindir = "."; $bindir = ".";
} }
if (IS_WIN32PERL or IS_CYGWIN){
# Use my_safe_process.exe
my $exe= my_find_bin($bindir, ["lib/My/SafeProcess", "My/SafeProcess"],
"my_safe_process");
push(@safe_process_cmd, $exe);
# Use my_safe_kill.exe # Find the safe process binary or script
$safe_kill= my_find_bin($bindir, "lib/My/SafeProcess", "my_safe_kill"); sub find_bin {
} if (IS_WIN32PERL or IS_CYGWIN)
else {
{ # Use my_safe_process.exe
# Use my_safe_process my $exe= my_find_bin($bindir, ["lib/My/SafeProcess", "My/SafeProcess"],
my $exe= my_find_bin($bindir, ["lib/My/SafeProcess", "My/SafeProcess"], "my_safe_process");
"my_safe_process"); push(@safe_process_cmd, $exe);
push(@safe_process_cmd, $exe);
# Use my_safe_kill.exe
$safe_kill= my_find_bin($bindir, "lib/My/SafeProcess", "my_safe_kill");
}
else
{
# Use my_safe_process
my $exe= my_find_bin($bindir, ["lib/My/SafeProcess", "My/SafeProcess"],
"my_safe_process");
push(@safe_process_cmd, $exe);
}
} }
...@@ -195,63 +199,6 @@ sub run { ...@@ -195,63 +199,6 @@ sub run {
return $proc->exit_status(); return $proc->exit_status();
} }
#
# Start a process that returns after "duration" seconds
# or when it's parent process does not exist anymore
#
sub timer {
my $class= shift;
my $duration= shift or croak "duration required";
my $parent_pid= $$;
my $pid= My::SafeProcess::Base::_safe_fork();
if ($pid){
# Parent
my $proc= bless
({
SAFE_PID => $pid,
SAFE_NAME => "timer",
PARENT => $$,
}, $class);
# Put the new process in list of running
$running{$pid}= $proc;
return $proc;
}
# Child, install signal handlers and sleep for "duration"
$SIG{INT}= 'IGNORE';
$SIG{TERM}= sub {
#print STDERR "timer $$: woken up, exiting!\n";
exit(0);
};
$0= "safe_timer($duration)";
if (IS_WIN32PERL){
# Just a thread in same process
sleep($duration);
print STDERR "timer $$: expired after $duration seconds\n";
exit(0);
}
my $count_down= $duration;
while($count_down--){
# Check that parent is still alive
if (kill(0, $parent_pid) == 0){
#print STDERR "timer $$: parent gone, exiting!\n";
exit(0);
}
sleep(1);
}
print STDERR "timer $$: expired after $duration seconds\n";
exit(0);
}
# #
# Shutdown process nicely, and wait for shutdown_timeout seconds # Shutdown process nicely, and wait for shutdown_timeout seconds
# If processes hasn't shutdown, kill them hard and wait for return # If processes hasn't shutdown, kill them hard and wait for return
...@@ -350,12 +297,12 @@ sub start_kill { ...@@ -350,12 +297,12 @@ sub start_kill {
$ret= system($safe_kill, $winpid) >> 8; $ret= system($safe_kill, $winpid) >> 8;
if ($ret == 3){ if ($ret == 3){
print "Couldn't open the winpid: $winpid ", print "Couldn't open the winpid: $winpid ".
"for pid: $pid, try one more time\n"; "for pid: $pid, try one more time\n";
sleep(1); sleep(1);
$winpid= _winpid($pid); $winpid= _winpid($pid);
$ret= system($safe_kill, $winpid) >> 8; $ret= system($safe_kill, $winpid) >> 8;
print "Couldn't open the winpid: $winpid ", print "Couldn't open the winpid: $winpid ".
"for pid: $pid, continue and see what happens...\n"; "for pid: $pid, continue and see what happens...\n";
} }
} }
...@@ -549,6 +496,40 @@ sub wait_any { ...@@ -549,6 +496,40 @@ sub wait_any {
} }
#
# Wait for any process to exit, or a timeout
#
# Returns a reference to the SafeProcess that
# exited or a pseudo-process with $proc->{timeout} == 1
#
sub wait_any_timeout {
my $class= shift;
my $timeout= shift;
my $proc;
my $millis=10;
do {
::mtr_milli_sleep($millis);
# Slowly increse interval up to max. 1 second
$millis++ if $millis < 1000;
# Return a "fake" process for timeout
if (::has_expired($timeout)) {
$proc= bless
({
SAFE_PID => 0,
SAFE_NAME => "timer",
timeout => 1,
}, $class);
} else {
$proc= check_any();
}
} while (! $proc);
return $proc;
}
# #
# Wait for all processes to exit # Wait for all processes to exit
# #
...@@ -606,7 +587,7 @@ sub self2str { ...@@ -606,7 +587,7 @@ sub self2str {
sub _verbose { sub _verbose {
return unless $_verbose; return unless $_verbose;
print STDERR " ## ", @_, "\n"; print STDERR " ## ". @_. "\n";
} }
......
...@@ -187,14 +187,20 @@ int main(int argc, const char** argv ) ...@@ -187,14 +187,20 @@ int main(int argc, const char** argv )
die("No real args -> nothing to do"); die("No real args -> nothing to do");
/* Copy the remaining args to child_arg */ /* Copy the remaining args to child_arg */
for (int j= i+1; j < argc; j++) { for (int j= i+1; j < argc; j++) {
if (strchr (argv[j], ' ')) { arg= argv[j];
/* Protect with "" if this arg contains a space */ if (strchr (arg, ' ') &&
to+= _snprintf(to, child_args + sizeof(child_args) - to, arg[0] != '\"' &&
"\"%s\" ", argv[j]); arg[strlen(arg)] != '\"')
} else { {
to+= _snprintf(to, child_args + sizeof(child_args) - to, /* Quote arg that contains spaces and are not quoted already */
"%s ", argv[j]); to+= _snprintf(to, child_args + sizeof(child_args) - to,
} "\"%s\" ", arg);
}
else
{
to+= _snprintf(to, child_args + sizeof(child_args) - to,
"%s ", arg);
}
} }
break; break;
} else { } else {
......
...@@ -40,7 +40,6 @@ our $default_storage_engine; ...@@ -40,7 +40,6 @@ our $default_storage_engine;
our $opt_with_ndbcluster_only; our $opt_with_ndbcluster_only;
our $defaults_file; our $defaults_file;
our $defaults_extra_file; our $defaults_extra_file;
our $reorder= 1;
our $quick_collect; our $quick_collect;
sub collect_option { sub collect_option {
...@@ -99,7 +98,8 @@ sub init_pattern { ...@@ -99,7 +98,8 @@ sub init_pattern {
# #
############################################################################## ##############################################################################
sub collect_test_cases ($$) { sub collect_test_cases ($$$) {
my $opt_reorder= shift; # True if we're reordering tests
my $suites= shift; # Semicolon separated list of test suites my $suites= shift; # Semicolon separated list of test suites
my $opt_cases= shift; my $opt_cases= shift;
my $cases= []; # Array of hash(one hash for each testcase) my $cases= []; # Array of hash(one hash for each testcase)
...@@ -118,10 +118,16 @@ sub collect_test_cases ($$) { ...@@ -118,10 +118,16 @@ sub collect_test_cases ($$) {
!(IS_WINDOWS && $::opt_embedded_server) && !(IS_WINDOWS && $::opt_embedded_server) &&
$lib_innodb_plugin); $lib_innodb_plugin);
foreach my $suite (split(",", $suites)) # If not reordering, we also shouldn't group by suites, unless
# no test cases were named.
# This also effects some logic in the loop following this.
if ($opt_reorder or !@$opt_cases)
{ {
push(@$cases, collect_one_suite($suite, $opt_cases)); foreach my $suite (split(",", $suites))
last if $some_test_found; {
push(@$cases, collect_one_suite($suite, $opt_cases));
last if $some_test_found;
}
} }
if ( @$opt_cases ) if ( @$opt_cases )
...@@ -135,6 +141,7 @@ sub collect_test_cases ($$) { ...@@ -135,6 +141,7 @@ sub collect_test_cases ($$) {
my ($sname, $tname, $extension)= split_testname($test_name_spec); my ($sname, $tname, $extension)= split_testname($test_name_spec);
foreach my $test ( @$cases ) foreach my $test ( @$cases )
{ {
last unless $opt_reorder;
# test->{name} is always in suite.name format # test->{name} is always in suite.name format
if ( $test->{name} =~ /.*\.$tname/ ) if ( $test->{name} =~ /.*\.$tname/ )
{ {
...@@ -144,12 +151,13 @@ sub collect_test_cases ($$) { ...@@ -144,12 +151,13 @@ sub collect_test_cases ($$) {
} }
if ( not $found ) if ( not $found )
{ {
$sname= "main" if !$opt_reorder and !$sname;
mtr_error("Could not find '$tname' in '$suites' suite(s)") unless $sname; mtr_error("Could not find '$tname' in '$suites' suite(s)") unless $sname;
# If suite was part of name, find it there # If suite was part of name, find it there, may come with combinations
my ($this_case) = collect_one_suite($sname, [ $tname ]); my @this_case = collect_one_suite($sname, [ $tname ]);
if ($this_case) if (@this_case)
{ {
push (@$cases, $this_case); push (@$cases, @this_case);
} }
else else
{ {
...@@ -159,7 +167,7 @@ sub collect_test_cases ($$) { ...@@ -159,7 +167,7 @@ sub collect_test_cases ($$) {
} }
} }
if ( $reorder && !$quick_collect) if ( $opt_reorder && !$quick_collect)
{ {
# Reorder the test cases in an order that will make them faster to run # Reorder the test cases in an order that will make them faster to run
my %sort_criteria; my %sort_criteria;
......
...@@ -20,43 +20,20 @@ ...@@ -20,43 +20,20 @@
use strict; use strict;
# These are not to be prefixed with "mtr_" sub gprof_collect ($@) {
my ($exe_mysqld, @gprof_dirs)= @_;
sub gprof_prepare (); print ("Collecting gprof reports.....\n");
sub gprof_collect ();
############################################################################## foreach my $datadir (@gprof_dirs)
#
#
#
##############################################################################
sub gprof_prepare () {
rmtree($::opt_gprof_dir);
mkdir($::opt_gprof_dir);
}
# FIXME what about master1 and slave1?!
sub gprof_collect () {
if ( -f "$::master->[0]->{'path_myddir'}/gmon.out" )
{
# FIXME check result code?!
mtr_run("gprof",
[$::exe_master_mysqld,
"$::master->[0]->{'path_myddir'}/gmon.out"],
$::opt_gprof_master, "", "", "");
print "Master execution profile has been saved in $::opt_gprof_master\n";
}
if ( -f "$::slave->[0]->{'path_myddir'}/gmon.out" )
{ {
# FIXME check result code?! my $gprof_msg= "$datadir/gprof.msg";
mtr_run("gprof", my $gprof_err= "$datadir/gprof.err";
[$::exe_slave_mysqld, if ( -f "$datadir/gmon.out" )
"$::slave->[0]->{'path_myddir'}/gmon.out"], {
$::opt_gprof_slave, "", "", ""); system("gprof $exe_mysqld $datadir/gmon.out 2>$gprof_err >$gprof_msg");
print "Slave execution profile has been saved in $::opt_gprof_slave\n"; print ("GPROF output in $gprof_msg, errors in $gprof_err\n");
}
} }
} }
......
...@@ -30,7 +30,9 @@ sub mtr_script_exists(@); ...@@ -30,7 +30,9 @@ sub mtr_script_exists(@);
sub mtr_file_exists(@); sub mtr_file_exists(@);
sub mtr_exe_exists(@); sub mtr_exe_exists(@);
sub mtr_exe_maybe_exists(@); sub mtr_exe_maybe_exists(@);
sub mtr_milli_sleep($);
sub start_timer($);
sub has_expired($);
############################################################################## ##############################################################################
# #
...@@ -167,11 +169,18 @@ sub mtr_exe_exists (@) { ...@@ -167,11 +169,18 @@ sub mtr_exe_exists (@) {
} }
sub mtr_milli_sleep { sub mtr_milli_sleep ($) {
die "usage: mtr_milli_sleep(milliseconds)" unless @_ == 1; die "usage: mtr_milli_sleep(milliseconds)" unless @_ == 1;
my ($millis)= @_; my ($millis)= @_;
select(undef, undef, undef, ($millis/1000)); select(undef, undef, undef, ($millis/1000));
} }
# Simple functions to start and check timers (have to be actively polled)
# Timer can be "killed" by setting it to 0
sub start_timer ($) { return time + $_[0]; }
sub has_expired ($) { return $_[0] && time gt $_[0]; }
1; 1;
...@@ -69,7 +69,7 @@ sub _mtr_report_test_name ($) { ...@@ -69,7 +69,7 @@ sub _mtr_report_test_name ($) {
$tname.= " '$tinfo->{combination}'" $tname.= " '$tinfo->{combination}'"
if defined $tinfo->{combination}; if defined $tinfo->{combination};
print _name(), _timestamp(); print _name(). _timestamp();
printf "%-40s ", $tname; printf "%-40s ", $tname;
my $worker = $tinfo->{worker}; my $worker = $tinfo->{worker};
printf "w$worker " if $worker; printf "w$worker " if $worker;
...@@ -222,8 +222,8 @@ sub mtr_report_test ($) { ...@@ -222,8 +222,8 @@ sub mtr_report_test ($) {
} }
sub mtr_report_stats ($;$) { sub mtr_report_stats ($$;$) {
my ($tests, $dont_error)= @_; my ($prefix, $tests, $dont_error)= @_;
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Find out how we where doing # Find out how we where doing
...@@ -328,6 +328,9 @@ sub mtr_report_stats ($;$) { ...@@ -328,6 +328,9 @@ sub mtr_report_stats ($;$) {
} }
} }
# Print summary line prefix
print "$prefix: ";
# Print a list of testcases that failed # Print a list of testcases that failed
if ( $tot_failed != 0 ) if ( $tot_failed != 0 )
{ {
...@@ -387,13 +390,13 @@ sub mtr_report_stats ($;$) { ...@@ -387,13 +390,13 @@ sub mtr_report_stats ($;$) {
############################################################################## ##############################################################################
sub mtr_print_line () { sub mtr_print_line () {
print '-' x 60, "\n"; print '-' x 60 . "\n";
} }
sub mtr_print_thick_line { sub mtr_print_thick_line {
my $char= shift || '='; my $char= shift || '=';
print $char x 78, "\n"; print $char x 78 . "\n";
} }
...@@ -451,7 +454,7 @@ sub _timestamp { ...@@ -451,7 +454,7 @@ sub _timestamp {
# Always print message to screen # Always print message to screen
sub mtr_print (@) { sub mtr_print (@) {
print _name(), join(" ", @_), "\n"; print _name(). join(" ", @_). "\n";
} }
...@@ -459,22 +462,22 @@ sub mtr_print (@) { ...@@ -459,22 +462,22 @@ sub mtr_print (@) {
sub mtr_report (@) { sub mtr_report (@) {
if (defined $verbose) if (defined $verbose)
{ {
print _name(), join(" ", @_), "\n"; print _name(). join(" ", @_). "\n";
} }
} }
# Print warning to screen # Print warning to screen
sub mtr_warning (@) { sub mtr_warning (@) {
print STDERR _name(), _timestamp(), print STDERR _name(). _timestamp().
"mysql-test-run: WARNING: ", join(" ", @_), "\n"; "mysql-test-run: WARNING: ". join(" ", @_). "\n";
} }
# Print error to screen and then exit # Print error to screen and then exit
sub mtr_error (@) { sub mtr_error (@) {
print STDERR _name(), _timestamp(), print STDERR _name(). _timestamp().
"mysql-test-run: *** ERROR: ", join(" ", @_), "\n"; "mysql-test-run: *** ERROR: ". join(" ", @_). "\n";
if (IS_WINDOWS) if (IS_WINDOWS)
{ {
POSIX::_exit(1); POSIX::_exit(1);
...@@ -489,8 +492,8 @@ sub mtr_error (@) { ...@@ -489,8 +492,8 @@ sub mtr_error (@) {
sub mtr_debug (@) { sub mtr_debug (@) {
if ( $verbose > 2 ) if ( $verbose > 2 )
{ {
print STDERR _name(), print STDERR _name().
_timestamp(), "####: ", join(" ", @_), "\n"; _timestamp(). "####: ". join(" ", @_). "\n";
} }
} }
...@@ -498,8 +501,8 @@ sub mtr_debug (@) { ...@@ -498,8 +501,8 @@ sub mtr_debug (@) {
sub mtr_verbose (@) { sub mtr_verbose (@) {
if ( $verbose ) if ( $verbose )
{ {
print STDERR _name(), _timestamp(), print STDERR _name(). _timestamp().
"> ",join(" ", @_),"\n"; "> ".join(" ", @_)."\n";
} }
} }
...@@ -509,8 +512,8 @@ sub mtr_verbose_restart (@) { ...@@ -509,8 +512,8 @@ sub mtr_verbose_restart (@) {
my $proc= $server->{proc}; my $proc= $server->{proc};
if ( $verbose_restart ) if ( $verbose_restart )
{ {
print STDERR _name(),_timestamp(), print STDERR _name()._timestamp().
"> Restart $proc - ",join(" ", @args),"\n"; "> Restart $proc - ".join(" ", @args)."\n";
} }
} }
......
...@@ -150,7 +150,7 @@ sub run_stress_test () ...@@ -150,7 +150,7 @@ sub run_stress_test ()
mtr_add_arg($args, "--verbose"); mtr_add_arg($args, "--verbose");
mtr_add_arg($args, "--cleanup"); mtr_add_arg($args, "--cleanup");
mtr_add_arg($args, "--log-error-details"); mtr_add_arg($args, "--log-error-details");
mtr_add_arg($args, "--abort-on-error"); mtr_add_arg($args, "--abort-on-error=1");
if ( $::opt_stress_init_file ) if ( $::opt_stress_init_file )
{ {
......
...@@ -150,7 +150,7 @@ sub run_stress_test () ...@@ -150,7 +150,7 @@ sub run_stress_test ()
mtr_add_arg($args, "--verbose"); mtr_add_arg($args, "--verbose");
mtr_add_arg($args, "--cleanup"); mtr_add_arg($args, "--cleanup");
mtr_add_arg($args, "--log-error-details"); mtr_add_arg($args, "--log-error-details");
mtr_add_arg($args, "--abort-on-error"); mtr_add_arg($args, "--abort-on-error=1");
if ( $::opt_stress_init_file ) if ( $::opt_stress_init_file )
{ {
......
...@@ -905,6 +905,11 @@ sub command_line_setup () { ...@@ -905,6 +905,11 @@ sub command_line_setup () {
mtr_report("Using default engine '$used_default_engine'") mtr_report("Using default engine '$used_default_engine'")
if defined $used_default_engine; if defined $used_default_engine;
if ($glob_win32 and defined $opt_mem) {
mtr_report("--mem not supported on Windows, ignored");
$opt_mem= undef;
}
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Check if we should speed up tests by trying to run on tmpfs # Check if we should speed up tests by trying to run on tmpfs
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
......
This diff is collapsed.
...@@ -147,9 +147,10 @@ hello ...@@ -147,9 +147,10 @@ hello
hello hello
;;;;;;;; ;;;;;;;;
# MySQL: -- The # MySQL: -- The
mysqltest: At line 1: End of line junk detected: "6" mysqltest: At line 1: Extra argument '6' passed to 'sleep'
mysqltest: At line 1: End of line junk detected: "6" mysqltest: At line 1: Extra argument '6' passed to 'sleep'
mysqltest: At line 1: Missing delimiter mysqltest: At line 1: Extra argument 'A comment
show status' passed to 'sleep'
mysqltest: At line 1: End of line junk detected: "sleep 7 mysqltest: At line 1: End of line junk detected: "sleep 7
# Another comment # Another comment
" "
...@@ -216,6 +217,12 @@ source database ...@@ -216,6 +217,12 @@ source database
echo message echo message echo message echo message
mysqltest: At line 1: Missing argument in exec mysqltest: At line 1: Missing argument in exec
1
1
2
2
X
3
MySQL MySQL
"MySQL" "MySQL"
MySQL: The MySQL: The
...@@ -348,8 +355,10 @@ here is the sourced script ...@@ -348,8 +355,10 @@ here is the sourced script
here is the sourced script here is the sourced script
"hello" "hello"
"hello" "hello"
mysqltest: At line 1: Missing argument to sleep mysqltest: At line 2: Invalid argument to sleep "xyz"
mysqltest: At line 1: Missing argument to real_sleep mysqltest: At line 2: Invalid argument to real_sleep "xyz"
mysqltest: At line 1: Missing required argument 'sleep_delay' to command 'sleep'
mysqltest: At line 1: Missing required argument 'sleep_delay' to command 'real_sleep'
mysqltest: At line 1: Invalid argument to sleep "abc" mysqltest: At line 1: Invalid argument to sleep "abc"
mysqltest: At line 1: Invalid argument to real_sleep "abc" mysqltest: At line 1: Invalid argument to real_sleep "abc"
1 1
...@@ -377,6 +386,10 @@ test ...@@ -377,6 +386,10 @@ test
test2 test2
test3 test3
test4 test4
outer
true-inner
true-inner again
true-outer
Counter is greater than 0, (counter=10) Counter is greater than 0, (counter=10)
Counter is not 0, (counter=0) Counter is not 0, (counter=0)
1 1
...@@ -417,6 +430,9 @@ mysqltest: At line 1: Wrong number of arguments to replace_column in 'replace_co ...@@ -417,6 +430,9 @@ mysqltest: At line 1: Wrong number of arguments to replace_column in 'replace_co
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a b' mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a b'
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a 1' mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a 1'
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1 b c ' mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1 b c '
select "LONG_STRING" as x;
x
LONG_STRING
mysqltest: At line 1: Invalid integer argument "10!" mysqltest: At line 1: Invalid integer argument "10!"
mysqltest: At line 1: Invalid integer argument "a" mysqltest: At line 1: Invalid integer argument "a"
mysqltest: At line 1: Missing required argument 'connection name' to command 'connect' mysqltest: At line 1: Missing required argument 'connection name' to command 'connect'
...@@ -523,7 +539,28 @@ a D ...@@ -523,7 +539,28 @@ a D
1 1 1 1
1 4 1 4
drop table t1; drop table t1;
create table t1 ( f1 char(10));
insert into t1 values ("Abcd");
select * from t1;
f1
Abcd
select * from t2;;
ERROR 42S02: Table 'test.t2' doesn't exist
select * from t1;
f1
Abcd
select * from t1;;
Result coming up
f1
Abcd
select * from t1;;
f1
Abcd
mysqltest: At line 2: Cannot run query on connection between send and reap
select * from t1;;
drop table t1;
mysqltest: At line 1: Missing required argument 'filename' to command 'remove_file' mysqltest: At line 1: Missing required argument 'filename' to command 'remove_file'
mysqltest: At line 1: Missing required argument 'directory' to command 'remove_files_wildcard'
mysqltest: At line 1: Missing required argument 'filename' to command 'write_file' mysqltest: At line 1: Missing required argument 'filename' to command 'write_file'
mysqltest: At line 1: End of file encountered before 'EOF' delimiter was found mysqltest: At line 1: End of file encountered before 'EOF' delimiter was found
Content for test_file1 Content for test_file1
...@@ -553,6 +590,8 @@ hello ...@@ -553,6 +590,8 @@ hello
mysqltest: At line 1: Max delimiter length(16) exceeded mysqltest: At line 1: Max delimiter length(16) exceeded
hello hello
hello hello
val is 5
val is 5
mysqltest: At line 1: test of die mysqltest: At line 1: test of die
Some output Some output
create table t1( a int, b char(255), c timestamp); create table t1( a int, b char(255), c timestamp);
...@@ -680,6 +719,29 @@ INSERT INTO t1 SELECT f1 - 256 FROM t1; ...@@ -680,6 +719,29 @@ INSERT INTO t1 SELECT f1 - 256 FROM t1;
INSERT INTO t1 SELECT f1 - 512 FROM t1; INSERT INTO t1 SELECT f1 - 512 FROM t1;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
select "500g blåbærsyltetøy" as "will be lower cased";
will be lower cased
500g blåbærsyltetøy
SELECT "UPPER" AS "WILL NOT BE lower cased";
WILL NOT BE lower cased
UPPER
UP
SELECT 0 as "UP AGAIN";
UP AGAIN
0
select "abcdef" as "uvwxyz";
uvwxyz
abcdef
select "xyz" as name union select "abc" as name order by name desc;
name
abc
xyz
select 1 as "some new text";
some new text
1
select 0 as "will not lower case ÄËÐ";
will not lower case ÄËÐ
0
CREATE TABLE t1( CREATE TABLE t1(
a int, b varchar(255), c datetime a int, b varchar(255), c datetime
); );
...@@ -726,6 +788,8 @@ mysqltest: At line 1: change user failed: Access denied for user 'root'@'localho ...@@ -726,6 +788,8 @@ mysqltest: At line 1: change user failed: Access denied for user 'root'@'localho
file1.txt file1.txt
file1.txt file1.txt
file2.txt file2.txt
file11.txt
dir-list.txt
SELECT 'c:\\a.txt' AS col; SELECT 'c:\\a.txt' AS col;
col col
z z
......
...@@ -78,6 +78,7 @@ COMMIT; ...@@ -78,6 +78,7 @@ COMMIT;
--echo 'CONNECTION con2' --echo 'CONNECTION con2'
CONNECTION con2; CONNECTION con2;
reap;
UNLOCK tables; UNLOCK tables;
DROP TABLE t1; DROP TABLE t1;
......
...@@ -128,6 +128,7 @@ connection con0; ...@@ -128,6 +128,7 @@ connection con0;
SET SESSION low_priority_updates = OFF; SET SESSION low_priority_updates = OFF;
--echo ** Connection con1 ** --echo ** Connection con1 **
connection con1; connection con1;
reap;
SET SESSION low_priority_updates = OFF; SET SESSION low_priority_updates = OFF;
--echo ** Connection default** --echo ** Connection default**
connection default; connection default;
......
...@@ -605,6 +605,15 @@ echo ; ...@@ -605,6 +605,15 @@ echo ;
--error 1 --error 1
--exec echo "--exec " | $MYSQL_TEST 2>&1 --exec echo "--exec " | $MYSQL_TEST 2>&1
# Multi-line exec
exec $MYSQL
test -e "select 1";
exec $MYSQL test -e "select
2";
let $query = select 3
as X;
exec $MYSQL test -e "$query";
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Test let command # Test let command
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -911,6 +920,28 @@ sleep 0.5; ...@@ -911,6 +920,28 @@ sleep 0.5;
sleep 1; sleep 1;
real_sleep 1; real_sleep 1;
# Parameter from variable, legal and illegal
let $sleep_var= 0.1;
sleep $sleep_var;
let $sleep_var= 1;
--real_sleep $sleep_var
--write_file $MYSQL_TMP_DIR/sleep.inc
let $sleep_var= xyz;
--sleep $sleep_var
EOF
--error 1
--exec $MYSQL_TEST < $MYSQL_TMP_DIR/sleep.inc 2>&1
--remove_file $MYSQL_TMP_DIR/sleep.inc
--write_file $MYSQL_TMP_DIR/sleep.inc
let $sleep_var= xyz;
real_sleep $sleep_var;
EOF
--error 1
--exec $MYSQL_TEST < $MYSQL_TMP_DIR/sleep.inc 2>&1
--remove_file $MYSQL_TMP_DIR/sleep.inc
# Missing parameter # Missing parameter
--error 1 --error 1
--exec echo "sleep ;" | $MYSQL_TEST 2>&1 --exec echo "sleep ;" | $MYSQL_TEST 2>&1
...@@ -1006,6 +1037,37 @@ echo test3stop ...@@ -1006,6 +1037,37 @@ echo test3stop
--delimiter ; --delimiter ;
echo test4; echo test4;
# ----------------------------------------------------------------------------
# Test that delimiter within if() works in in various combinations
# ----------------------------------------------------------------------------
if (0)
{
delimiter ||;
echo false-inner||
if (0)
{
delimiter *||
echo false-innerer*
delimiter ||*
}
echo false-inner again||
}
echo outer;
if (1)
{
delimiter /;
echo true-inner/
if (0)
{
delimiter %/
echo true-innerer%
}
echo true-inner again/
}
echo true-outer/
delimiter ;/
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Test if # Test if
...@@ -1285,6 +1347,17 @@ select "a" as col1, "c" as col2; ...@@ -1285,6 +1347,17 @@ select "a" as col1, "c" as col2;
--error 1 --error 1
--exec echo "--replace_column 1 b c " | $MYSQL_TEST 2>&1 --exec echo "--replace_column 1 b c " | $MYSQL_TEST 2>&1
let $long_rep= 1234567890123456789012345678901234567890;
let $long_rep= $long_rep,$long_rep;
let $long_rep= $long_rep,$long_rep;
let $long_rep= $long_rep,$long_rep;
let $long_rep= $long_rep,$long_rep;
let $long_rep= $long_rep,$long_rep;
# This tests from strings > 1024 (here 1311)
--replace_result $long_rep LONG_STRING
eval select "$long_rep" as x;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Test sync_with_master # Test sync_with_master
...@@ -1605,6 +1678,57 @@ insert into t1 values (2,4); ...@@ -1605,6 +1678,57 @@ insert into t1 values (2,4);
select * from t1; select * from t1;
drop table t1; drop table t1;
# ----------------------------------------------------------------------------
# Tests of send
# ----------------------------------------------------------------------------
create table t1 ( f1 char(10));
insert into t1 values ("Abcd");
# 1. Basic test
send select * from t1;
reap;
# 2. Test with error
--send select * from t2;
--error ER_NO_SUCH_TABLE
--reap
# 3. test send of next stmt
--send
select * from t1;
--reap
# 4. Non-query stmt betwen send and reap allowed
--send select * from t1;
--sleep 0.05
--echo Result coming up
--reap
# 5. Test of send_eval
--let $my_stmt= select * from t1;
--send_eval $my_stmt
--reap
# 6. Test that mysqltest does not allow query stmt between send and reap
# Untestable directly as it causes mysqltest to fail
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.in
--send select * from t1;
select 1;
--reap
EOF
--error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.in 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.in;
drop table t1;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# test for remove_file # test for remove_file
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -1615,6 +1739,19 @@ drop table t1; ...@@ -1615,6 +1739,19 @@ drop table t1;
--error 1 --error 1
remove_file non_existing_file; remove_file non_existing_file;
# ----------------------------------------------------------------------------
# test for remove_files_wildcard
# ----------------------------------------------------------------------------
--error 1
--exec echo "remove_files_wildcard ;" | $MYSQL_TEST 2>&1
--error 1
remove_files_wildcard non_existing_dir;
--error 1
remove_files_wildcard non_existing_dir non_existing_file;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# test for write_file # test for write_file
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -1905,6 +2042,20 @@ perl; ...@@ -1905,6 +2042,20 @@ perl;
print "hello\n"; print "hello\n";
EOF EOF
# Test perl within while, also with if being false first iteration
let $outer= 3;
let $ifval= 0;
while ($outer) {
if ($ifval) {
perl UNTIL;
my $val= 5;
print "val is $val\n";
UNTIL
}
inc $ifval;
dec $outer;
}
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# test for die # test for die
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -2045,6 +2196,44 @@ INSERT INTO t1 SELECT f1 - 512 FROM t1; ...@@ -2045,6 +2196,44 @@ INSERT INTO t1 SELECT f1 - 512 FROM t1;
SELECT * FROM t1; SELECT * FROM t1;
--enable_result_log --enable_result_log
DROP TABLE t1; DROP TABLE t1;
# ----------------------------------------------------------------------------
# test for lowercase_result
# ----------------------------------------------------------------------------
# 1. Basic test
--lowercase_result
SELECT "500g BLBRSYLTETY" AS "WILL BE lower cased";
# 2. test that it does not apply to next statement
SELECT "UPPER" AS "WILL NOT BE lower cased";
# 3. test that it does not affect non-SQL or the following statement
--lowercase_result
--echo UP
SELECT 0 as "UP AGAIN";
# 4. test that it works with eval and variables
let $lower_stmt=SELECT "ABCdef" AS "uvwXYZ";
--lowercase_result
eval $lower_stmt;
# 5. test that it works in combination with sort
sorted_result;
lowercase_result;
SELECT "Xyz" AS Name UNION SELECT "Abc" as Name ORDER BY Name DESC;
# 6. Test combination with replace, and that lower casing is done first
--lowercase_result
--replace_result old new
SELECT 1 as "SOME OLD TEXT";
# 7. Test missing lower casing of "unknown" characters
--character_set utf8
--lowercase_result
SELECT 0 as "WILL NOT lower case ";
--character_set latin1
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Some coverage tests # Some coverage tests
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -2230,9 +2419,14 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir; ...@@ -2230,9 +2419,14 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir;
cat_file $MYSQLTEST_VARDIR/tmp/testdir/file3.txt; cat_file $MYSQLTEST_VARDIR/tmp/testdir/file3.txt;
remove_file $MYSQLTEST_VARDIR/tmp/testdir/file1.txt; list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/file11.txt $MYSQLTEST_VARDIR/tmp/testdir file?.txt;
remove_file $MYSQLTEST_VARDIR/tmp/testdir/file2.txt; remove_files_wildcard $MYSQLTEST_VARDIR/tmp/testdir file?.txt;
remove_file $MYSQLTEST_VARDIR/tmp/testdir/file3.txt; list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/dir-list.txt $MYSQLTEST_VARDIR/tmp/testdir file*.txt;
cat_file $MYSQLTEST_VARDIR/tmp/testdir/dir-list.txt;
remove_files_wildcard $MYSQLTEST_VARDIR/tmp/testdir file*.txt;
list_files $MYSQLTEST_VARDIR/tmp/testdir;
remove_files_wildcard $MYSQLTEST_VARDIR/tmp/testdir;
list_files $MYSQLTEST_VARDIR/tmp/testdir;
rmdir $MYSQLTEST_VARDIR/tmp/testdir; rmdir $MYSQLTEST_VARDIR/tmp/testdir;
# #
......
...@@ -187,6 +187,7 @@ SELECT * FROM t1; ...@@ -187,6 +187,7 @@ SELECT * FROM t1;
--echo # Switch to connection con2 --echo # Switch to connection con2
connection con2; connection con2;
reap;
SELECT * FROM t1; SELECT * FROM t1;
connection default; connection default;
......
...@@ -416,8 +416,7 @@ else ...@@ -416,8 +416,7 @@ else
echo "Try 'mysqld --help' if you have problems with paths. Using --log" echo "Try 'mysqld --help' if you have problems with paths. Using --log"
echo "gives you a log in $ldata that may be helpful." echo "gives you a log in $ldata that may be helpful."
echo echo
echo "The latest information about MySQL is available on the web at" echo "Please consult the MySQL manual section"
echo "http://www.mysql.com/. Please consult the MySQL manual section"
echo "'Problems running mysql_install_db', and the manual section that" echo "'Problems running mysql_install_db', and the manual section that"
echo "describes problems on your OS. Another information source are the" echo "describes problems on your OS. Another information source are the"
echo "MySQL email archives available at http://lists.mysql.com/." echo "MySQL email archives available at http://lists.mysql.com/."
...@@ -476,9 +475,6 @@ then ...@@ -476,9 +475,6 @@ then
echo echo
echo "Please report any problems with the $scriptdir/mysqlbug script!" echo "Please report any problems with the $scriptdir/mysqlbug script!"
echo echo
echo "The latest information about MySQL is available at http://www.mysql.com/"
echo "Support MySQL by buying support/licenses from http://shop.mysql.com/"
echo
fi fi
exit 0 exit 0
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