diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1999-08-11 08:19:23 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-08-11 08:19:23 +0000 |
commit | ea2b5ef6d751420797c96208ee3824f54bf1d97a (patch) | |
tree | 2043c2c7d3a9eab8e7a04668d280f39d8708e213 /t/op | |
parent | d28f7c377ae191ca53d9157f124642cf323614a0 (diff) | |
download | perl-ea2b5ef6d751420797c96208ee3824f54bf1d97a.tar.gz |
Add sysio large file support testing.
p4raw-id: //depot/cfgperl@3956
Diffstat (limited to 't/op')
-rw-r--r-- | t/op/64bit.t | 6 | ||||
-rw-r--r-- | t/op/lfs.t | 75 |
2 files changed, 27 insertions, 54 deletions
diff --git a/t/op/64bit.t b/t/op/64bit.t index 10f570a4ad..97c1b03eb1 100644 --- a/t/op/64bit.t +++ b/t/op/64bit.t @@ -1,9 +1,11 @@ BEGIN { - eval { pack "q", 0 }; + 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'; } # This could use a lot of more tests. @@ -11,6 +13,8 @@ BEGIN { # Nota bene: bit operations (&, |, ^, ~, <<, >>, vec) are not 64-bit clean. # See the beginning of pp.c and the explanation next to IBW/UBW. +no warning 'overflow'; + print "1..30\n"; my $q = 12345678901; diff --git a/t/op/lfs.t b/t/op/lfs.t index 23f811363d..ce7d1a5491 100644 --- a/t/op/lfs.t +++ b/t/op/lfs.t @@ -1,9 +1,15 @@ +# NOTE: this file tests how large files (>2GB) work with perlio (stdio/sfio). +# sysopen(), sysseek(), syswrite(), sysread() are tested in t/lib/syslfs.t. +# If you modify/add tests here, remember to update also t/lib/syslfs.t. + BEGIN { - eval { pack "q", 0 }; + eval { my $q = pack "q", 0 }; if ($@) { print "1..0\n# no 64-bit types\n"; - bitedust(); + bye(); } + chdir 't' if -d 't'; + unshift @INC, '../lib'; } sub bye { @@ -19,53 +25,14 @@ if ($^O eq 'win32' || $^O eq 'vms') { bye(); } -my $SEEK_SET; -my $SEEK_CUR; -my $SEEK_END; - -# We probe for the constants 'manually' because -# we do not want to be dependent on any extensions. - -sub seek_it { - my ($set, $cur, $end) = @_; +my ($SEEK_SET, $SEEK_CUR, $SEEK_END) = (0, 1, 2); - my $test = 0; - - open(BIG, ">big") || do { warn "open failed: $!\n"; bye }; - binmode BIG; - seek(BIG, 49, $set); - print BIG "X"; - close(BIG); - open(BIG, "big") || do { warn "open failed: $!\n"; bye }; - seek(BIG, 50, $set); - if (tell(BIG) == 50) { - seek(BIG, -10, $cur); - if (tell(BIG) == 40) { - seek(BIG, -20, $end); - if (tell(BIG) == 30) { - $test = 1; - } - } - } - close(BIG); - - return $test; -} +# We'll start off by creating a one megabyte file which has +# only three "true" bytes. -if (seek_it(0, 1, 2)) { - ($SEEK_SET, $SEEK_CUR, $SEEK_END) = (0, 1, 2); -} elsif (seek_it(1, 2, 3)) { - ($SEEK_SET, $SEEK_CUR, $SEEK_END) = (1, 2, 3); -} else { - print "1..0\n# no way to seek\n"; - bye; -} - -print "# SEEK_SET = $SEEK_SET, SEEK_CUR = $SEEK_CUR, SEEK_END = $SEEK_END\n"; - -open(BIG, ">big") || do { warn "open failed: $!\n"; bye }; +open(BIG, ">big") or do { warn "open failed: $!\n"; bye }; binmode BIG; -seek(BIG, 100_000, $SEEK_SET); +seek(BIG, 1_000_000, $SEEK_SET); print BIG "big"; close(BIG); @@ -73,12 +40,14 @@ my @s; @s = stat("big"); +print "# @s\n"; + unless (@s == 13 && - $s[7] == 100_003 && + $s[7] == 1_000_003 && defined $s[11] && defined $s[12] && - $s[11] * $s[12] < 100_003) { - print "1..0\n# no sparse files\n"; + $s[11] * $s[12] < 1000_003) { + print "1..0\n# no sparse files?\n"; bye(); } @@ -87,7 +56,7 @@ unless (@s == 13 && print "1..8\n"; -open(BIG, ">big") || do { warn "open failed: $!\n"; bye }; +open(BIG, ">big") or do { warn "open failed: $!\n"; bye }; binmode BIG; seek(BIG, 5_000_000_000, $SEEK_SET); print BIG "big"; @@ -95,13 +64,15 @@ close BIG; @s = stat("big"); +print "# @s\n"; + print "not " unless $s[7] == 5_000_000_003; print "ok 1\n"; print "not " unless -s "big" == 5_000_000_003; print "ok 2\n"; -open(BIG, "big") || do { warn "open failed: $!\n"; bye }; +open(BIG, "big") or do { warn "open failed: $!\n"; bye }; binmode BIG; seek(BIG, 4_500_000_000, $SEEK_SET); @@ -135,5 +106,3 @@ print "ok 8\n"; bye(); # eof - - |