From 398bd1f164022bf8e0f61c08d99d3a8d6353476c Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Thu, 28 Feb 2013 13:18:51 -0300 Subject: [PATCH] pt-fifo-split.t: Harden two tests --- t/pt-fifo-split/pt-fifo-split.t | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/t/pt-fifo-split/pt-fifo-split.t b/t/pt-fifo-split/pt-fifo-split.t index 2742714c..647c1279 100644 --- a/t/pt-fifo-split/pt-fifo-split.t +++ b/t/pt-fifo-split/pt-fifo-split.t @@ -39,7 +39,12 @@ if ( !$pid ) { PerconaTest::wait_until(sub { -p $fifo }); my @fifo; while (kill 0, $pid) { - push @fifo, slurp_file($fifo) if -e $fifo; + if ( -e $fifo ) { + eval { + my $contents = slurp_file($fifo); + push @fifo, $contents; + } + } } waitpid($pid, 0); @@ -65,7 +70,12 @@ PerconaTest::wait_until(sub { -p $fifo }); @fifo = (); while (kill 0, $pid) { - push @fifo, slurp_file($fifo) if -e $fifo; + if ( -e $fifo ) { + eval { + my $contents = slurp_file($fifo); + push @fifo, $contents; + } + } } waitpid($pid, 0); @@ -82,7 +92,7 @@ close $fh or die "Cannot close $filename: $OS_ERROR"; system("($cmd --lines 10000 $trunk/bin/pt-fifo-split > /dev/null 2>&1 < /dev/null)&"); PerconaTest::wait_until(sub { -p $fifo }); -my $contents = slurp_file($fifo); +my $contents = slurp_file($fifo) if -e $fifo; my $contents2 = load_file('bin/pt-fifo-split'); is($contents, $contents2, 'I read the file'); @@ -90,7 +100,7 @@ is($contents, $contents2, 'I read the file'); system("($cmd $trunk/t/pt-fifo-split/samples/file_with_lines --offset 2 > /dev/null 2>&1 < /dev/null)&"); PerconaTest::wait_until(sub { -p $fifo }); -$contents = slurp_file($fifo); +$contents = slurp_file($fifo) if -e $fifo; is($contents, <