-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_thread_time fails on NetBSD: time difference exceeds expected threshold #123978
Comments
I have run the test many times, I get results between 0.10 and 0.30.
|
I suggest to skip test_thread_time() on NetBSD with a refererence to this issue. |
From the discussion on #123979, it seems that CLOCK_THREAD_CPUTIME_ID does not work as intended on NetBSD. The following example: import time
names = ['time', 'monotonic', 'process_time', 'thread_time']
funcs = [getattr(time, name) for name in names]
times = [f() for f in funcs]
time.sleep(10)
for name, f, t in zip(names, funcs, times):
print(name, f() - t) produces the following output:
It is expected And this issue is known to the NetBSD developers: https://gnats.netbsd.org/57512. We should either skip thread_time related tests on NetBSD and leave it to the users to deal with this issue, or remove the broken There was similar issue on Solaris and Illumos (see #79636, https://www.illumos.org/issues/14126). Even if CLOCK_THREAD_CPUTIME_ID was provided in headers, |
It puzzled me why
There is also an error in conditions for the |
…-124116) (cherry picked from commit e670a11) Co-authored-by: Serhiy Storchaka <[email protected]>
…ythonGH-124116) (cherry picked from commit e670a11) Co-authored-by: Serhiy Storchaka <[email protected]>
I think we should skip the test instead of disabling the functionality altogether. It's a platform bug that the underlying APIs don't behave as expected, and it shouldn't make our tests fail, but we don't have control over the platform. The platform could be fixed and then any older releases of Python would still refuse those APIs. (FWIW, Greg was in contact with a NetBSD friend who thought it would be fixed soon.) Maybe if we had configure-time checks of the functionality it would make sense to skip them, but that seems like a lot of work for this. Let's skip the test and leave it at that. |
I think that it is safer to not provide a function than provide a function which returns a wrong result and there is no way to easy detect that it is broken. It is broken not only because the result includes the sleeping time, -- according to the NetBSD issue, this timer can go backward. The discussion stopped a year ago, so it is unlikely it will be solved soon. @gpshead merged the backport to 3.12, and it is now included in 3.12.7. Should we revert this change or accept the backport to 3.13? |
I agree with @serhiy-storchaka, that's why I approved his PRs. It's a silly situation, but it's better to not add the function to Python, rather than just skipping tests. |
…) (GH-124425) (cherry picked from commit e670a11) Co-authored-by: Serhiy Storchaka <[email protected]>
Bug report
Bug description:
OS:
NetBSD 10.0 amd64
CPython versions tested on:
CPython main branch
Operating systems tested on:
Other
Linked PRs
The text was updated successfully, but these errors were encountered: