diff --git a/t/lib/Percona/Toolkit.t b/t/lib/Percona/Toolkit.t index fdccdcfe..9accbc7d 100644 --- a/t/lib/Percona/Toolkit.t +++ b/t/lib/Percona/Toolkit.t @@ -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; diff --git a/t/pt-duplicate-key-checker/standard_options.t b/t/pt-duplicate-key-checker/standard_options.t index 606ea2ad..2c5f85c7 100644 --- a/t/pt-duplicate-key-checker/standard_options.t +++ b/t/pt-duplicate-key-checker/standard_options.t @@ -28,7 +28,32 @@ diag(`rm -f $pid_file >/dev/null`); diag(`touch $pid_file`); -$output = `$cmd -d issue_295 --pid $pid_file 2>&1`; + +# 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 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}, diff --git a/t/pt-fifo-split/pt-fifo-split.t b/t/pt-fifo-split/pt-fifo-split.t index c7a6e39f..f45ae850 100644 --- a/t/pt-fifo-split/pt-fifo-split.t +++ b/t/pt-fifo-split/pt-fifo-split.t @@ -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;