mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Issue #12156: Skip test_multiprocessing on systems which don't support enough
POSIX semaphores (among which FreeBSD < 8).
This commit is contained in:
parent
975134e2a2
commit
6392d7f68b
1 changed files with 18 additions and 0 deletions
|
@ -95,6 +95,22 @@ except ImportError:
|
||||||
Structure = object
|
Structure = object
|
||||||
c_int = c_double = None
|
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
|
# Creates a wrapper for a function which records the time it takes to finish
|
||||||
#
|
#
|
||||||
|
@ -2236,6 +2252,8 @@ def test_main(run=None):
|
||||||
except OSError:
|
except OSError:
|
||||||
raise unittest.SkipTest("OSError raises on RLock creation, see issue 3111!")
|
raise unittest.SkipTest("OSError raises on RLock creation, see issue 3111!")
|
||||||
|
|
||||||
|
check_enough_semaphores()
|
||||||
|
|
||||||
if run is None:
|
if run is None:
|
||||||
from test.test_support import run_unittest as run
|
from test.test_support import run_unittest as run
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue