File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,6 +98,22 @@ def latin(s):
9898 Structure = object
9999 c_int = c_double = None
100100
101+
102+ def check_enough_semaphores ():
103+ """Check that the system supports enough semaphores to run the test."""
104+ # minimum number of semaphores available according to POSIX
105+ nsems_min = 256
106+ try :
107+ nsems = os .sysconf ("SC_SEM_NSEMS_MAX" )
108+ except (AttributeError , ValueError ):
109+ # sysconf not available or setting not available
110+ return
111+ if nsems == - 1 or nsems >= nsems_min :
112+ return
113+ raise unittest .SkipTest ("The OS doesn't support enough semaphores "
114+ "to run the test (required: %d)." % nsems_min )
115+
116+
101117#
102118# Creates a wrapper for a function which records the time it takes to finish
103119#
@@ -2294,6 +2310,8 @@ def test_main(run=None):
22942310 except OSError :
22952311 raise unittest .SkipTest ("OSError raises on RLock creation, see issue 3111!" )
22962312
2313+ check_enough_semaphores ()
2314+
22972315 if run is None :
22982316 from test .support import run_unittest as run
22992317
You can’t perform that action at this time.
0 commit comments