unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob ae52e103a7ff0c7a137ecaed87582997e0c9abfd 2817 bytes (raw)
name: packages/patches/abseil-cpp-20200923.3-adjust-sysinfo.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
 
https://sources.debian.org/data/main/a/abseil/0~20200923.3-2/debian/patches/cpu-frequency.diff
This patch is taken from Debian instead of the upstream URL because the
upstream URL contains far more changes than occur in this patch.

It was then modified to also work for armhf.

From: Benjamin Barenblat <bbaren@google.com>
Subject: Ignore missing CPU frequency on more architectures
Forwarded: yes
Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/1918ad2ae38aa32c74b558b322479a8efdd76363

Linux on MIPS, PA-RISC, RISC-V, and SystemZ doesn’t expose the nominal CPU
frequency via /sys, so don’t worry if `NominalCPUFrequency` returns 1.0 on those
platforms.

Some POWER machines expose the CPU frequency; others do not. Since we can’t
predict which type of machine the tests will run on, simply disable testing for
`NominalCPUFrequency` on POWER.

The author works at Google. Upstream applied this patch as Piper revision
347079873 and exported it to GitHub; the Applied-Upstream URL above points to
the exported commit.

--- a/absl/base/internal/sysinfo_test.cc
+++ b/absl/base/internal/sysinfo_test.cc
@@ -37,17 +37,28 @@ TEST(SysinfoTest, NumCPUs) {
       << "NumCPUs() should not have the default value of 0";
 }
 
+// Ensure that NominalCPUFrequency returns a reasonable value, or 1.00 on
+// platforms where the CPU frequency is not available through sysfs.
+//
+// POWER is particularly problematic here; some Linux kernels expose the CPU
+// frequency, while others do not. Since we can't predict a priori what a given
+// machine is going to do, just disable this test on POWER on Linux.
+#if !(defined(__linux) && (defined(__ppc64__) || defined(__PPC64__)))
 TEST(SysinfoTest, NominalCPUFrequency) {
-#if !(defined(__aarch64__) && defined(__linux__)) && !defined(__EMSCRIPTEN__)
-  EXPECT_GE(NominalCPUFrequency(), 1000.0)
-      << "NominalCPUFrequency() did not return a reasonable value";
-#else
-  // Aarch64 cannot read the CPU frequency from sysfs, so we get back 1.0.
-  // Emscripten does not have a sysfs to read from at all.
+  // Linux only exposes the CPU frequency on certain architectures, and
+  // Emscripten doesn't expose it at all.
+#if defined(__linux__) &&                                                  \
+        (defined(__aarch64__) || defined(__hppa__) || defined(__mips__) || \
+         defined(__arm__) || defined(__riscv) || defined(__s390x__)) ||                        \
+    defined(__EMSCRIPTEN__)
   EXPECT_EQ(NominalCPUFrequency(), 1.0)
       << "CPU frequency detection was fixed! Please update unittest.";
+#else
+  EXPECT_GE(NominalCPUFrequency(), 1000.0)
+      << "NominalCPUFrequency() did not return a reasonable value";
 #endif
 }
+#endif
 
 TEST(SysinfoTest, GetTID) {
   EXPECT_EQ(GetTID(), GetTID());  // Basic compile and equality test.

debug log:

solving ae52e103a7ff0c7a137ecaed87582997e0c9abfd ...
found ae52e103a7ff0c7a137ecaed87582997e0c9abfd in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).