From 4f010f52dcffa89cf50cadfea72cc793084dd139 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 21 Dec 2012 09:07:21 -0300 Subject: [PATCH] t/lib/Percona/Toolkit.t: Test Percona::Toolkit::VERSION differently to avoid a bug in Centos 5.6 --- t/lib/Percona/Toolkit.t | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/t/lib/Percona/Toolkit.t b/t/lib/Percona/Toolkit.t index 38e2da36..74e2a562 100644 --- a/t/lib/Percona/Toolkit.t +++ b/t/lib/Percona/Toolkit.t @@ -15,6 +15,8 @@ use IPC::Cmd qw(run can_run); use PerconaTest; use Percona::Toolkit; +use File::Temp qw(tempfile); + my $version = $Percona::Toolkit::VERSION; my $perl = $^X; @@ -42,13 +44,15 @@ foreach my $tool ( @vc_tools ) { 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) = - run( - command => [ $perl, '-le', "require q{$tool}; print \$Percona::Toolkit::VERSION"] - ); + run( command => [ $perl, $filename ] ); 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 { chomp(@$full_buf);