Turn on largefileness always if available and
[p5sagit/p5-mst-13.2.git] / t / lib / syslfs.t
index 1fe5032..ce91db6 100644 (file)
@@ -3,12 +3,6 @@
 # If you modify/add tests here, remember to update also t/op/lfs.t.
 
 BEGIN {
-       # Don't bother if there are no quads.
-       eval { my $q = pack "q", 0 };
-       if ($@) {
-               print "1..0\n# no 64-bit types\n";
-               exit(0);
-       }
        chdir 't' if -d 't';
        unshift @INC, '../lib';
        require Config; import Config;
@@ -49,6 +43,13 @@ if ($^O eq 'win32' || $^O eq 'vms') {
     bye();
 }
 
+# Known haves that have problems running this test
+# (for example because they do not support sparse files, like UNICOS)
+if ($^O eq 'unicos') {
+    print "1..0\n# large files known to work but unable to test them here\n";
+    bye();
+}
+
 # Then try to deduce whether we have sparse files.
 
 # We'll start off by creating a one megabyte file which has
@@ -68,7 +69,7 @@ my @s;
 
 print "# @s\n";
 
-my $BLOCKSIZE = 512; # is this really correct everywhere?
+my $BLOCKSIZE = $s[11] || 512;
 
 unless (@s == 13 &&
        $s[7] == 1_000_003 &&
@@ -109,6 +110,12 @@ unless($syswrite && $close) {
 
 print "# @s\n";
 
+unless ($s[7] == 5_000_000_003) {
+    print "1..0\n# not configured to use large files?\n";
+    explain();
+    bye();
+}
+
 sub fail () {
     print "not ";
     $fail++;
@@ -180,4 +187,8 @@ explain if $fail;
 
 bye(); # does the necessary cleanup
 
+END {
+   unlink "big"; # be paranoid about leaving 5 gig files lying around
+}
+
 # eof