develooper Front page | perl.perl5.porters | Postings from March 2001

Better diagnostic in io/fs.t

Thread Next
From:
andreas.koenig
Date:
March 30, 2001 00:11
Subject:
Better diagnostic in io/fs.t
Message ID:
m3hf0boev4.fsf@ak-71.mind.de
Recent linux snapshots have a truncate bug that lets io/fs.t fail in a
pretty mysterious way. While investigating, I thought we could improve
the diagnostics for test 23. The patch does not help in this case
because the whole process disappears immediately on the call to

 eval { truncate "Iofs.tmp", 5; };

But I expect other people will scratch their heads when dealing with
it and might save some time if this patch is in.

--- ../perl-5.7.0@9465/t/io/fs.t	Fri Mar 30 08:32:14 2001
+++ t/io/fs.t	Fri Mar 30 09:58:38 2001
@@ -155,14 +155,24 @@
 unlink "Iofs.tmp";
 `echo helloworld > Iofs.tmp`;
 eval { truncate "Iofs.tmp", 5; };
-if ($@ =~ /not implemented/) {
-  print "# truncate not implemented -- skipping tests 23 through 26\n";
-  for (23 .. 26) {
-    print "ok $_\n";
+if ($@) {
+  if ($@ =~ /not implemented/) {
+    print "# truncate not implemented -- skipping tests 23 through 26\n";
+    for (23 .. 26) {
+      print "ok $_\n";
+    }
+  } else {
+    warn "io/fs before test 23: truncate dies with \$\@[$@]";
   }
 }
 else {
-  if (-s "Iofs.tmp" == 5) {print "ok 23\n"} else {print "not ok 23\n"}
+  if (-s "Iofs.tmp" == 5) {
+    print "ok 23\n";
+  } else {
+    my $s = -s "Iofs.tmp";
+    printf "# -s Iofs.tmp: %s\n", defined($s) ? $s : "UNDEFINED";
+    print "not ok 23\n";
+  }
   truncate "Iofs.tmp", 0;
   if (-z "Iofs.tmp") {print "ok 24\n"} else {print "not ok 24\n"}
   open(FH, ">Iofs.tmp") or die "Can't create Iofs.tmp";



-- 
andreas

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About