[Python-checkins] CVS: python/dist/src/Lib/test test_largefile.py,1.8,1.9

Guido van Rossum gvanrossum@users.sourceforge.net
Mon, 10 Sep 2001 06:34:15 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv26688

Modified Files:
	test_largefile.py 
Log Message:
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*.


Index: test_largefile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_largefile.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** test_largefile.py	2001/09/06 01:17:45	1.8
--- test_largefile.py	2001/09/10 13:34:12	1.9
***************
*** 12,34 ****
  
  
- # only run if the current system support large files
- f = open(test_support.TESTFN, 'wb')
- try:
-     # 2**31 == 2147483648
-     f.seek(2147483649L)
- except (IOError, OverflowError):
-     f.close()
-     os.unlink(test_support.TESTFN)
-     raise test_support.TestSkipped, \
-           "platform does not have largefile support"
- else:
-     f.close()
- 
- 
- # create >2GB file (2GB = 2147483648 bytes)
- size = 2500000000L
- 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
--- 12,15 ----
***************
*** 39,42 ****
--- 20,45 ----
          '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
+         f.seek(2147483649L)
+         # Seeking is not enough of a test: you must write and flush, too!
+         f.write("x")
+         f.flush()
+     except (IOError, OverflowError):
+         f.close()
+         os.unlink(test_support.TESTFN)
+         raise test_support.TestSkipped, \
+               "filesystem does not have largefile support"
+     else:
+         f.close()
+ 
+ 
+ # create >2GB file (2GB = 2147483648 bytes)
+ size = 2500000000L
+ name = test_support.TESTFN