PerconaTest: use croak for slurp/load_file

This commit is contained in:
Brian Fraser
2013-02-28 13:07:52 -03:00
parent 310de04a56
commit 552fddb9a1

View File

@@ -35,6 +35,8 @@ use constant PTDEVDEBUG => $ENV{PTDEVDEBUG} || 0;
use Percona::Toolkit;
use Carp qw(croak);
use Test::More;
use Time::HiRes qw(sleep time);
use File::Temp qw(tempfile);
@@ -192,7 +194,7 @@ sub output {
sub load_data {
my ( $file ) = @_;
$file = "$trunk/$file";
open my $fh, '<', $file or die "Cannot open $file: $OS_ERROR";
open my $fh, '<', $file or croak "Cannot open $file: $OS_ERROR";
my $contents = do { local $/ = undef; <$fh> };
close $fh;
(my $data = join('', $contents =~ m/(.*)/g)) =~ s/\s+//g;
@@ -210,7 +212,7 @@ sub load_file {
sub slurp_file {
my ($file) = @_;
open my $fh, "<", $file or die "Cannot open $file: $OS_ERROR";
open my $fh, "<", $file or croak "Cannot open $file: $OS_ERROR";
my $contents = do { local $/ = undef; <$fh> };
close $fh;
return $contents;