Aurelien Larcher
2021-01-08 b5a8497ec9558d0061024ac4b49f445bbe7d1094
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
This patch for a Solaris-specific problem but is a good safety precaution,
so although it is not suitable for upstream as-is, we might offer it in a
slightly tweaked form at some point in the future.
 
Note that this can also have wrong impact on other tests (e.g., imap which
tries to allocate huge chunks of virtual memory).
 
--- Python-3.9.0/Lib/test/libregrtest/setup.py
+++ Python-3.9.0/Lib/test/libregrtest/setup.py
@@ -60,6 +60,19 @@ def setup_tests(ns):
         if getattr(module, '__file__', None):
             module.__file__ = os.path.abspath(module.__file__)
 
+    # The socket test goes crazy on Solaris, slurping up VM until the system
+    # dies or the test is killed.  So limit it to 8GB.  While we could do this
+    # in the socket test itself, it is more prudent to do it here in case any
+    # other tests ever go crazy in a similar fashion.
+    if sys.platform == 'sunos5':
+        try:
+            import resource
+        except ImportError:
+            pass
+        else:
+            vm_limit = 8589934592
+            resource.setrlimit(resource.RLIMIT_VMEM, (vm_limit, vm_limit))
+
     if ns.huntrleaks:
         unittest.BaseTestSuite._cleanup = False