-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
NominalCPUFrequency Test from SysInfoTest Suite Fails on M1 Mac #1053
Comments
You may want to see my comments in #728. If the only problem you are trying to solve is a failing test, this is safe to ignore since this code is never called. I should consider stripping this test out of the open source release. NominalCPUFrequency is only called in code private to Google and we do have tests on the platforms we use it on. |
Thanks @derekmauro for looking into this and thank you for links to your prior comments. I will be more thorough on my search next time. Do you have any recommendations for development workflow? I could temporarily DISABLE_* the failing tests (there are two other tests that fail but I just wanted to make an issue with this one) but I am not sure how to separate signal from noise if the failing tests turn out to be an actual issue. Would it be helpful for you if I made a PR on removing the NominalCPUFrequency code? |
I will have to see what I can do, but please do not remove the NominalCPUFrequency code. |
-- 4324716dc5384f03dcd7e36e8cca0e944e4dac74 by Evan Brown <ezb@google.com>: Clarify comments about API differences from std::{set,map} in btree headers. We note that the most important API differences are mentioned in the next paragraph and that other API differences are minor. An example of another minor API difference is the note about std::launder in the comment for `extract`. Motivation: readers shouldn't feel like they need to read the entire header file to understand why b-tree containers are not "drop-in replacements" for STL containers. PiperOrigin-RevId: 408703780 -- 7e8da4f14afd25d11713eee6b743ba31605332bf by Derek Mauro <dmauro@google.com>: Remove the test for absl::base_internal::NominalCPUFrequency() from OSS code This is an internal-only function that should never by called by OSS code. By its nature fails on unsupported platforms. Google code has tests for this function on supported internal platforms. Fixes abseil#1053 PiperOrigin-RevId: 408692861 -- 37bad2e003b17e3f82d6fd5d90ae183553c018b0 by Abseil Team <absl-team@google.com>: To avoid triggering -Wmissing-variable-declarations warnings, ABSL_FLAG now declares the Flag before defining it. PiperOrigin-RevId: 408673990 GitOrigin-RevId: 4324716dc5384f03dcd7e36e8cca0e944e4dac74 Change-Id: I8c8ea73c4a4e38729c5bfdfa3fefb5d593e0536c
-- 4324716dc5384f03dcd7e36e8cca0e944e4dac74 by Evan Brown <ezb@google.com>: Clarify comments about API differences from std::{set,map} in btree headers. We note that the most important API differences are mentioned in the next paragraph and that other API differences are minor. An example of another minor API difference is the note about std::launder in the comment for `extract`. Motivation: readers shouldn't feel like they need to read the entire header file to understand why b-tree containers are not "drop-in replacements" for STL containers. PiperOrigin-RevId: 408703780 -- 7e8da4f14afd25d11713eee6b743ba31605332bf by Derek Mauro <dmauro@google.com>: Remove the test for absl::base_internal::NominalCPUFrequency() from OSS code This is an internal-only function that should never by called by OSS code. By its nature fails on unsupported platforms. Google code has tests for this function on supported internal platforms. Fixes abseil#1053 PiperOrigin-RevId: 408692861 -- 37bad2e003b17e3f82d6fd5d90ae183553c018b0 by Abseil Team <absl-team@google.com>: To avoid triggering -Wmissing-variable-declarations warnings, ABSL_FLAG now declares the Flag before defining it. PiperOrigin-RevId: 408673990 GitOrigin-RevId: 4324716dc5384f03dcd7e36e8cca0e944e4dac74 Change-Id: I8c8ea73c4a4e38729c5bfdfa3fefb5d593e0536c
This fails occasionally on aarch64, and upstream reports that it is not meaningful except for Google internal users. See: NominalCPUFrequency Test from SysInfoTest Suite Fails on M1 Mac abseil/abseil-cpp#1053 (comment)
Describe the bug
When running abseil tests, the
NominalCPUFrequency
test from theSysInfoTest
test suite fails fromabsl/base/internal/sysinfo_test.cc
.Steps to reproduce the bug
The command that I ran specifically on my M1 MacBook Pro is:
The failing test should show as:
What version of Abseil are you using?
Head: Commit d6c75d9
What operating system and version are you using
macOS Monterey 12.0.1
What compiler and version are you using?
What build system are you using?
bazel 5.0.0-pre.20211011.2
Additional context
It looks like the code that causes the issue is from
absl/base/internal/sysinfo.cc
between lines 177 - 186 in functionGetNominalCPUFrequency()
.The root cause stems from line 181 where
if(sysctl(mib, 2, &freq, &size, nullptr, 0) == 0)
evaluates to false, so that causes the function to never return freq. If we ignored the check and just returned the value in freq anyways, the test passes but I am not sure if that is an appropriate solution.It looks like the sysctl() call returns an error status of ENOENT, meaning the input to the first parameter of sysctl() is invalid. However both values in the mib[2] array, CTL_HW and HW_CPU_FREQ are defined, so I am not sure why this is the problem. I think this may be a bug with macOS itself because this behavior can be replicated outside of abseil in an external program. Any ideas on how to approach this problem?
The text was updated successfully, but these errors were encountered: