mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-14 23:40:58 +00:00
fixed various test issues - 1365085
This commit is contained in:
@@ -75,6 +75,8 @@ SKIP: {
|
||||
unless $root eq $trunk;
|
||||
|
||||
my @tags = split /\n/, `$bzr tags`;
|
||||
# sort the version numbers (some bzr versions do not sort them)
|
||||
@tags = sort { calc_value($a) <=> calc_value($b) } @tags;
|
||||
my ($current_tag) = $tags[-1] =~ /^(\S+)/;
|
||||
|
||||
is(
|
||||
@@ -84,4 +86,18 @@ SKIP: {
|
||||
);
|
||||
}
|
||||
|
||||
# we use this function to help sort version numbers
|
||||
sub calc_value {
|
||||
my $version = shift;
|
||||
$version =~ s/ +[^ ]*$//;
|
||||
my $value = 0;
|
||||
my $exp = 0;
|
||||
foreach my $num (reverse split /\./, $version) {
|
||||
$value += $num * 10 ** $exp++;
|
||||
}
|
||||
print "$version = $value\n";
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
done_testing;
|
||||
|
@@ -28,7 +28,32 @@ diag(`rm -f $pid_file >/dev/null`);
|
||||
|
||||
diag(`touch $pid_file`);
|
||||
|
||||
|
||||
# to test this issue I must set a timeout in case the command doesn't come back
|
||||
|
||||
eval {
|
||||
# we define an alarm signal handler
|
||||
local $SIG{'ALRM'} = sub { die "timed out\n" };
|
||||
|
||||
# and set the alarm 'clock' to 5 seconds
|
||||
alarm(5);
|
||||
|
||||
# here's the actual command. correct bahaviour is to die with messsage "PID file <pid_file> exists"
|
||||
# Incorrect behavior is anything else, including not returning control after 5 seconds
|
||||
$output = `$cmd -d issue_295 --pid $pid_file 2>&1`;
|
||||
|
||||
};
|
||||
|
||||
if ($@) {
|
||||
if ($@ eq "timed out\n") {
|
||||
print "I timed out\n";
|
||||
}
|
||||
else {
|
||||
print "Something else went wrong: $@\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr{PID file $pid_file exists},
|
||||
|
@@ -47,6 +47,12 @@ sub read_fifo {
|
||||
my ($n_reads) = @_;
|
||||
my $last_inode = 0;
|
||||
my @data;
|
||||
|
||||
# This test still freezes on some centos systems,
|
||||
# so we're going to bluntly sleep for a few secs to avoid deadlock
|
||||
# TODO: figure out if there is a proper way to do this.
|
||||
sleep(3);
|
||||
|
||||
for (1..$n_reads) {
|
||||
PerconaTest::wait_until(sub {
|
||||
my $inode;
|
||||
|
Reference in New Issue
Block a user