[Patches] [ python-Patches-551960 ] Add check for setrlimit() support

noreply@sourceforge.net noreply@sourceforge.net
Thu, 12 Dec 2002 10:14:19 -0800


Patches item #551960, was opened at 2002-05-03 10:18
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=551960&group_id=5470

Category: Tests
Group: Python 2.3
>Status: Closed
Resolution: None
Priority: 5
Submitted By: Gerald S. Williams (gsw_agere)
Assigned to: Jason Tishler (jlt63)
Summary: Add check for setrlimit() support

Initial Comment:
The new test_resource test calls resource.setrlimit() 
to change the file size limits. This fails on Cygwin, 
which supports setrlimit() and getrlimit(), just not 
changing that particular setting. (The same would 
apply to any other platforms that has those functions 
but not that particular feature.)

Since that getrlimit() works, and setrlimit() can be 
used for other reasons, a check for sys.platform was 
added to that part of the test.

----------------------------------------------------------------------

>Comment By: Jason Tishler (jlt63)
Date: 2002-12-12 09:14

Message:
Logged In: YES 
user_id=86216

Checked in as Lib/test/test_resource.py 1.3.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-12-12 08:51

Message:
Logged In: YES 
user_id=21627

If "looks ok" means "the test fails without the patch, and
passes with the patch", then go ahead and apply it.

----------------------------------------------------------------------

Comment By: Jason Tishler (jlt63)
Date: 2002-12-12 08:43

Message:
Logged In: YES 
user_id=86216

The patch looks OK from a Cygwin point of view. However,
I'm not very knowledgeable in this area. Still OK to apply?

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-12-04 01:26

Message:
Logged In: YES 
user_id=21627

Jason, can you please review this patch, and apply it if it 
looks ok?

If not, please unassign it.

----------------------------------------------------------------------

Comment By: Gerald S. Williams (gsw_agere)
Date: 2002-06-03 04:44

Message:
Logged In: YES 
user_id=329402

Since there are other limits that can be set via setrlimit(), 
failing the entire test due to a limitation on setrlimit(FSIZE) 
did not seem appropriate (even though this is currently the 
only resource limit that is tested).

Besides, even though setrlimit(FSIZE) isn't allowed to change 
the value, it should still be able to set it to the values returned 
via getrlimit(), and should still report ValueError for extremely 
large values for either cur or max. So the test is meaningful 
even on systems that aren't allowed to lower the FSIZE limit.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-06-02 09:53

Message:
Logged In: YES 
user_id=21627

I'm not sure I understand the logic in the modified
setrlimit(FSIZE) case. If setting the limit fails, it seems
that the entire test should be skipped. Raising TestSkipped
might be appropriate, to indicate that the result of the
test is not trustworthy.

----------------------------------------------------------------------

Comment By: Gerald S. Williams (gsw_agere)
Date: 2002-05-06 05:11

Message:
Logged In: YES 
user_id=329402

Cygwin Python raises ValueError when you call setrlimit() 
for RLIMIT_FSIZE. That limit is hardcoded at infinity and 
cannot be changed. I have submitted an alternative patch 
that looks for ValueError rather than checking sys.platform.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-05-06 00:44

Message:
Logged In: YES 
user_id=21627

Don't check for systems, check for features instead.

In this specific case, what error does Cygwin report? Could
that be used to deal with the missing feature in a more
general way?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=551960&group_id=5470