Message117130
The ideal would be to check that RLIMIT_FSIZE corresponds to the ulimit as it has been suggested by Neal Norwitz in msg14345, but since the value reported by ulimit has a different unit for each platform, that would be quite a lot of trouble.
All I can suggest is the following, which checks that both values are somewhat reasonable.
Index: Lib/test/test_resource.py
===================================================================
--- Lib/test/test_resource.py (révision 84964)
+++ Lib/test/test_resource.py (copie de travail)
@@ -20,12 +20,17 @@
except AttributeError:
pass
else:
- # RLIMIT_FSIZE should be RLIM_INFINITY, which will be a really big
- # number on a platform with large file support. On these platforms,
- # we need to test that the get/setrlimit functions properly convert
- # the number to a C long long and that the conversion doesn't raise
- # an error.
- self.assertEqual(resource.RLIM_INFINITY, max)
+ # RLIMIT_FSIZE should be RLIM_INFINITY if 'ulimit -f' is
+ # set to unlimited
+ # RLIM_INFINITY will be a really big number on a platform
+ # with large file support. On these platforms, we need to
+ # test that the get/setrlimit functions properly convert
+ # the number to a C long long and that the conversion
+ # doesn't raise an error.
+ self.assertGreater(resource.RLIM_INFINITY, 0)
+ self.assertLessEqual(cur, max)
+ self.assertGreater(max, 0)
+ self.assertLessEqual(max, resource.RLIM_INFINITY)
resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))
def test_fsize_enforced(self): |
|
Date |
User |
Action |
Args |
2010-09-22 09:58:46 | sable | set | recipients:
+ sable, loewis, nnorwitz, mdr0, ajaksu2, r.david.murray |
2010-09-22 09:58:46 | sable | set | messageid: <1285149526.51.0.345814893933.issue678264@psf.upfronthosting.co.za> |
2010-09-22 09:58:44 | sable | link | issue678264 messages |
2010-09-22 09:58:44 | sable | create | |
|