Commit df3415f0 authored by kent@mysql.com's avatar kent@mysql.com

mysql-test-run.pl:

  Corrected user name passing
  Honor the --master-binary and --slave-binary options
  Insert the host name into 'user' table
  Added --udiff option, to get unified diff output
  Call special mtr_run_test() for running "mysqltest"
mtr_report.pl:
  Added --udiff option, to get unified diff output
init_db.sql:
  Insert the host name into 'user' table
parent 9a1e2570
This diff is collapsed.
......@@ -50,12 +50,14 @@ sub mtr_show_failed_diff ($) {
$result_file= "$result_file$::opt_result_ext";
}
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",["-c",$result_file,$reject_file], "", "", "", "");
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";
......
......@@ -156,13 +156,13 @@ our @mysqld_src_dirs=
our $glob_win32= 0; # OS and native Win32 executables
our $glob_win32_perl= 0; # ActiveState Win32 Perl
our $glob_cygwin_perl= 0; # Cygwin Perl
our $glob_cygwin_shell= undef;
our $glob_mysql_test_dir= undef;
our $glob_mysql_bench_dir= undef;
our $glob_hostname= undef;
our $glob_scriptname= undef;
our $glob_use_running_server= 0;
our $glob_use_running_ndbcluster= 0;
our $glob_user= 'test';
our $glob_use_embedded_server= 0;
our $glob_basedir;
......@@ -281,6 +281,8 @@ our $opt_wait_timeout= 10;
our $opt_warnings;
our $opt_udiff;
our $opt_with_ndbcluster;
our $opt_with_openssl;
......@@ -422,7 +424,9 @@ sub initial_setup () {
{
# Windows programs like 'mysqld' needs Windows paths
$glob_mysql_test_dir= `cygpath -m $glob_mysql_test_dir`;
$glob_cygwin_shell= `cygpath -w $ENV{'SHELL'}`; # The Windows path c:\...
chomp($glob_mysql_test_dir);
chomp($glob_cygwin_shell);
}
$glob_basedir= dirname($glob_mysql_test_dir);
$glob_mysql_bench_dir= "$glob_basedir/mysql-bench"; # FIXME make configurable
......@@ -524,6 +528,7 @@ sub command_line_setup () {
'start-from=s' => \$opt_start_from,
'timer' => \$opt_timer,
'tmpdir=s' => \$opt_tmpdir,
'unified-diff|udiff' => \$opt_udiff,
'user-test=s' => \$opt_user_test,
'user=s' => \$opt_user,
'verbose' => \$opt_verbose,
......@@ -706,17 +711,16 @@ sub command_line_setup () {
# }
#}
if ( $opt_user )
if ( ! $opt_user )
{
$glob_user= $opt_user;
}
elsif ( $glob_use_running_server )
if ( $glob_use_running_server )
{
$glob_user= "test";
$opt_user= "test";
}
else
{
$glob_user= "root"; # We want to do FLUSH xxx commands
$opt_user= "root"; # We want to do FLUSH xxx commands
}
}
}
......@@ -828,7 +832,7 @@ sub executable_setup () {
}
else
{
error("Cannot find embedded server 'mysqltest_embedded'");
mtr_error("Cannot find embedded server 'mysqltest_embedded'");
}
if ( -d "$path_tests_bindir/mysql_client_test_embedded" )
{
......@@ -848,9 +852,6 @@ sub executable_setup () {
}
}
# FIXME special $exe_master_mysqld and $exe_slave_mysqld
# are not used that much....
if ( ! $exe_master_mysqld )
{
$exe_master_mysqld= $exe_mysqld;
......@@ -1048,7 +1049,7 @@ sub run_benchmarks ($) {
mtr_init_args(\$args);
mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_mysock'});
mtr_add_arg($args, "--user=root");
mtr_add_arg($args, "--user=%s", $opt_user);
if ( $opt_small_bench )
{
......@@ -1170,11 +1171,36 @@ sub install_db ($$) {
my $type= shift;
my $data_dir= shift;
my $init_db_sql= "lib/init_db.sql"; # FIXME this is too simple maybe
my $init_db_sql= "lib/init_db.sql";
my $init_db_sql_tmp= "/tmp/init_db.sql$$";
my $args;
mtr_report("Installing \u$type Databases");
open(IN, $init_db_sql)
or error("Can't open $init_db_sql: $!");
open(OUT, ">", $init_db_sql_tmp)
or error("Can't write to $init_db_sql_tmp: $!");
while (<IN>)
{
chomp;
s/\@HOSTNAME\@/$glob_hostname/;
if ( /^\s*$/ )
{
print OUT "\n";
}
elsif (/;$/)
{
print OUT "$_\n";
}
else
{
print OUT $_;
}
}
close OUT;
close IN;
mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults");
......@@ -1192,12 +1218,14 @@ sub install_db ($$) {
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
}
if ( mtr_run($exe_mysqld, $args, $init_db_sql,
if ( mtr_run($exe_mysqld, $args, $init_db_sql_tmp,
$path_manager_log, $path_manager_log, "") != 0 )
{
unlink($init_db_sql_tmp);
mtr_error("Error executing mysqld --bootstrap\n" .
"Could not install $type test DBs");
}
unlink($init_db_sql_tmp);
}
......@@ -1434,8 +1462,8 @@ sub do_before_start_master ($$) {
$tname ne "rpl_crash_binlog_ib_3b")
{
# FIXME we really want separate dir for binlogs
`rm -fr $glob_mysql_test_dir/var/log/master-bin.*`;
# unlink("$glob_mysql_test_dir/var/log/master-bin.*");
`rm -f $glob_mysql_test_dir/var/log/master-bin*`;
# unlink("$glob_mysql_test_dir/var/log/master-bin*");
}
# Remove old master.info and relay-log.info files
......@@ -1444,8 +1472,7 @@ sub do_before_start_master ($$) {
unlink("$glob_mysql_test_dir/var/master1-data/master.info");
unlink("$glob_mysql_test_dir/var/master1-data/relay-log.info");
#run master initialization shell script if one exists
# Run master initialization shell script if one exists
if ( $master_init_script and
mtr_run($master_init_script, [], "", "", "", "") != 0 )
{
......@@ -1459,9 +1486,6 @@ sub do_before_start_slave ($$) {
my $tname= shift;
my $slave_init_script= shift;
# When testing fail-safe replication, we will have more than one slave
# in this case, we start secondary slaves with an argument
# Remove stale binary logs and old master.info files
# except for too tests which need them
if ( $tname ne "rpl_crash_binlog_ib_1b" and
......@@ -1476,14 +1500,15 @@ sub do_before_start_slave ($$) {
unlink("$glob_mysql_test_dir/var/slave-data/relay-log.info");
}
#run slave initialization shell script if one exists
# Run slave initialization shell script if one exists
if ( $slave_init_script and
mtr_run($slave_init_script, [], "", "", "", "") != 0 )
{
mtr_error("Can't run $slave_init_script");
}
unlink("$glob_mysql_test_dir/var/slave-data/log.*");
`rm -f $glob_mysql_test_dir/var/slave-data/log.*`;
# unlink("$glob_mysql_test_dir/var/slave-data/log.*");
}
sub mysqld_arguments ($$$$$) {
......@@ -1601,12 +1626,12 @@ sub mysqld_arguments ($$$$$) {
{
if ( $type eq 'master' )
{
mtr_add_arg($args, "--debug=d:t:i:A,%s/var/log/master%s.trace",
mtr_add_arg($args, "%s--debug=d:t:i:A,%s/var/log/master%s.trace",
$prefix, $glob_mysql_test_dir, $sidx);
}
if ( $type eq 'slave' )
{
mtr_add_arg($args, "--debug=d:t:i:A,%s/var/log/slave%s.trace",
mtr_add_arg($args, "%s--debug=d:t:i:A,%s/var/log/slave%s.trace",
$prefix, $glob_mysql_test_dir, $sidx);
}
}
......@@ -1617,12 +1642,12 @@ sub mysqld_arguments ($$$$$) {
if ( $glob_use_running_ndbcluster )
{
mtr_add_arg($args,"--ndb-connectstring=%s", $prefix,
$opt_ndbconnectstring);
mtr_add_arg($args,"%s--ndb-connectstring=%s",
$prefix, $opt_ndbconnectstring);
}
else
{
mtr_add_arg($args,"--ndb-connectstring=host=localhost:%d",
mtr_add_arg($args,"%s--ndb-connectstring=host=localhost:%d",
$prefix, $opt_ndbcluster_port);
}
}
......@@ -1730,18 +1755,17 @@ sub mysqld_start ($$$$) {
my $exe;
my $pid;
# FIXME code duplication, make up your mind....
if ( $opt_source_dist )
if ( $type eq 'master' )
{
$exe= "$glob_basedir/sql/mysqld";
$exe= $exe_master_mysqld;
}
else
{
$exe ="$glob_basedir/libexec/mysqld";
if ( ! -x $exe )
elsif ( $type eq 'slave' )
{
$exe ="$glob_basedir/bin/mysqld";
$exe= $exe_slave_mysqld;
}
else
{
$exe= $exe_mysqld;
}
mtr_init_args(\$args);
......@@ -1911,7 +1935,7 @@ sub run_mysqltest ($$) {
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_mysock'});
mtr_add_arg($args, "--database=test");
mtr_add_arg($args, "--user=%s", $glob_user);
mtr_add_arg($args, "--user=%s", $opt_user);
mtr_add_arg($args, "--password=");
mtr_add_arg($args, "--silent");
mtr_add_arg($args, "-v");
......@@ -1982,7 +2006,7 @@ sub run_mysqltest ($$) {
mysqld_arguments($args,'master',0,$tinfo->{'master_opt'},[]);
}
return mtr_run($exe_mysqltest,$args,$tinfo->{'path'},"",$path_timefile,"");
return mtr_run_test($exe_mysqltest,$args,$tinfo->{'path'},"",$path_timefile,"");
}
##############################################################################
......@@ -2064,6 +2088,7 @@ Misc options
start-and-exit Only initiate and start the "mysqld" servers
fast Don't try to cleanup from earlier runs
help Get this help text
unified-diff | udiff When presenting differences, use unified diff
Options not yet described, or that I want to look into more
......
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