summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-12-13 14:42:32 +0000
committerNicholas Clark <nick@ccl4.org>2010-12-14 16:59:53 +0000
commit6c1d9365d5a8554499913c23b54871cf8767dc2a (patch)
treefe38b4cc570818c7646912f777d53f675d0524f0
parent96dca4d4be66035dc9293a9939950c0986912977 (diff)
downloadperl-6c1d9365d5a8554499913c23b54871cf8767dc2a.tar.gz
Reduce inconsistencies between ext/Fcntl/t/syslfs.t and t/op/lfs.t
The two are testing the same functionality, and comments in each reference the other. However, the two have diverged, sometimes in the same commit, sometimes when corrections have been applied to only one. (eg 972720f939262dd0)
-rw-r--r--ext/Fcntl/t/syslfs.t15
-rw-r--r--t/op/lfs.t30
2 files changed, 25 insertions, 20 deletions
diff --git a/ext/Fcntl/t/syslfs.t b/ext/Fcntl/t/syslfs.t
index 129ab970b1..38a55b6f64 100644
--- a/ext/Fcntl/t/syslfs.t
+++ b/ext/Fcntl/t/syslfs.t
@@ -14,8 +14,6 @@ BEGIN {
use strict;
-$| = 1;
-
our @s;
our $fail;
@@ -55,6 +53,8 @@ EOM
print "1..0 # Skip: @_\n" if @_;
}
+$| = 1;
+
print "# checking whether we have sparse files...\n";
# Known have-nots.
@@ -66,7 +66,7 @@ if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') {
# 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 # Skip: no sparse files in $^0, unable to test large files\n";
+ print "1..0 # Skip: no sparse files in $^O, unable to test large files\n";
bye();
}
@@ -82,7 +82,7 @@ sysopen(BIG, "big1", O_WRONLY|O_CREAT|O_TRUNC) or
sysseek(BIG, 1_000_000, SEEK_SET) or
do { warn "sysseek big1 failed: $!\n"; bye };
syswrite(BIG, "big") or
- do { warn "syswrite big1 failed; $!\n"; bye };
+ do { warn "syswrite big1 failed: $!\n"; bye };
close(BIG) or
do { warn "close big1 failed: $!\n"; bye };
@@ -95,7 +95,7 @@ sysopen(BIG, "big2", O_WRONLY|O_CREAT|O_TRUNC) or
sysseek(BIG, 2_000_000, SEEK_SET) or
do { warn "sysseek big2 failed: $!\n"; bye };
syswrite(BIG, "big") or
- do { warn "syswrite big2 failed; $!\n"; bye };
+ do { warn "syswrite big2 failed: $!\n"; bye };
close(BIG) or
do { warn "close big2 failed: $!\n"; bye };
@@ -172,7 +172,7 @@ unless ($s[7] == 5_000_000_003) {
bye();
}
-sub fail () {
+sub fail {
print "not ";
$fail++;
}
@@ -222,6 +222,9 @@ print "ok 5\n";
offset('sysseek(BIG, 0, SEEK_CUR)', 4_500_000_000);
print "ok 6\n";
+# If you get 205_032_705 from here it means that
+# your tell() is returning 32-bit values since (I32)4_500_000_001
+# is exactly 205_032_705.
offset('sysseek(BIG, 1, SEEK_CUR)', 4_500_000_001);
print "ok 7\n";
diff --git a/t/op/lfs.t b/t/op/lfs.t
index 49a5c29a9b..7afdddf07c 100644
--- a/t/op/lfs.t
+++ b/t/op/lfs.t
@@ -28,7 +28,7 @@ sub zap {
}
sub bye {
- zap();
+ zap();
exit(0);
}
@@ -73,11 +73,13 @@ if ($^O eq 'unicos') {
bye();
}
-# Then try to heuristically deduce whether we have sparse files.
+# Then try heuristically to deduce whether we have sparse files.
# Let's not depend on Fcntl or any other extension.
-my ($SEEK_SET, $SEEK_CUR, $SEEK_END) = (0, 1, 2);
+sub SEEK_SET () {0}
+sub SEEK_CUR () {1}
+sub SEEK_END () {2}
# We'll start off by creating a one megabyte file which has
# only three "true" bytes. If we have sparseness, we should
@@ -88,7 +90,7 @@ open(BIG, ">$big1") or
do { warn "open $big1 failed: $!\n"; bye };
binmode(BIG) or
do { warn "binmode $big1 failed: $!\n"; bye };
-seek(BIG, 1_000_000, $SEEK_SET) or
+seek(BIG, 1_000_000, SEEK_SET) or
do { warn "seek $big1 failed: $!\n"; bye };
print BIG "big" or
do { warn "print $big1 failed: $!\n"; bye };
@@ -103,12 +105,12 @@ open(BIG, ">$big2") or
do { warn "open $big2 failed: $!\n"; bye };
binmode(BIG) or
do { warn "binmode $big2 failed: $!\n"; bye };
-seek(BIG, 2_000_000, $SEEK_SET) or
- do { warn "seek $big2 failed; $!\n"; bye };
+seek(BIG, 2_000_000, SEEK_SET) or
+ do { warn "seek $big2 failed: $!\n"; bye };
print BIG "big" or
- do { warn "print $big2 failed; $!\n"; bye };
+ do { warn "print $big2 failed: $!\n"; bye };
close(BIG) or
- do { warn "close $big2 failed; $!\n"; bye };
+ do { warn "close $big2 failed: $!\n"; bye };
my @s2 = stat($big2);
@@ -141,7 +143,7 @@ EOF
open(BIG, ">$big0") or do { warn "open failed: $!\n"; bye };
binmode BIG;
-if ($r or not seek(BIG, 5_000_000_000, $SEEK_SET)) {
+if ($r or not seek(BIG, 5_000_000_000, SEEK_SET)) {
my $err = $r ? 'signal '.($r & 0x7f) : $!;
explain("seeking past 2GB failed: $err");
bye();
@@ -218,13 +220,13 @@ print "ok 4\n";
open(BIG, $big0) or do { warn "open failed: $!\n"; bye };
binmode BIG;
-fail unless seek(BIG, 4_500_000_000, $SEEK_SET);
+fail unless seek(BIG, 4_500_000_000, SEEK_SET);
print "ok 5\n";
offset('tell(BIG)', 4_500_000_000);
print "ok 6\n";
-fail unless seek(BIG, 1, $SEEK_CUR);
+fail unless seek(BIG, 1, SEEK_CUR);
print "ok 7\n";
# If you get 205_032_705 from here it means that
@@ -233,13 +235,13 @@ print "ok 7\n";
offset('tell(BIG)', 4_500_000_001);
print "ok 8\n";
-fail unless seek(BIG, -1, $SEEK_CUR);
+fail unless seek(BIG, -1, SEEK_CUR);
print "ok 9\n";
offset('tell(BIG)', 4_500_000_000);
print "ok 10\n";
-fail unless seek(BIG, -3, $SEEK_END);
+fail unless seek(BIG, -3, SEEK_END);
print "ok 11\n";
offset('tell(BIG)', 5_000_000_000);
@@ -256,7 +258,7 @@ print "ok 14\n";
# 705_032_704 = (I32)5_000_000_000
# See that we don't have "big" in the 705_... spot:
# that would mean that we have a wraparound.
-fail unless seek(BIG, 705_032_704, $SEEK_SET);
+fail unless seek(BIG, 705_032_704, SEEK_SET);
print "ok 15\n";
my $zero;