Update progress.t, option_sanity.t, and standard_options.t. Make test env always have slave2 (12347, slave of 12346). Add PerconaTest::count_checksum_results(). Add util/wait-to-exec.

This commit is contained in:
Daniel Nichter
2011-10-14 11:45:11 -06:00
parent 48fb4baa7c
commit 4ad88ddd93
11 changed files with 294 additions and 73 deletions

View File

@@ -224,11 +224,11 @@ sub wait_until {
my $slept = 0;
while ( $slept <= $max_t ) {
return if $code->();
return 1 if $code->();
sleep $t;
$slept += $t;
}
return;
return 0;
}
# Wait t seconds for code to return.
@@ -558,6 +558,41 @@ sub test_bash_tool {
return;
}
my %checksum_result_col = (
ts => 0,
errors => 1,
diffs => 2,
rows => 3,
chunks => 4,
skipped => 5,
time => 6,
table => 7,
);
sub count_checksum_results {
my ($output, $column, $table) = @_;
my (@res) = map {
my $line = $_;
my (@cols) = $line =~ m/(\S+)/g;
\@cols;
}
grep {
my $line = $_;
if ( !$table ) {
$line;
}
else {
$line =~ m/$table$/m ? $line : '';
}
}
grep { m/^\d+\-\d+T/ } split /\n/, $output;
my $colno = $checksum_result_col{lc $column};
die "Invalid checksum result column: $column" unless defined $colno;
my $total = 0;
map { $total += $_->[$colno] } @res;
return $total;
}
1;
}
# ###########################################################################