mtr: support for rdiff files
This commit is contained in:
parent
3320a4bffb
commit
e83dd9b517
@ -29,7 +29,6 @@ use mtr_report;
|
|||||||
use mtr_match;
|
use mtr_match;
|
||||||
|
|
||||||
# Options used for the collect phase
|
# Options used for the collect phase
|
||||||
our $start_from;
|
|
||||||
our $skip_rpl;
|
our $skip_rpl;
|
||||||
our $do_test;
|
our $do_test;
|
||||||
our $skip_test;
|
our $skip_test;
|
||||||
@ -862,14 +861,17 @@ sub collect_one_test_case {
|
|||||||
if ($tinfo->{combinations}) {
|
if ($tinfo->{combinations}) {
|
||||||
my $re = '(?:' . join('|', @{$tinfo->{combinations}}) . ')';
|
my $re = '(?:' . join('|', @{$tinfo->{combinations}}) . ')';
|
||||||
my $found = 0;
|
my $found = 0;
|
||||||
for (<$resdir/$tname,*.result>) {
|
for (<$resdir/$tname,*.{rdiff,result}>) {
|
||||||
m|$tname((?:,$re)+)\.result$| or next;
|
my ($combs, $ext) = m@$tname((?:,$re)+)\.(rdiff|result)$@ or next;
|
||||||
my $combs = $&;
|
|
||||||
my @commas = ($combs =~ m/,/g);
|
my @commas = ($combs =~ m/,/g);
|
||||||
# prefer the most specific result file
|
# prefer the most specific result file
|
||||||
if (@commas > $found) {
|
if (@commas > $found) {
|
||||||
$found = @commas;
|
$found = @commas;
|
||||||
$tinfo->{result_file} = $_;
|
$tinfo->{result_file} = $_;
|
||||||
|
if ($ext eq 'rdiff' and not $::exe_patch) {
|
||||||
|
$tinfo->{skip} = 1;
|
||||||
|
$tinfo->{comment} = "requires patch executable";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,6 +185,7 @@ my $DEFAULT_SUITES= join(',', qw(
|
|||||||
my $opt_suites;
|
my $opt_suites;
|
||||||
|
|
||||||
our $opt_verbose= 0; # Verbose output, enable with --verbose
|
our $opt_verbose= 0; # Verbose output, enable with --verbose
|
||||||
|
our $exe_patch;
|
||||||
our $exe_mysql;
|
our $exe_mysql;
|
||||||
our $exe_mysql_plugin;
|
our $exe_mysql_plugin;
|
||||||
our $exe_mysqladmin;
|
our $exe_mysqladmin;
|
||||||
@ -2035,6 +2036,8 @@ sub find_mysqld {
|
|||||||
|
|
||||||
sub executable_setup () {
|
sub executable_setup () {
|
||||||
|
|
||||||
|
$exe_patch='patch' if `patch -v`;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check if libtool is available in this distribution/clone
|
# Check if libtool is available in this distribution/clone
|
||||||
# we need it when valgrinding or debugging non installed binary
|
# we need it when valgrinding or debugging non installed binary
|
||||||
@ -2400,7 +2403,6 @@ sub environment_setup {
|
|||||||
$ENV{'SECURE_LOAD_PATH'}= $glob_mysql_test_dir."/std_data";
|
$ENV{'SECURE_LOAD_PATH'}= $glob_mysql_test_dir."/std_data";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Some stupid^H^H^H^H^H^Hignorant network providers set up "wildcard DNS"
|
# Some stupid^H^H^H^H^H^Hignorant network providers set up "wildcard DNS"
|
||||||
# servers that return some given web server address for any lookup of a
|
# servers that return some given web server address for any lookup of a
|
||||||
@ -3229,7 +3231,8 @@ sub mysql_server_start($) {
|
|||||||
|
|
||||||
# Run <tname>-master.sh
|
# Run <tname>-master.sh
|
||||||
if ($mysqld->option('#!run-master-sh') and
|
if ($mysqld->option('#!run-master-sh') and
|
||||||
run_sh_script($tinfo->{master_sh}) )
|
defined $tinfo->{master_sh} and
|
||||||
|
run_system('/bin/sh ' . $tinfo->{master_sh}) )
|
||||||
{
|
{
|
||||||
$tinfo->{'comment'}= "Failed to execute '$tinfo->{master_sh}'";
|
$tinfo->{'comment'}= "Failed to execute '$tinfo->{master_sh}'";
|
||||||
return 1;
|
return 1;
|
||||||
@ -3237,7 +3240,8 @@ sub mysql_server_start($) {
|
|||||||
|
|
||||||
# Run <tname>-slave.sh
|
# Run <tname>-slave.sh
|
||||||
if ($mysqld->option('#!run-slave-sh') and
|
if ($mysqld->option('#!run-slave-sh') and
|
||||||
run_sh_script($tinfo->{slave_sh}))
|
defined $tinfo->{slave_sh} and
|
||||||
|
run_system('/bin/sh ' . $tinfo->{slave_sh}))
|
||||||
{
|
{
|
||||||
$tinfo->{'comment'}= "Failed to execute '$tinfo->{slave_sh}'";
|
$tinfo->{'comment'}= "Failed to execute '$tinfo->{slave_sh}'";
|
||||||
return 1;
|
return 1;
|
||||||
@ -3710,16 +3714,35 @@ sub run_query {
|
|||||||
sub do_before_run_mysqltest($)
|
sub do_before_run_mysqltest($)
|
||||||
{
|
{
|
||||||
my $tinfo= shift;
|
my $tinfo= shift;
|
||||||
|
my $resfile= $tinfo->{result_file};
|
||||||
|
|
||||||
# Remove old files produced by mysqltest
|
# Remove old files produced by mysqltest
|
||||||
my $base_file= mtr_match_extension($tinfo->{result_file},
|
die "unsupported result file name $resfile, stoping" unless
|
||||||
"result"); # Trim extension
|
$resfile =~ /^(.*)\.(rdiff|result)$/;
|
||||||
if (defined $base_file ){
|
my $base_file= $1;
|
||||||
unlink("$base_file.reject");
|
# if the result file is a diff, make a proper result file
|
||||||
unlink("$base_file.progress");
|
if ($2 eq 'rdiff') {
|
||||||
unlink("$base_file.log");
|
my $resdir= dirname($resfile);
|
||||||
unlink("$base_file.warnings");
|
# we'll use a separate extension for generated result files
|
||||||
|
# to be able to distinguish them from manually created version
|
||||||
|
# controlled results, and to ignore them in bzr.
|
||||||
|
my $dest = "$base_file.result~";
|
||||||
|
if (-w $resdir) {
|
||||||
|
# don't rebuild a file if it's up to date
|
||||||
|
unless (-e $dest and -M $dest < -M $resfile) {
|
||||||
|
run_system("$exe_patch -o $dest -i $resfile -r - -f -s -d $resdir");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$dest = $opt_tmpdir . '/' . basename($dest);
|
||||||
|
run_system("$exe_patch -o $dest -i $resfile -r - -f -s -d $resdir");
|
||||||
|
}
|
||||||
|
$tinfo->{result_file} = $dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlink("$base_file.reject");
|
||||||
|
unlink("$base_file.progress");
|
||||||
|
unlink("$base_file.log");
|
||||||
|
unlink("$base_file.warnings");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5204,13 +5227,10 @@ sub report_failure_and_restart ($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub run_sh_script {
|
sub run_system($) {
|
||||||
my ($script)= @_;
|
my ($script)= @_;
|
||||||
|
|
||||||
return 0 unless defined $script;
|
|
||||||
|
|
||||||
mtr_verbose("Running '$script'");
|
mtr_verbose("Running '$script'");
|
||||||
my $ret= system("/bin/sh $script") >> 8;
|
my $ret= system($script) >> 8;
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
54
mysql-test/suite/rpl/r/rpl_insert_delayed,stmt.rdiff
Normal file
54
mysql-test/suite/rpl/r/rpl_insert_delayed,stmt.rdiff
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
--- suite/rpl/r/rpl_insert_delayed.result 2012-02-06 21:37:21.000000000 +0100
|
||||||
|
+++ suite/rpl/r/rpl_insert_delayed,stmt.reject 2012-02-06 23:12:55.000000000 +0100
|
||||||
|
@@ -15,17 +15,17 @@
|
||||||
|
insert delayed into t1 values(10, "my name");
|
||||||
|
flush table t1;
|
||||||
|
insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
|
||||||
|
+ERROR 23000: Duplicate entry '10' for key 'PRIMARY'
|
||||||
|
flush table t1;
|
||||||
|
select * from t1;
|
||||||
|
id name
|
||||||
|
10 my name
|
||||||
|
-20 James Bond
|
||||||
|
select * from t1;
|
||||||
|
id name
|
||||||
|
10 my name
|
||||||
|
-20 James Bond
|
||||||
|
delete from t1 where id!=10;
|
||||||
|
insert delayed into t1 values(20, "is Bond"), (10, "James Bond");
|
||||||
|
+ERROR 23000: Duplicate entry '10' for key 'PRIMARY'
|
||||||
|
flush table t1;
|
||||||
|
select * from t1;
|
||||||
|
id name
|
||||||
|
@@ -38,17 +38,31 @@
|
||||||
|
USE test;
|
||||||
|
DROP SCHEMA mysqlslap;
|
||||||
|
use test;
|
||||||
|
+FLUSH LOGS;
|
||||||
|
+FLUSH LOGS;
|
||||||
|
CREATE TABLE t1(a int, UNIQUE(a));
|
||||||
|
INSERT DELAYED IGNORE INTO t1 VALUES(1);
|
||||||
|
INSERT DELAYED IGNORE INTO t1 VALUES(1);
|
||||||
|
flush table t1;
|
||||||
|
+use `test`; INSERT IGNORE INTO t1 VALUES(1)
|
||||||
|
+use `test`; INSERT IGNORE INTO t1 VALUES(1)
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
On slave
|
||||||
|
+show binlog events in 'slave-bin.000002' from <binlog_start> limit 1,6;
|
||||||
|
+Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
+slave-bin.000002 # Query # # BEGIN
|
||||||
|
+slave-bin.000002 # Query # # use `test`; INSERT IGNORE INTO t1 VALUES(1)
|
||||||
|
+slave-bin.000002 # Query # # COMMIT
|
||||||
|
+slave-bin.000002 # Query # # BEGIN
|
||||||
|
+slave-bin.000002 # Query # # use `test`; INSERT IGNORE INTO t1 VALUES(1)
|
||||||
|
+slave-bin.000002 # Query # # COMMIT
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
1
|
||||||
|
drop table t1;
|
||||||
|
+FLUSH LOGS;
|
||||||
|
+FLUSH LOGS;
|
||||||
|
End of 5.0 tests
|
||||||
|
include/rpl_end.inc
|
@ -1,68 +0,0 @@
|
|||||||
include/master-slave.inc
|
|
||||||
[connection master]
|
|
||||||
CREATE SCHEMA IF NOT EXISTS mysqlslap;
|
|
||||||
USE mysqlslap;
|
|
||||||
CREATE TABLE t1 (id INT primary key auto_increment, name VARCHAR(64)) ENGINE=MyISAM;
|
|
||||||
FLUSH TABLE t1;
|
|
||||||
SELECT COUNT(*) FROM t1;
|
|
||||||
COUNT(*)
|
|
||||||
5000
|
|
||||||
use mysqlslap;
|
|
||||||
SELECT COUNT(*) FROM t1;
|
|
||||||
COUNT(*)
|
|
||||||
5000
|
|
||||||
truncate table t1;
|
|
||||||
insert delayed into t1 values(10, "my name");
|
|
||||||
flush table t1;
|
|
||||||
insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
|
|
||||||
ERROR 23000: Duplicate entry '10' for key 'PRIMARY'
|
|
||||||
flush table t1;
|
|
||||||
select * from t1;
|
|
||||||
id name
|
|
||||||
10 my name
|
|
||||||
select * from t1;
|
|
||||||
id name
|
|
||||||
10 my name
|
|
||||||
delete from t1 where id!=10;
|
|
||||||
insert delayed into t1 values(20, "is Bond"), (10, "James Bond");
|
|
||||||
ERROR 23000: Duplicate entry '10' for key 'PRIMARY'
|
|
||||||
flush table t1;
|
|
||||||
select * from t1;
|
|
||||||
id name
|
|
||||||
10 my name
|
|
||||||
20 is Bond
|
|
||||||
select * from t1;
|
|
||||||
id name
|
|
||||||
10 my name
|
|
||||||
20 is Bond
|
|
||||||
USE test;
|
|
||||||
DROP SCHEMA mysqlslap;
|
|
||||||
use test;
|
|
||||||
FLUSH LOGS;
|
|
||||||
FLUSH LOGS;
|
|
||||||
CREATE TABLE t1(a int, UNIQUE(a));
|
|
||||||
INSERT DELAYED IGNORE INTO t1 VALUES(1);
|
|
||||||
INSERT DELAYED IGNORE INTO t1 VALUES(1);
|
|
||||||
flush table t1;
|
|
||||||
use `test`; INSERT IGNORE INTO t1 VALUES(1)
|
|
||||||
use `test`; INSERT IGNORE INTO t1 VALUES(1)
|
|
||||||
select * from t1;
|
|
||||||
a
|
|
||||||
1
|
|
||||||
On slave
|
|
||||||
show binlog events in 'slave-bin.000002' from <binlog_start> limit 1,6;
|
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
|
||||||
slave-bin.000002 # Query # # BEGIN
|
|
||||||
slave-bin.000002 # Query # # use `test`; INSERT IGNORE INTO t1 VALUES(1)
|
|
||||||
slave-bin.000002 # Query # # COMMIT
|
|
||||||
slave-bin.000002 # Query # # BEGIN
|
|
||||||
slave-bin.000002 # Query # # use `test`; INSERT IGNORE INTO t1 VALUES(1)
|
|
||||||
slave-bin.000002 # Query # # COMMIT
|
|
||||||
select * from t1;
|
|
||||||
a
|
|
||||||
1
|
|
||||||
drop table t1;
|
|
||||||
FLUSH LOGS;
|
|
||||||
FLUSH LOGS;
|
|
||||||
End of 5.0 tests
|
|
||||||
include/rpl_end.inc
|
|
Loading…
x
Reference in New Issue
Block a user