Commit 60a303bd authored by Guido van Rossum's avatar Guido van Rossum

Change the criteria for skipping the test.

If on Windows, we require the 'largefile' resource.

If not on Windows, we use a test that actually writes a byte beyond
the 2BG limit -- seeking alone is not sufficient, since on some
systems (e.g. Linux with glibc 2.2) the sytem call interface supports
large seek offsets but not all filesystem implementations do.

Note that on Windows, we do not use the write test: on Win2K, that
test can take a minute trying to zero all those blocks on disk, and on
Windows our code always supports large seek offsets (but again, not
all filesystems do).  This may mean that on Win95, or on certain other
backward filesystems, test_largefile will *fail*.
parent 07e3bfc9
...@@ -11,17 +11,30 @@ import test_support ...@@ -11,17 +11,30 @@ import test_support
import os, struct, stat, sys import os, struct, stat, sys
# only run if the current system support large files # On Windows this test comsumes large resources; It takes a long time to build
f = open(test_support.TESTFN, 'wb') # the >2GB file and takes >2GB of disk space therefore the resource must be
try: # enabled to run this test. If not, nothing after this line stanza will be
# executed.
if sys.platform[:3] == 'win':
test_support.requires(
'largefile',
'test requires %s bytes and a long time to run' % str(size))
else:
# Only run if the current filesystem supports large files.
# (Skip this test on Windows, since we now always support large files.)
f = open(test_support.TESTFN, 'wb')
try:
# 2**31 == 2147483648 # 2**31 == 2147483648
f.seek(2147483649L) f.seek(2147483649L)
except (IOError, OverflowError): # Seeking is not enough of a test: you must write and flush, too!
f.write("x")
f.flush()
except (IOError, OverflowError):
f.close() f.close()
os.unlink(test_support.TESTFN) os.unlink(test_support.TESTFN)
raise test_support.TestSkipped, \ raise test_support.TestSkipped, \
"platform does not have largefile support" "filesystem does not have largefile support"
else: else:
f.close() f.close()
...@@ -30,16 +43,6 @@ size = 2500000000L ...@@ -30,16 +43,6 @@ size = 2500000000L
name = test_support.TESTFN name = test_support.TESTFN
# On Windows this test comsumes large resources; It takes a long time to build
# the >2GB file and takes >2GB of disk space therefore the resource must be
# enabled to run this test. If not, nothing after this line stanza will be
# executed.
if sys.platform[:3] == 'win':
test_support.requires(
'largefile',
'test requires %s bytes and a long time to run' % str(size))
def expect(got_this, expect_this): def expect(got_this, expect_this):
if test_support.verbose: if test_support.verbose:
print '%r =?= %r ...' % (got_this, expect_this), print '%r =?= %r ...' % (got_this, expect_this),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment