Add some extra safety to t/lib/Percona/Toolkit.t in case we are not ebing run under a bzr directory

This commit is contained in:
Brian Fraser
2012-11-07 04:42:04 -03:00
parent 02a21749b0
commit 470c4b9d41

View File

@@ -22,10 +22,11 @@ foreach my $tool ( @vc_tools ) {
my $output = `$tool --version 2>/dev/null`;
my ($tool_version) = $output =~ /(\b[0-9]\.[0-9]\.[0-9]\b)/;
next unless $tool_version; # Some tools don't have --version implemented
my $base = basename($tool);
is(
$tool_version,
$version,
"$tool --version and Percona::Toolkit::VERSION agree"
"$base --version and Percona::Toolkit::VERSION agree"
);
}
@@ -34,8 +35,11 @@ use IPC::Cmd qw(can_run);
my $bzr = can_run('bzr');
SKIP: {
skip "Can't run bzr, skipping tag checking", 1 unless $bzr;
my @tags = split /\n/, `bzr tags`;
chomp(my $root = `$bzr root 2>/dev/null`);
skip '$trunk and bzr root differ, skipping tag checking'
unless $root eq $trunk;
my @tags = split /\n/, `$bzr tags`;
my ($current_tag) = $tags[-1] =~ /^(\S+)/;
is(