summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles-François Natali <neologix@free.fr>2011-11-22 17:55:22 (GMT)
committerCharles-François Natali <neologix@free.fr>2011-11-22 17:55:22 (GMT)
commit221ef67fd669622f0d2b8c6a4e9c16ea4a0e1488 (patch)
treea83bc3c0adc795ad981aea3ab88cb5f438bf4db4
parent98f22d2cf510e69f136248735929b85a58c873f3 (diff)
downloadcpython-221ef67fd669622f0d2b8c6a4e9c16ea4a0e1488.zip
cpython-221ef67fd669622f0d2b8c6a4e9c16ea4a0e1488.tar.gz
cpython-221ef67fd669622f0d2b8c6a4e9c16ea4a0e1488.tar.bz2
Issue #12156: Skip test_multiprocessing on systems which don't support enough
POSIX semaphores (among which FreeBSD < 8).
-rw-r--r--Lib/test/test_multiprocessing.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
index 0bc056f..b99201b 100644
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -115,6 +115,22 @@ except ImportError:
Structure = object
c_int = c_double = None
+
+def check_enough_semaphores():
+ """Check that the system supports enough semaphores to run the test."""
+ # minimum number of semaphores available according to POSIX
+ nsems_min = 256
+ try:
+ nsems = os.sysconf("SC_SEM_NSEMS_MAX")
+ except (AttributeError, ValueError):
+ # sysconf not available or setting not available
+ return
+ if nsems == -1 or nsems >= nsems_min:
+ return
+ raise unittest.SkipTest("The OS doesn't support enough semaphores "
+ "to run the test (required: %d)." % nsems_min)
+
+
#
# Creates a wrapper for a function which records the time it takes to finish
#
@@ -2349,6 +2365,8 @@ def test_main(run=None):
except OSError:
raise unittest.SkipTest("OSError raises on RLock creation, see issue 3111!")
+ check_enough_semaphores()
+
if run is None:
from test.support import run_unittest as run