Kaydet (Commit) 209ea39d authored tarafından Neal Norwitz's avatar Neal Norwitz

Sync up with trunk. Try to flush repeatedly to ensure the exception is raised.

üst 0b11c5fd
import os import os
import resource import resource
from test.test_support import TESTFN from test.test_support import TESTFN, unlink
# This test is checking a few specific problem spots. RLIMIT_FSIZE # This test is checking a few specific problem spots. RLIMIT_FSIZE
# should be RLIM_INFINITY, which will be a really big number on a # should be RLIM_INFINITY, which will be a really big number on a
...@@ -38,17 +38,19 @@ try: ...@@ -38,17 +38,19 @@ try:
f.flush() f.flush()
# On some systems (e.g., Ubuntu on hppa) the flush() # On some systems (e.g., Ubuntu on hppa) the flush()
# doesn't always cause the exception, but the close() # doesn't always cause the exception, but the close()
# does eventually. Try closing several times in an attempt # does eventually. Try flushing several times in an attempt
# to ensure the file is really synced and the exception raised. # to ensure the file is really synced and the exception raised.
for i in range(5): for i in range(5):
f.close() time.sleep(.1)
f.flush()
except IOError: except IOError:
if not limit_set: if not limit_set:
raise raise
f.close() f.close()
os.unlink(TESTFN)
finally: finally:
resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max)) if limit_set:
resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))
unlink(TESTFN)
# And be sure that setrlimit is checking for really large values # And be sure that setrlimit is checking for really large values
too_big = 10L**50 too_big = 10L**50
......
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