mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-46099: Fix pthread_getcpuclockid test on Solaris (GH-30140) (GH-30183)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
(cherry picked from commit 427a490c49
)
Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
This commit is contained in:
parent
a66be9185c
commit
4f945ad7a5
1 changed files with 6 additions and 5 deletions
|
@ -113,12 +113,13 @@ class TimeTestCase(unittest.TestCase):
|
|||
clk_id = time.pthread_getcpuclockid(threading.get_ident())
|
||||
self.assertTrue(type(clk_id) is int)
|
||||
# when in 32-bit mode AIX only returns the predefined constant
|
||||
if not platform.system() == "AIX":
|
||||
self.assertNotEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
|
||||
elif (sys.maxsize.bit_length() > 32):
|
||||
self.assertNotEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
|
||||
else:
|
||||
if platform.system() == "AIX" and (sys.maxsize.bit_length() <= 32):
|
||||
self.assertEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
|
||||
# Solaris returns CLOCK_THREAD_CPUTIME_ID when current thread is given
|
||||
elif sys.platform.startswith("sunos"):
|
||||
self.assertEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
|
||||
else:
|
||||
self.assertNotEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
|
||||
t1 = time.clock_gettime(clk_id)
|
||||
t2 = time.clock_gettime(clk_id)
|
||||
self.assertLessEqual(t1, t2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue