]> git.imager.perl.org - imager.git/commitdiff
improve error reporting for an iolayer test failing on some smokers
authorTony Cook <tony@develop-help.com>
Mon, 28 Jul 2014 11:12:08 +0000 (21:12 +1000)
committerTony Cook <tony@develop-help.com>
Mon, 28 Jul 2014 11:12:08 +0000 (21:12 +1000)
t/200-file/010-iolayer.t

index c14d1d3e0775dd0090d0b0b578800595dc603924..9f01a0458634c4485fd0a2209c0281cd748dcfe4 100644 (file)
@@ -1,6 +1,6 @@
 #!perl -w
 use strict;
-use Test::More tests => 287;
+use Test::More tests => 288;
 use Imager::Test qw(is_image);
 # for SEEK_SET etc, Fcntl doesn't provide these in 5.005_03
 use IO::Seekable;
@@ -61,13 +61,23 @@ Imager::i_writeppm_wiol($im, $IO5)
 my $data2 = Imager::io_slurp($IO5);
 undef($IO5);
 
-ok($data2, "check we got data from bufchain");
+ok(defined $data2, "check we got data from bufchain");
+ok(length $data2, "check it's non-zero length");
 
 my $IO6 = Imager::io_new_buffer($data2);
 my $im3 = Imager::i_readpnm_wiol($IO6, -1)
   or diag("failed to read from buffer: " . Imager->_error_as_msg);
 
-is(Imager::i_img_diff($im, $im3), 0, "read from buffer");
+unless ($im3) {
+  # getting a strange failure on some CPAN testers
+  print STDERR join(" ", map sprintf("%02x", ord), split //, substr($data2, 0, 30)), "\n";
+}
+
+SKIP: {
+  $im or skip "no \$im", 1;
+  $im3 or skip "no \$im3", 1;
+  is(Imager::i_img_diff($im, $im3), 0, "read from buffer");
+}
 
 my $work = $data;
 my $pos = 0;