Title: Testsuite fails on x86_64
Type: Stage:
Components: Tests Versions: Python 3.9
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: deep42thought, mark.dickinson
Priority: normal Keywords:

Created on 2021-07-23 17:55 by deep42thought, last changed 2021-08-20 10:09 by mark.dickinson.

File name Uploaded Description Edit
build-log.php?a=pentium4&p=python deep42thought, 2021-07-23 17:55
Messages (7)
msg398084 - (view) Author: Erich Eckner (deep42thought) Date: 2021-07-23 17:55
The following tests fails on x86 32 bit:

test_cmath test_math test_posix test_turtle - looks, like the expected precision is too high.

Full log is attached.
msg398161 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2021-07-24 15:06
Extract from the log - from the configure output:

> checking for expm1... yes

and from the test output

> expm10118: expm1(27.0): expected 532048240600.79865, got 532048240600.7976 (error = 0.00104 (17 ulps); permitted error = 0 or 5 ulps)
> expm10119: expm1(123.0): expected 2.6195173187490626e+53, got 2.619517318749054e+53 (error = 8.51e+38 (20 ulps); permitted error = 0 or 5 ulps)
> expm10300: expm1(300.0): expected 1.9424263952412558e+130, got 1.942426395241274e+130 (error = 1.82e+116 (74 ulps); permitted error = 0 or 5 ulps)
> expm10301: expm1(700.0): expected 1.0142320547350045e+304, got 1.0142320547349733e+304 (error = 3.12e+290 (256 ulps); permitted error = 0 or 5 ulps)
> expm10307: expm1(709.5): expected 1.3549863193146328e+308, got 1.354986319314675e+308 (error = 4.21e+294 (211 ulps); permitted error = 0 or 5 ulps)

The first part indicates that your math library does provide expm1, so Python goes ahead and uses it. The errors from test_math show that the expm1 implementation provided by your math library has accuracy problems for large inputs. From the other failures, I suspect that the underlying issue is actually an issue with exp (but our tests for exp are not so thorough as those for expm1).

In short, the tests represent issues with the underlying C math library. What OS is this, and who supplies the libm?
msg398162 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2021-07-24 15:14
The test_posix failure appears to be unrelated; I'll let others look into that one.

The test_turtle failure looks again like a libm issue, perhaps combined with an overeager test: we're expecting a `** 0.5` operation (which translates to a libm pow call) to give exact results when the square root is exactly representable.
msg398167 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2021-07-24 16:47
Looks like the turtle code was changed to use `math.hypot` instead of `** 0.5` in issue #41528. That will likely also fix the test failure, but I've opened #44734 to fix the unnecessarily strict test.
msg399942 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2021-08-20 09:09
Update: test_turtle is fixed (44734); I think test_math and test_cmath should be resolved as either "third party" or "wont fix", since the issue is almost certainly the platform libm.

That leaves test_posix, which we should probably open a fresh issue for.
msg399943 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2021-08-20 09:12
Here's the test_posix failure, extracted from the attachment:

ERROR: test_sched_rr_get_interval (test.test_posix.PosixTester)
Traceback (most recent call last):
  File "/build/python/src/Python-3.9.6/Lib/test/", line 1347, in test_sched_rr_get_interval
    interval = posix.sched_rr_get_interval(0)
PermissionError: [Errno 1] Operation not permitted

msg399952 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2021-08-20 10:09
One more thought on the libm issues - from the logs, it looks as though the libm implementation is coming from a fairly recent version of glibc (glibc 2.33, which was released in February 2021). There were updates to the 'exp' implementation in glibc in 2018[1], but I'm not seeing anything more recent than that. Is it possible that glibc was miscompiled somehow on this platform - e.g., that it's using code designed to work with the x87 FPU with its extended precision, but was compiled with flags that force use of SSE2 instead?

If not, and if there's a genuine accuracy problem in glibc itself, we should expect to see more Python test_math and test_cmath failures in the future.

If anyone is able to run test_math or test_cmath on a machine using glibc 2.33 or glibc 2.34 and report results, that would be useful.

Date User Action Args
2021-08-20 10:09:23mark.dickinsonsetmessages: + msg399952
2021-08-20 09:12:25mark.dickinsonsetmessages: + msg399943
2021-08-20 09:09:57mark.dickinsonsetmessages: + msg399942
2021-07-24 16:47:41mark.dickinsonsetmessages: + msg398167
2021-07-24 15:14:09mark.dickinsonsetmessages: + msg398162
2021-07-24 15:06:39mark.dickinsonsetnosy: + mark.dickinson
messages: + msg398161
2021-07-23 17:55:01deep42thoughtcreate