components/python/python35/patches/28-test-vmlimit.patch
changeset 4912 0b79e9575718
equal deleted inserted replaced
4911:6590570733a1 4912:0b79e9575718
       
     1 This patch for a Solaris-specific problem but is a good safety precaution,
       
     2 so although it is not suitable for upstream as-is, we might offer it in a
       
     3 slightly tweaked form at some point in the future.
       
     4 
       
     5 --- Python-3.5.0/Lib/test/regrtest.py.~1~	2015-09-13 04:41:22.000000000 -0700
       
     6 +++ Python-3.5.0/Lib/test/regrtest.py	2015-09-14 14:42:45.764365598 -0700
       
     7 @@ -187,6 +187,19 @@
       
     8          newsoft = min(hard, max(soft, 1024*2048))
       
     9          resource.setrlimit(resource.RLIMIT_STACK, (newsoft, hard))
       
    10  
       
    11 +# The socket test goes crazy on Solaris, slurping up VM until the system
       
    12 +# dies or the test is killed.  So limit it to 4GB.  While we could do this
       
    13 +# in the socket test itself, it is more prudent to do it here in case any
       
    14 +# other tests ever go crazy in a similar fashion.
       
    15 +if sys.platform == 'sunos5':
       
    16 +    try:
       
    17 +        import resource
       
    18 +    except ImportError:
       
    19 +        pass
       
    20 +    else:
       
    21 +        vm_limit = 4294967296
       
    22 +        resource.setrlimit(resource.RLIMIT_VMEM, (vm_limit, vm_limit))
       
    23 +
       
    24  # Test result constants.
       
    25  PASSED = 1
       
    26  FAILED = 0