1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge ramayana.hindu.god:/home/tsmith/m/bk/50

into  ramayana.hindu.god:/home/tsmith/m/bk/maint/50


sql/sql_show.cc:
  Auto merged
This commit is contained in:
unknown
2007-08-27 18:19:55 -06:00
16 changed files with 855 additions and 401 deletions

View File

@ -342,12 +342,6 @@ static my_bool get_full_path_to_executable(char* path)
/* /*
Look for the tool in the same directory as mysql_upgrade. Look for the tool in the same directory as mysql_upgrade.
When running in a not yet installed build the the program
will exist but it need to be invoked via it's libtool wrapper.
Check if the found tool can executed and if not look in the
directory one step higher up where the libtool wrapper normally
is found
*/ */
static void find_tool(char *tool_path, const char *tool_name) static void find_tool(char *tool_path, const char *tool_name)
@ -385,37 +379,52 @@ static void find_tool(char *tool_path, const char *tool_name)
path[0]= 0; path[0]= 0;
} }
} }
do
DBUG_PRINT("info", ("path: '%s'", path));
/* Chop off binary name (i.e mysql-upgrade) from path */
dirname_part(path, path);
/*
When running in a not yet installed build and using libtool,
the program(mysql_upgrade) will be in .libs/ and executed
through a libtool wrapper in order to use the dynamic libraries
from this build. The same must be done for the tools(mysql and
mysqlcheck). Thus if path ends in .libs/, step up one directory
and execute the tools from there
*/
path[max((strlen(path)-1), 0)]= 0; /* Chop off last / */
if (strncmp(path + dirname_length(path), ".libs", 5) == 0)
{ {
DBUG_PRINT("enter", ("path: %s", path)); DBUG_PRINT("info", ("Chopping off .libs from '%s'", path));
/* Chop off last char(since it might be a /) */ /* Chop off .libs */
path[max((strlen(path)-1), 0)]= 0;
/* Chop off last dir part */
dirname_part(path, path); dirname_part(path, path);
/* Format name of the tool to search for */
fn_format(tool_path, tool_name,
path, "", MYF(MY_REPLACE_DIR));
verbose("Looking for '%s' in: %s", tool_name, tool_path);
/* Make sure the tool exists */
if (my_access(tool_path, F_OK) != 0)
die("Can't find '%s'", tool_path);
/*
Make sure it can be executed, otherwise try again
in higher level directory
*/
} }
while(run_tool(tool_path,
&ds_tmp, /* Get output from command, discard*/
"--help", DBUG_PRINT("info", ("path: '%s'", path));
"2>&1",
IF_WIN("> NUL", "> /dev/null"), /* Format name of the tool to search for */
NULL)); fn_format(tool_path, tool_name,
path, "", MYF(MY_REPLACE_DIR));
verbose("Looking for '%s' in: %s", tool_name, tool_path);
/* Make sure the tool exists */
if (my_access(tool_path, F_OK) != 0)
die("Can't find '%s'", tool_path);
/*
Make sure it can be executed
*/
if (run_tool(tool_path,
&ds_tmp, /* Get output from command, discard*/
"--help",
"2>&1",
IF_WIN("> NUL", "> /dev/null"),
NULL))
die("Can't execute '%s'", tool_path);
dynstr_free(&ds_tmp); dynstr_free(&ds_tmp);
@ -446,6 +455,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
ret= run_tool(mysql_path, ret= run_tool(mysql_path,
ds_res, ds_res,
"--no-defaults",
ds_args.str, ds_args.str,
"--database=mysql", "--database=mysql",
"--batch", /* Turns off pager etc. */ "--batch", /* Turns off pager etc. */
@ -457,6 +467,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
NULL); NULL);
my_close(fd, MYF(0)); my_close(fd, MYF(0));
my_delete(query_file_path, MYF(0));
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }
@ -607,6 +618,7 @@ static int run_mysqlcheck_upgrade(void)
verbose("Running 'mysqlcheck'..."); verbose("Running 'mysqlcheck'...");
return run_tool(mysqlcheck_path, return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */ NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults",
ds_args.str, ds_args.str,
"--check-upgrade", "--check-upgrade",
"--all-databases", "--all-databases",

File diff suppressed because it is too large Load Diff

View File

@ -20,8 +20,6 @@
use strict; use strict;
sub mtr_full_hostname ();
sub mtr_short_hostname ();
sub mtr_native_path($); sub mtr_native_path($);
sub mtr_init_args ($); sub mtr_init_args ($);
sub mtr_add_arg ($$@); sub mtr_add_arg ($$@);
@ -40,30 +38,6 @@ sub mtr_cmp_opts($$);
# #
############################################################################## ##############################################################################
# We want the fully qualified host name and hostname() may have returned
# only the short name. So we use the resolver to find out.
# Note that this might fail on some platforms
sub mtr_full_hostname () {
my $hostname= hostname();
if ( $hostname !~ /\./ )
{
my $address= gethostbyname($hostname)
or mtr_error("Couldn't resolve $hostname : $!");
my $fullname= gethostbyaddr($address, AF_INET);
$hostname= $fullname if $fullname;
}
return $hostname;
}
sub mtr_short_hostname () {
my $hostname= hostname();
$hostname =~ s/\..+$//;
return $hostname;
}
# Convert path to OS native format # Convert path to OS native format
sub mtr_native_path($) sub mtr_native_path($)
{ {

View File

@ -99,25 +99,26 @@ sub spawn_impl ($$$$$$$) {
if ( $::opt_script_debug ) if ( $::opt_script_debug )
{ {
print STDERR "\n"; mtr_report("");
print STDERR "#### ", "-" x 78, "\n"; mtr_debug("-" x 73);
print STDERR "#### ", "STDIN $input\n" if $input; mtr_debug("STDIN $input") if $input;
print STDERR "#### ", "STDOUT $output\n" if $output; mtr_debug("STDOUT $output") if $output;
print STDERR "#### ", "STDERR $error\n" if $error; mtr_debug("STDERR $error") if $error;
print STDERR "#### ", "$mode : $path ", join(" ",@$arg_list_t), "\n"; mtr_debug("$mode: $path ", join(" ",@$arg_list_t));
print STDERR "#### ", "spawn options:\n"; mtr_debug("spawn options:");
if ($spawn_opts) if ($spawn_opts)
{ {
foreach my $key (sort keys %{$spawn_opts}) foreach my $key (sort keys %{$spawn_opts})
{ {
print STDERR "#### ", " - $key: $spawn_opts->{$key}\n"; mtr_debug(" - $key: $spawn_opts->{$key}");
} }
} }
else else
{ {
print STDERR "#### ", " none\n"; mtr_debug(" none");
} }
print STDERR "#### ", "-" x 78, "\n"; mtr_debug("-" x 73);
mtr_report("");
} }
mtr_error("Can't spawn with empty \"path\"") unless defined $path; mtr_error("Can't spawn with empty \"path\"") unless defined $path;

View File

@ -19,6 +19,7 @@
# same name. # same name.
use strict; use strict;
use warnings;
sub mtr_report_test_name($); sub mtr_report_test_name($);
sub mtr_report_test_passed($); sub mtr_report_test_passed($);
@ -26,7 +27,6 @@ sub mtr_report_test_failed($);
sub mtr_report_test_skipped($); sub mtr_report_test_skipped($);
sub mtr_report_test_not_skipped_though_disabled($); sub mtr_report_test_not_skipped_though_disabled($);
sub mtr_show_failed_diff ($);
sub mtr_report_stats ($); sub mtr_report_stats ($);
sub mtr_print_line (); sub mtr_print_line ();
sub mtr_print_thick_line (); sub mtr_print_thick_line ();
@ -38,6 +38,9 @@ sub mtr_child_error (@);
sub mtr_debug (@); sub mtr_debug (@);
sub mtr_verbose (@); sub mtr_verbose (@);
my $tot_real_time= 0;
############################################################################## ##############################################################################
# #
@ -45,58 +48,10 @@ sub mtr_verbose (@);
# #
############################################################################## ##############################################################################
# We can't use diff -u or diff -a as these are not portable
sub mtr_show_failed_diff ($) {
my $result_file_name= shift;
# The reject and log files have been dumped to
# to filenames based on the result_file's name
my $tname= basename($result_file_name);
$tname=~ s/\..*$//;
my $reject_file= "r/$tname.reject";
my $result_file= "r/$tname.result";
my $log_file= "r/$tname.log";
my $eval_file= "r/$tname.eval";
if ( $::opt_suite ne "main" )
{
$reject_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$reject_file";
$result_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$result_file";
$eval_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$eval_file";
$log_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$log_file";
}
if ( -f $eval_file )
{
$result_file= $eval_file;
}
my $diffopts= $::opt_udiff ? "-u" : "-c";
if ( -f $reject_file )
{
print "Below are the diffs between actual and expected results:\n";
print "-------------------------------------------------------\n";
# FIXME check result code?!
mtr_run("diff",[$diffopts,$result_file,$reject_file], "", "", "", "");
print "-------------------------------------------------------\n";
print "Please follow the instructions outlined at\n";
print "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html\n";
print "to find the reason to this problem and how to report this.\n\n";
}
if ( -f $log_file )
{
print "Result from queries before failure can be found in $log_file\n";
# FIXME Maybe a tail -f -n 10 $log_file here
}
}
sub mtr_report_test_name ($) { sub mtr_report_test_name ($) {
my $tinfo= shift; my $tinfo= shift;
_mtr_log("$tinfo->{name}");
printf "%-30s ", $tinfo->{'name'}; printf "%-30s ", $tinfo->{'name'};
} }
@ -106,15 +61,15 @@ sub mtr_report_test_skipped ($) {
$tinfo->{'result'}= 'MTR_RES_SKIPPED'; $tinfo->{'result'}= 'MTR_RES_SKIPPED';
if ( $tinfo->{'disable'} ) if ( $tinfo->{'disable'} )
{ {
print "[ disabled ] $tinfo->{'comment'}\n"; mtr_report("[ disabled ] $tinfo->{'comment'}");
} }
elsif ( $tinfo->{'comment'} ) elsif ( $tinfo->{'comment'} )
{ {
print "[ skipped ] $tinfo->{'comment'}\n"; mtr_report("[ skipped ] $tinfo->{'comment'}");
} }
else else
{ {
print "[ skipped ]\n"; mtr_report("[ skipped ]");
} }
} }
@ -142,11 +97,11 @@ sub mtr_report_test_passed ($) {
if ( $::opt_timer and -f "$::opt_vardir/log/timer" ) if ( $::opt_timer and -f "$::opt_vardir/log/timer" )
{ {
$timer= mtr_fromfile("$::opt_vardir/log/timer"); $timer= mtr_fromfile("$::opt_vardir/log/timer");
$::glob_tot_real_time += ($timer/1000); $tot_real_time += ($timer/1000);
$timer= sprintf "%12s", $timer; $timer= sprintf "%12s", $timer;
} }
$tinfo->{'result'}= 'MTR_RES_PASSED'; $tinfo->{'result'}= 'MTR_RES_PASSED';
print "[ pass ] $timer\n"; mtr_report("[ pass ] $timer");
} }
sub mtr_report_test_failed ($) { sub mtr_report_test_failed ($) {
@ -155,27 +110,34 @@ sub mtr_report_test_failed ($) {
$tinfo->{'result'}= 'MTR_RES_FAILED'; $tinfo->{'result'}= 'MTR_RES_FAILED';
if ( defined $tinfo->{'timeout'} ) if ( defined $tinfo->{'timeout'} )
{ {
print "[ fail ] timeout\n"; mtr_report("[ fail ] timeout");
return; return;
} }
else else
{ {
print "[ fail ]\n"; mtr_report("[ fail ]");
} }
if ( $tinfo->{'comment'} ) if ( $tinfo->{'comment'} )
{ {
print "\nERROR: $tinfo->{'comment'}\n"; # The test failure has been detected by mysql-test-run.pl
# when starting the servers or due to other error, the reason for
# failing the test is saved in "comment"
mtr_report("\nERROR: $tinfo->{'comment'}");
} }
elsif ( -f $::path_timefile ) elsif ( -f $::path_timefile )
{ {
print "\nErrors are (from $::path_timefile) :\n"; # Test failure was detected by test tool and it's report
# about what failed has been saved to file. Display the report.
print "\n";
print mtr_fromfile($::path_timefile); # FIXME print_file() instead print mtr_fromfile($::path_timefile); # FIXME print_file() instead
print "\n(the last lines may be the most important ones)\n"; print "\n";
} }
else else
{ {
print "\nUnexpected termination, probably when starting mysqld\n"; # Neither this script or the test tool has recorded info
# about why the test has failed. Should be debugged.
mtr_report("\nUnexpected termination, probably when starting mysqld");;
} }
} }
@ -243,8 +205,10 @@ sub mtr_report_stats ($) {
if ( $::opt_timer ) if ( $::opt_timer )
{ {
print use English;
"Spent $::glob_tot_real_time seconds actually executing testcases\n"
mtr_report("Spent", sprintf("%.3f", $tot_real_time),"of",
time - $BASETIME, "seconds executing testcases");
} }
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
@ -397,35 +361,66 @@ sub mtr_print_header () {
############################################################################## ##############################################################################
# #
# Misc # Log and reporting functions
# #
############################################################################## ##############################################################################
use IO::File;
my $log_file_ref= undef;
sub mtr_log_init ($) {
my ($filename)= @_;
mtr_error("Log is already open") if defined $log_file_ref;
$log_file_ref= IO::File->new($filename, "a") or
mtr_warning("Could not create logfile $filename: $!");
}
sub _mtr_log (@) {
print $log_file_ref join(" ", @_),"\n"
if defined $log_file_ref;
}
sub mtr_report (@) { sub mtr_report (@) {
# Print message to screen and log
_mtr_log(@_);
print join(" ", @_),"\n"; print join(" ", @_),"\n";
} }
sub mtr_warning (@) { sub mtr_warning (@) {
# Print message to screen and log
_mtr_log("WARNING: ", @_);
print STDERR "mysql-test-run: WARNING: ",join(" ", @_),"\n"; print STDERR "mysql-test-run: WARNING: ",join(" ", @_),"\n";
} }
sub mtr_error (@) { sub mtr_error (@) {
# Print message to screen and log
_mtr_log("ERROR: ", @_);
print STDERR "mysql-test-run: *** ERROR: ",join(" ", @_),"\n"; print STDERR "mysql-test-run: *** ERROR: ",join(" ", @_),"\n";
mtr_exit(1); mtr_exit(1);
} }
sub mtr_child_error (@) { sub mtr_child_error (@) {
# Print message to screen and log
_mtr_log("ERROR(child): ", @_);
print STDERR "mysql-test-run: *** ERROR(child): ",join(" ", @_),"\n"; print STDERR "mysql-test-run: *** ERROR(child): ",join(" ", @_),"\n";
exit(1); exit(1);
} }
sub mtr_debug (@) { sub mtr_debug (@) {
# Only print if --script-debug is used
if ( $::opt_script_debug ) if ( $::opt_script_debug )
{ {
_mtr_log("###: ", @_);
print STDERR "####: ",join(" ", @_),"\n"; print STDERR "####: ",join(" ", @_),"\n";
} }
} }
sub mtr_verbose (@) { sub mtr_verbose (@) {
# Always print to log, print to screen only when --verbose is used
_mtr_log("> ",@_);
if ( $::opt_verbose ) if ( $::opt_verbose )
{ {
print STDERR "> ",join(" ", @_),"\n"; print STDERR "> ",join(" ", @_),"\n";

View File

@ -18,7 +18,6 @@
# and is part of the translation of the Bourne shell script with the # and is part of the translation of the Bourne shell script with the
# same name. # same name.
use Socket;
use Errno; use Errno;
use strict; use strict;
@ -52,12 +51,10 @@ sub mtr_init_timers () {
sub mtr_timer_start($$$) { sub mtr_timer_start($$$) {
my ($timers,$name,$duration)= @_; my ($timers,$name,$duration)= @_;
mtr_verbose("mtr_timer_start: $name, $duration");
if ( exists $timers->{'timers'}->{$name} ) if ( exists $timers->{'timers'}->{$name} )
{ {
# We have an old running timer, kill it # We have an old running timer, kill it
mtr_verbose("There is an old timer running"); mtr_warning("There is an old timer running");
mtr_timer_stop($timers,$name); mtr_timer_stop($timers,$name);
} }
@ -75,22 +72,22 @@ sub mtr_timer_start($$$) {
} }
else else
{ {
mtr_error("can't fork"); mtr_error("can't fork timer, error: $!");
} }
} }
if ( $tpid ) if ( $tpid )
{ {
# Parent, record the information # Parent, record the information
mtr_verbose("timer parent, record info($name, $tpid, $duration)"); mtr_verbose("Starting timer for '$name',",
"duration: $duration, pid: $tpid");
$timers->{'timers'}->{$name}->{'pid'}= $tpid; $timers->{'timers'}->{$name}->{'pid'}= $tpid;
$timers->{'timers'}->{$name}->{'duration'}= $duration; $timers->{'timers'}->{$name}->{'duration'}= $duration;
$timers->{'pids'}->{$tpid}= $name; $timers->{'pids'}->{$tpid}= $name;
} }
else else
{ {
# Child, redirect output and exec # Child, install signal handlers and sleep for "duration"
# FIXME do we need to redirect streams?
# Don't do the ^C cleanup in the timeout child processes! # Don't do the ^C cleanup in the timeout child processes!
# There is actually a race here, if we get ^C after fork(), but before # There is actually a race here, if we get ^C after fork(), but before
@ -98,13 +95,13 @@ sub mtr_timer_start($$$) {
$SIG{INT}= 'DEFAULT'; $SIG{INT}= 'DEFAULT';
$SIG{TERM}= sub { $SIG{TERM}= sub {
mtr_verbose("timer woke up, exiting!"); mtr_verbose("timer $$ woke up, exiting!");
exit(0); exit(0);
}; };
$0= "mtr_timer(timers,$name,$duration)"; $0= "mtr_timer(timers,$name,$duration)";
sleep($duration); sleep($duration);
mtr_verbose("timer expired after $duration seconds"); mtr_verbose("timer $$ expired after $duration seconds");
exit(0); exit(0);
} }
} }
@ -114,12 +111,10 @@ sub mtr_timer_start($$$) {
sub mtr_timer_stop ($$) { sub mtr_timer_stop ($$) {
my ($timers,$name)= @_; my ($timers,$name)= @_;
mtr_verbose("mtr_timer_stop: $name");
if ( exists $timers->{'timers'}->{$name} ) if ( exists $timers->{'timers'}->{$name} )
{ {
my $tpid= $timers->{'timers'}->{$name}->{'pid'}; my $tpid= $timers->{'timers'}->{$name}->{'pid'};
mtr_verbose("Stopping timer with pid $tpid"); mtr_verbose("Stopping timer for '$name' with pid $tpid");
# FIXME as Cygwin reuses pids fast, maybe check that is # FIXME as Cygwin reuses pids fast, maybe check that is
# the expected process somehow?! # the expected process somehow?!
@ -134,11 +129,8 @@ sub mtr_timer_stop ($$) {
return 1; return 1;
} }
else
{ mtr_error("Asked to stop timer '$name' not started");
mtr_error("Asked to stop timer \"$name\" not started");
return 0;
}
} }
@ -158,7 +150,8 @@ sub mtr_timer_timeout ($$) {
return "" unless exists $timers->{'pids'}->{$pid}; return "" unless exists $timers->{'pids'}->{$pid};
# We got a timeout, return the name ot the timer # Got a timeout(the process with $pid is recorded as being a timer)
# return the name of the timer
return $timers->{'pids'}->{$pid}; return $timers->{'pids'}->{$pid};
} }

View File

@ -61,7 +61,6 @@ use File::Copy;
use File::Temp qw / tempdir /; use File::Temp qw / tempdir /;
use Cwd; use Cwd;
use Getopt::Long; use Getopt::Long;
use Sys::Hostname;
use IO::Socket; use IO::Socket;
use IO::Socket::INET; use IO::Socket::INET;
use strict; use strict;
@ -83,7 +82,6 @@ require "lib/mtr_io.pl";
require "lib/mtr_gcov.pl"; require "lib/mtr_gcov.pl";
require "lib/mtr_gprof.pl"; require "lib/mtr_gprof.pl";
require "lib/mtr_report.pl"; require "lib/mtr_report.pl";
require "lib/mtr_diff.pl";
require "lib/mtr_match.pl"; require "lib/mtr_match.pl";
require "lib/mtr_misc.pl"; require "lib/mtr_misc.pl";
require "lib/mtr_stress.pl"; require "lib/mtr_stress.pl";
@ -101,7 +99,6 @@ $Devel::Trace::TRACE= 1;
our $mysql_version_id; our $mysql_version_id;
our $glob_mysql_test_dir= undef; our $glob_mysql_test_dir= undef;
our $glob_mysql_bench_dir= undef; our $glob_mysql_bench_dir= undef;
our $glob_hostname= undef;
our $glob_scriptname= undef; our $glob_scriptname= undef;
our $glob_timers= undef; our $glob_timers= undef;
our $glob_use_running_ndbcluster= 0; our $glob_use_running_ndbcluster= 0;
@ -234,7 +231,6 @@ my $opt_report_features;
our $opt_check_testcases; our $opt_check_testcases;
our $opt_mark_progress; our $opt_mark_progress;
our $opt_skip;
our $opt_skip_rpl; our $opt_skip_rpl;
our $max_slave_num= 0; our $max_slave_num= 0;
our $max_master_num= 1; our $max_master_num= 1;
@ -277,13 +273,8 @@ our $opt_stress_test_duration= 0;
our $opt_stress_init_file= ""; our $opt_stress_init_file= "";
our $opt_stress_test_file= ""; our $opt_stress_test_file= "";
our $opt_wait_for_master;
our $opt_wait_for_slave;
our $opt_warnings; our $opt_warnings;
our $opt_udiff;
our $opt_skip_ndbcluster= 0; our $opt_skip_ndbcluster= 0;
our $opt_skip_ndbcluster_slave= 0; our $opt_skip_ndbcluster_slave= 0;
our $opt_with_ndbcluster= 0; our $opt_with_ndbcluster= 0;
@ -307,7 +298,6 @@ our @data_dir_lst;
our $used_binlog_format; our $used_binlog_format;
our $used_default_engine; our $used_default_engine;
our $debug_compiled_binaries; our $debug_compiled_binaries;
our $glob_tot_real_time= 0;
our %mysqld_variables; our %mysqld_variables;
@ -620,7 +610,6 @@ sub command_line_setup () {
'start-dirty' => \$opt_start_dirty, 'start-dirty' => \$opt_start_dirty,
'start-and-exit' => \$opt_start_and_exit, 'start-and-exit' => \$opt_start_and_exit,
'timer!' => \$opt_timer, 'timer!' => \$opt_timer,
'unified-diff|udiff' => \$opt_udiff,
'user=s' => \$opt_user, 'user=s' => \$opt_user,
'testcase-timeout=i' => \$opt_testcase_timeout, 'testcase-timeout=i' => \$opt_testcase_timeout,
'suite-timeout=i' => \$opt_suite_timeout, 'suite-timeout=i' => \$opt_suite_timeout,
@ -656,8 +645,6 @@ sub command_line_setup () {
$source_dist= 1; $source_dist= 1;
} }
$glob_hostname= mtr_short_hostname();
# Find the absolute path to the test directory # Find the absolute path to the test directory
$glob_mysql_test_dir= cwd(); $glob_mysql_test_dir= cwd();
if ( $glob_cygwin_perl ) if ( $glob_cygwin_perl )
@ -2905,13 +2892,16 @@ sub initialize_servers () {
} }
} }
check_running_as_root(); check_running_as_root();
mtr_log_init("$opt_vardir/log/mysql-test-run.log");
} }
sub mysql_install_db () { sub mysql_install_db () {
install_db('master', $master->[0]->{'path_myddir'}); install_db('master', $master->[0]->{'path_myddir'});
if ($max_master_num) if ($max_master_num > 1)
{ {
copy_install_db('master', $master->[1]->{'path_myddir'}); copy_install_db('master', $master->[1]->{'path_myddir'});
} }
@ -3069,11 +3059,15 @@ sub install_db ($$) {
mtr_appendfile_to_file("$path_sql_dir/fill_help_tables.sql", mtr_appendfile_to_file("$path_sql_dir/fill_help_tables.sql",
$bootstrap_sql_file); $bootstrap_sql_file);
mtr_tofile($bootstrap_sql_file,
"DELETE FROM mysql.user where user= '';");
# Log bootstrap command # Log bootstrap command
my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log"; my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log";
mtr_tofile($path_bootstrap_log, mtr_tofile($path_bootstrap_log,
"$exe_mysqld_bootstrap " . join(" ", @$args) . "\n"); "$exe_mysqld_bootstrap " . join(" ", @$args) . "\n");
if ( mtr_run($exe_mysqld_bootstrap, $args, $bootstrap_sql_file, if ( mtr_run($exe_mysqld_bootstrap, $args, $bootstrap_sql_file,
$path_bootstrap_log, $path_bootstrap_log, $path_bootstrap_log, $path_bootstrap_log,
"", { append_log_file => 1 }) != 0 ) "", { append_log_file => 1 }) != 0 )
@ -3617,7 +3611,6 @@ sub report_failure_and_restart ($) {
my $tinfo= shift; my $tinfo= shift;
mtr_report_test_failed($tinfo); mtr_report_test_failed($tinfo);
mtr_show_failed_diff($tinfo->{'result_file'});
print "\n"; print "\n";
if ( $opt_force ) if ( $opt_force )
{ {
@ -3626,13 +3619,13 @@ sub report_failure_and_restart ($) {
# Restore the snapshot of the installed test db # Restore the snapshot of the installed test db
restore_installed_db($tinfo->{'name'}); restore_installed_db($tinfo->{'name'});
print "Resuming Tests\n\n"; mtr_report("Resuming Tests\n");
return; return;
} }
my $test_mode= join(" ", @::glob_test_mode) || "default"; my $test_mode= join(" ", @::glob_test_mode) || "default";
print "Aborting: $tinfo->{'name'} failed in $test_mode mode. "; mtr_report("Aborting: $tinfo->{'name'} failed in $test_mode mode. ");
print "To continue, re-run with '--force'.\n"; mtr_report("To continue, re-run with '--force'.");
if ( ! $glob_debugger and if ( ! $glob_debugger and
! $opt_extern and ! $opt_extern and
! $glob_use_embedded_server ) ! $glob_use_embedded_server )
@ -4090,11 +4083,11 @@ sub mysqld_start ($$$) {
sub stop_all_servers () { sub stop_all_servers () {
print "Stopping All Servers\n"; mtr_report("Stopping All Servers");
if ( ! $opt_skip_im ) if ( ! $opt_skip_im )
{ {
print "Shutting-down Instance Manager\n"; mtr_report("Shutting-down Instance Manager");
unless (mtr_im_stop($instance_manager, "stop_all_servers")) unless (mtr_im_stop($instance_manager, "stop_all_servers"))
{ {
mtr_error("Failed to stop Instance Manager.") mtr_error("Failed to stop Instance Manager.")
@ -4680,6 +4673,7 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--skip-safemalloc"); mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir); mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
mtr_add_arg($args, "--logdir=%s/log", $opt_vardir);
# Log line number and time for each line in .test file # Log line number and time for each line in .test file
mtr_add_arg($args, "--mark-progress") mtr_add_arg($args, "--mark-progress")
@ -4802,6 +4796,9 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--test-file=%s", $tinfo->{'path'}); mtr_add_arg($args, "--test-file=%s", $tinfo->{'path'});
# Number of lines of resut to include in failure report
mtr_add_arg($args, "--tail-lines=20");
if ( defined $tinfo->{'result_file'} ) { if ( defined $tinfo->{'result_file'} ) {
mtr_add_arg($args, "--result-file=%s", $tinfo->{'result_file'}); mtr_add_arg($args, "--result-file=%s", $tinfo->{'result_file'});
} }
@ -5213,7 +5210,6 @@ Misc options
fast Don't try to clean up from earlier runs fast Don't try to clean up from earlier runs
reorder Reorder tests to get fewer server restarts reorder Reorder tests to get fewer server restarts
help Get this help text help Get this help text
unified-diff | udiff When presenting differences, use unified diff
testcase-timeout=MINUTES Max test case run time (default $default_testcase_timeout) testcase-timeout=MINUTES Max test case run time (default $default_testcase_timeout)
suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout) suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout)

View File

@ -280,8 +280,20 @@ let $B = changed value of B;
var2: content of variable 1 var2: content of variable 1
var3: content of variable 1 content of variable 1 var3: content of variable 1 content of variable 1
length of var3 is longer than 0 length of var3 is longer than 0
var1
hi 1 hi there
var2
2
var2 again
2
var3 two columns with same name
1 2 3
var4 from query that returns NULL
var5 from query that returns no row
failing query in let
mysqltest: At line 1: Error running query 'failing query': 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing query' at line 1
mysqltest: At line 1: Missing required argument 'filename' to command 'source' mysqltest: At line 1: Missing required argument 'filename' to command 'source'
mysqltest: At line 1: Could not open file ./non_existingFile mysqltest: At line 1: Could not open file './non_existingFile'
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 mysqltest: In included file "MYSQLTEST_VARDIR/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
@ -340,6 +352,8 @@ here is the sourced script
In loop In loop
here is the sourced script here is the sourced script
here is the sourced script here is the sourced script
"hello"
"hello"
mysqltest: At line 1: Missing argument to sleep mysqltest: At line 1: Missing argument to sleep
mysqltest: At line 1: Missing argument to real_sleep mysqltest: At line 1: Missing argument to real_sleep
mysqltest: At line 1: Invalid argument to sleep "abc" mysqltest: At line 1: Invalid argument to sleep "abc"
@ -461,7 +475,6 @@ root@localhost
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
this will be executed this will be executed
this will be executed this will be executed
mysqltest: Result length mismatch
mysqltest: The test didn't produce any output mysqltest: The test didn't produce any output
Failing multi statement query Failing multi statement query
mysqltest: At line 3: query 'create table t1 (a int primary key); mysqltest: At line 3: query 'create table t1 (a int primary key);
@ -473,6 +486,8 @@ mysqltest: At line 3: query 'create table t1 (a int primary key);
insert into t1 values (1); insert into t1 values (1);
select 'select-me'; select 'select-me';
insertz 'error query'' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insertz 'error query'' at line 1 insertz 'error query'' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insertz 'error query'' at line 1
More results from queries before failure can be found in MYSQLTEST_VARDIR/log/bug11731.log
drop table t1; drop table t1;
Multi statement using expected error Multi statement using expected error
create table t1 (a int primary key); create table t1 (a int primary key);
@ -520,17 +535,19 @@ 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 '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
mysqltest: At line 1: File already exist: 'MYSQLTEST_VARDIR/tmp/test_file1.tmp'
Some data Some data
for cat_file command for cat_file command
of mysqltest of mysqltest
mysqltest: At line 1: Failed to open file non_existing_file 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 '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 '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 'to_file' to command 'copy_file'
mysqltest: At line 1: Missing required argument 'mode' to command 'chmod' 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
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
mysqltest: At line 1: Missing required argument 'file' to command 'chmod' mysqltest: At line 1: Missing required argument 'filename' 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
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
hello hello

View File

@ -5748,6 +5748,7 @@ bug23760_rc_test(ROW_COUNT())
DROP TABLE bug23760, bug23760_log| DROP TABLE bug23760, bug23760_log|
DROP PROCEDURE bug23760_update_log| DROP PROCEDURE bug23760_update_log|
DROP PROCEDURE bug23760_test_row_count| DROP PROCEDURE bug23760_test_row_count|
DROP PROCEDURE bug23760_test_row_count2|
DROP FUNCTION bug23760_rc_test| DROP FUNCTION bug23760_rc_test|
DROP PROCEDURE IF EXISTS bug24117| DROP PROCEDURE IF EXISTS bug24117|
DROP TABLE IF EXISTS t3| DROP TABLE IF EXISTS t3|

View File

@ -9,12 +9,13 @@ drop table if exists t1;
# #
# Check that --bootstrap reads from stdin # Check that --bootstrap reads from stdin
# #
--write_file $MYSQLTEST_VARDIR/tmp/bootstrap.sql --write_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql
use test; use test;
CREATE TABLE t1(a int); CREATE TABLE t1(a int);
EOF EOF
--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/bootstrap.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 --exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
drop table t1; drop table t1;
remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql;
# #
# Check that --bootstrap of file with SQL error returns error # Check that --bootstrap of file with SQL error returns error
@ -28,6 +29,7 @@ EOF
# Table t1 should not exists # Table t1 should not exists
--error 1051 --error 1051
drop table t1; drop table t1;
remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql;
# #
# Bootstrap with a query larger than 2*thd->net.max_packet # Bootstrap with a query larger than 2*thd->net.max_packet
@ -40,6 +42,7 @@ eval select * into outfile '$MYSQLTEST_VARDIR/tmp/long_query.sql' from t1;
--enable_query_log --enable_query_log
--error 1 --error 1
--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/long_query.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 --exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/long_query.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/long_query.sql;
set global max_allowed_packet=@my_max_allowed_packet; set global max_allowed_packet=@my_max_allowed_packet;
drop table t1; drop table t1;

View File

@ -241,18 +241,21 @@ DELIMITER /
SELECT 1/ SELECT 1/
EOF EOF
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1 --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
# This should give an error... # This should give an error...
--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql --write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
DELIMITER \ DELIMITER \
EOF EOF
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1 --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
# As should this... # As should this...
--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql --write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
DELIMITER \\ DELIMITER \\
EOF EOF
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1 --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
# #
# Some coverage of not normally used parts # Some coverage of not normally used parts

View File

@ -20,7 +20,7 @@ EOF
--replace_regex /.*mysqladmin.*: unknown/mysqladmin: unknown/ --replace_regex /.*mysqladmin.*: unknown/mysqladmin: unknown/
--error 7 --error 7
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1 --exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf;
# When mysqladmin finds "loose-database" in .cnf file it shall print # When mysqladmin finds "loose-database" in .cnf file it shall print
# a warning and continue # a warning and continue
@ -32,3 +32,4 @@ EOF
--replace_regex /Warning: .*mysqladmin.*: unknown/Warning: mysqladmin: unknown/ --replace_regex /Warning: .*mysqladmin.*: unknown/Warning: mysqladmin: unknown/
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1 --exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf;

View File

@ -366,6 +366,7 @@ show status;
EOF EOF
--error 1 --error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# #
# Missing delimiter until eof # Missing delimiter until eof
@ -377,6 +378,7 @@ sleep 7
EOF EOF
--error 1 --error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# #
# Missing delimiter until "disable_query_log" # Missing delimiter until "disable_query_log"
@ -391,6 +393,7 @@ disable_query_log;
EOF EOF
--error 1 --error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# #
# Missing delimiter until "disable_query_log" # Missing delimiter until "disable_query_log"
@ -406,6 +409,7 @@ disable_query_log;
EOF EOF
--error 1 --error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# #
# Missing delimiter until eof # Missing delimiter until eof
@ -422,6 +426,7 @@ disconnect default
EOF EOF
--error 1 --error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# #
# Missing delimiter until eof # Missing delimiter until eof
@ -436,6 +441,8 @@ EOF
--error 1 --error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# #
# Extra delimiter # Extra delimiter
# #
@ -734,38 +741,40 @@ if (`select length("$var3") > 0`)
# Test to assign let from query # Test to assign let from query
# let $<var_name>=`<query>`; # let $<var_name>=`<query>`;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
--disable_parsing
echo var1; echo var1;
let $var1= `select "hi" as "Col", 1 as "Column1", "hi there" as Col3`; let $var1= `select "hi" as "Col", 1 as "Column1", "hi there" as Col3`;
echo $var1; echo $var1;
echo $var1_Col;
echo $var1_Column1;
echo $var1_Col3;
echo var2; echo var2;
let $var2= `select 2 as "Column num 2"`; let $var2= `select 2 as "Column num 2"`;
echo $var2; echo $var2;
echo $var2_Column num 2;
echo $var2_Column;
echo var2 again; echo var2 again;
let $var2= `select 2 as "Column num 2"`; let $var2= `select 2 as "Column num 2"`;
echo $var2; echo $var2;
echo $var2_Column num 2;
echo $var2_Column_num_2;
echo $var2_Column;
echo var3 two columns with same name; echo var3 two columns with same name;
let $var3= `select 1 as "Col", 2 as "Col", 3 as "var3"`; let $var3= `select 1 as "Col", 2 as "Col", 3 as "var3"`;
echo $var3; echo $var3;
echo $var3_Col;
echo $var3_Col;
echo $var3_var3;
#echo failing query in let; echo var4 from query that returns NULL;
#--error 1 let $var4= `select NULL`;
#--exec echo "let $var2= `failing query;`" | $MYSQL_TEST 2>&1
--enable_parsing echo var5 from query that returns no row;
let $var5= `SHOW VARIABLES LIKE "nonexisting_variable"`;
echo failing query in let;
--write_file $MYSQLTEST_VARDIR/tmp/let.sql
let $var2= `failing query`;
echo $var2;
EOF
--error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/let.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/let.sql;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Test source command # Test source command
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@ -786,6 +795,7 @@ echo $var3_var3;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1 --error 1
--exec echo "source $MYSQLTEST_VARDIR/tmp/recursive.sql;" | $MYSQL_TEST 2>&1 --exec echo "source $MYSQLTEST_VARDIR/tmp/recursive.sql;" | $MYSQL_TEST 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/recursive.sql;
# Source a file with error # Source a file with error
--exec echo "garbage ;" > $MYSQLTEST_VARDIR/tmp/error.sql --exec echo "garbage ;" > $MYSQLTEST_VARDIR/tmp/error.sql
@ -793,6 +803,7 @@ echo $var3_var3;
--error 1 --error 1
--exec echo "source $MYSQLTEST_VARDIR/tmp/error.sql;" | $MYSQL_TEST 2>&1 --exec echo "source $MYSQLTEST_VARDIR/tmp/error.sql;" | $MYSQL_TEST 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/error.sql;
# Test execution of source in a while loop # Test execution of source in a while loop
--write_file $MYSQLTEST_VARDIR/tmp/sourced.inc --write_file $MYSQLTEST_VARDIR/tmp/sourced.inc
@ -843,6 +854,19 @@ while ($num)
--remove_file $MYSQLTEST_VARDIR/tmp/sourced.inc --remove_file $MYSQLTEST_VARDIR/tmp/sourced.inc
--write_file $MYSQLTEST_VARDIR/tmp/sourced.inc
echo "hello";
EOF
let $x= sourced;
source $MYSQLTEST_VARDIR/tmp/$x.inc;
let $x= $MYSQLTEST_VARDIR;
source $x/tmp/sourced.inc;
--remove_file $MYSQLTEST_VARDIR/tmp/sourced.inc
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Test sleep command # Test sleep command
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@ -963,7 +987,7 @@ if (!$counter)
echo Counter is not 0, (counter=10); echo Counter is not 0, (counter=10);
} }
let $counter=0; let $counter=0;
if ($counter) if($counter)
{ {
echo Counter is greater than 0, (counter=0); echo Counter is greater than 0, (counter=0);
} }
@ -1156,6 +1180,7 @@ echo hej;
EOF EOF
--error 1 --error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
while (0) while (0)
@ -1163,6 +1188,7 @@ while (0)
EOF EOF
--error 1 --error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
while (0){ while (0){
@ -1171,6 +1197,8 @@ EOF
--error 1 --error 1
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Test error messages returned from comments starting with a command # Test error messages returned from comments starting with a command
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@ -1262,6 +1290,7 @@ while ($i)
} }
EOF EOF
--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK;" | $MYSQL_TEST 2>&1 --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK;" | $MYSQL_TEST 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# Repeat connect/disconnect # Repeat connect/disconnect
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
@ -1276,6 +1305,7 @@ EOF
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1 --error 1
--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1 --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# Select disconnected connection # Select disconnected connection
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
@ -1286,6 +1316,7 @@ EOF
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1 --error 1
--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1 --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# Connection name already used # Connection name already used
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
@ -1296,6 +1327,8 @@ EOF
--error 1 --error 1
--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1 --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# connect when "disable_abort_on_error" caused "connection not found" # connect when "disable_abort_on_error" caused "connection not found"
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--disable_abort_on_error --disable_abort_on_error
@ -1399,7 +1432,11 @@ select "this will be executed";
--exec touch $MYSQLTEST_VARDIR/tmp/zero_length_file.result --exec touch $MYSQLTEST_VARDIR/tmp/zero_length_file.result
--exec echo "echo ok;" > $MYSQLTEST_VARDIR/tmp/query.sql --exec echo "echo ok;" > $MYSQLTEST_VARDIR/tmp/query.sql
--error 1 --error 1
--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql -R $MYSQLTEST_VARDIR/tmp/zero_length_file.result 2>&1 --exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql -R $MYSQLTEST_VARDIR/tmp/zero_length_file.result > /dev/null 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.result;
remove_file $MYSQLTEST_VARDIR/log/zero_length_file.reject;
# #
# Test that a test file that does not generate any output fails. # Test that a test file that does not generate any output fails.
# #
@ -1407,6 +1444,8 @@ select "this will be executed";
--error 1 --error 1
--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql 2>&1 --exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/query.sql;
# #
# Test that mysqltest fails when there are no queries executed # Test that mysqltest fails when there are no queries executed
# but a result file exists # but a result file exists
@ -1436,6 +1475,7 @@ echo Failing multi statement query;
--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/bug11731.sql 2>&1 --exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/bug11731.sql 2>&1
drop table t1; drop table t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1 --error 1
--exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1 --exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
# The .out file should be non existent # The .out file should be non existent
@ -1462,6 +1502,9 @@ drop table t1;
# The .out file should exist # The .out file should exist
--exec test -s $MYSQLTEST_VARDIR/tmp/bug11731.out --exec test -s $MYSQLTEST_VARDIR/tmp/bug11731.out
drop table t1; drop table t1;
remove_file $MYSQLTEST_VARDIR/tmp/bug11731.out;
remove_file $MYSQLTEST_VARDIR/log/bug11731.log;
remove_file $MYSQLTEST_VARDIR/tmp/bug11731.sql;
# #
# Bug#19890 mysqltest: "query" command is broken # Bug#19890 mysqltest: "query" command is broken
@ -1544,12 +1587,19 @@ write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
Content for test_file1 Content for test_file1
EOF EOF
file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp; file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
cat_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp; remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp END_DELIMITER; write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp END_DELIMITER;
Content for test_file1 contains EOF Content for test_file1 contains EOF
END_DELIMITER END_DELIMITER
file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp; file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
# write to already exisiting file
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1
--exec echo "write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;" | $MYSQL_TEST 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp; remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@ -1571,6 +1621,8 @@ append_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
Appended text on nonexisting file Appended text on nonexisting file
EOF EOF
remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# test for cat_file # test for cat_file
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@ -1581,6 +1633,7 @@ for cat_file command
of mysqltest of mysqltest
EOF EOF
cat_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp; cat_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
--error 1 --error 1
--exec echo "cat_file non_existing_file;" | $MYSQL_TEST 2>&1 --exec echo "cat_file non_existing_file;" | $MYSQL_TEST 2>&1
@ -1607,19 +1660,48 @@ for diff_file command
of mysqltest of mysqltest
EOF EOF
--write_file $MYSQLTEST_VARDIR/tmp/diff4.tmp
Some data
for diff_file command
of musqltest
EOF
# Compare equal files # Compare equal files
--diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp --diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp
--diff_files $MYSQLTEST_VARDIR/tmp/diff2.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp --diff_files $MYSQLTEST_VARDIR/tmp/diff2.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp
# Compare files that differ # Write the below commands to a intermediary file and execute them with
--error 1 # mysqltest in --exec, since the output will vary depending on what "diff"
--diff_files $MYSQLTEST_VARDIR/tmp/diff3.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp # is available it is sent to /dev/null
--error 1 --write_file $MYSQLTEST_VARDIR/tmp/diff.test
# Compare files that differ in size
--error 2
--diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff3.tmp --diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff3.tmp
--error 2
--diff_files $MYSQLTEST_VARDIR/tmp/diff3.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp
# Compare files that differ only in content
--error 1
--diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff4.tmp
--error 1
--diff_files $MYSQLTEST_VARDIR/tmp/diff4.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp
EOF
# Execute the above diffs, and send their output to /dev/null - only
# interesting to see that it returns correct error codes
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/diff.test > /dev/null 2>&1
# Compare equal files, again... # Compare equal files, again...
--diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp --diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp
--remove_file $MYSQLTEST_VARDIR/tmp/diff1.tmp
--remove_file $MYSQLTEST_VARDIR/tmp/diff2.tmp
--remove_file $MYSQLTEST_VARDIR/tmp/diff3.tmp
--remove_file $MYSQLTEST_VARDIR/tmp/diff4.tmp
--remove_file $MYSQLTEST_VARDIR/tmp/diff.test
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# test for file_exist # test for file_exist
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@ -1672,6 +1754,7 @@ chmod 0000 $MYSQLTEST_VARDIR/tmp/file1.tmp;
#EOF #EOF
chmod 0777 $MYSQLTEST_VARDIR/tmp/file1.tmp; chmod 0777 $MYSQLTEST_VARDIR/tmp/file1.tmp;
remove_file $MYSQLTEST_VARDIR/tmp/file1.tmp;
--write_file $MYSQLTEST_VARDIR/tmp/file1.tmp --write_file $MYSQLTEST_VARDIR/tmp/file1.tmp
test2 test2
EOF EOF

View File

@ -42,6 +42,7 @@ insert into t1 values (0);
flush table mysql.proc; flush table mysql.proc;
# Thrashing the .frm file # Thrashing the .frm file
--remove_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
--write_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm --write_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
saljdfa saljdfa
EOF EOF

View File

@ -6715,6 +6715,7 @@ SELECT bug23760_rc_test(ROW_COUNT())|
DROP TABLE bug23760, bug23760_log| DROP TABLE bug23760, bug23760_log|
DROP PROCEDURE bug23760_update_log| DROP PROCEDURE bug23760_update_log|
DROP PROCEDURE bug23760_test_row_count| DROP PROCEDURE bug23760_test_row_count|
DROP PROCEDURE bug23760_test_row_count2|
DROP FUNCTION bug23760_rc_test| DROP FUNCTION bug23760_rc_test|
# #

View File

@ -1739,12 +1739,13 @@ static bool show_status_array(THD *thd, const char *wild,
if (thd->net.vio->ssl_arg) if (thd->net.vio->ssl_arg)
{ {
char *to= buff; char *to= buff;
for (int i=0 ; i++ ;) char *buff_end= buff + sizeof(buff);
for (int i= 0; to < buff_end; i++)
{ {
const char *p= SSL_get_cipher_list((SSL*) thd->net.vio->ssl_arg,i); const char *p= SSL_get_cipher_list((SSL*) thd->net.vio->ssl_arg,i);
if (p == NULL) if (p == NULL)
break; break;
to= strmov(to, p); to= strnmov(to, p, buff_end-to-1);
*to++= ':'; *to++= ':';
} }
if (to != buff) if (to != buff)