Sébastien Sablé <sa...@users.sourceforge.net> added the comment: 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): ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue678264> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com