t/lib/Percona/Toolkit.t: Test Percona::Toolkit::VERSION differently to avoid a bug in Centos 5.6

This commit is contained in:
Brian Fraser
2012-12-21 09:07:21 -03:00
parent 7f80ffc860
commit 4f010f52dc

View File

@@ -15,6 +15,8 @@ use IPC::Cmd qw(run can_run);
use PerconaTest; use PerconaTest;
use Percona::Toolkit; use Percona::Toolkit;
use File::Temp qw(tempfile);
my $version = $Percona::Toolkit::VERSION; my $version = $Percona::Toolkit::VERSION;
my $perl = $^X; my $perl = $^X;
@@ -42,13 +44,15 @@ foreach my $tool ( @vc_tools ) {
next unless $is_perl; next unless $is_perl;
my ($fh, $filename) = tempfile( "pt-version-test-XXXXXXX", UNLINK => 1 );
print { $fh } "require q{$tool}; print \$Percona::Toolkit::VERSION, qq{\\n}";
close $fh;
my ($success, undef, $full_buf) = my ($success, undef, $full_buf) =
run( run( command => [ $perl, $filename ] );
command => [ $perl, '-le', "require q{$tool}; print \$Percona::Toolkit::VERSION"]
);
if ( !$success ) { if ( !$success ) {
fail("Failed to get \$Percona::Toolkit::VERSION from $base: $full_buf") fail("Failed to get \$Percona::Toolkit::VERSION from $base: " . $full_buf ? join("", @$full_buf) : '')
} }
else { else {
chomp(@$full_buf); chomp(@$full_buf);