summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@google.com>2021-01-31 14:57:57 -0500
committerGravatar Benjamin Barenblat <bbaren@google.com>2021-01-31 15:04:47 -0500
commit811a85b5d78807d1280e79151a915eb44577421b (patch)
tree14986e5f7abd875cbb7c3fa6a1ad5fc2be6f5497
parenta75ffd71441bd4607159a99a2371b33e4d217bb8 (diff)
Work around broken std::hash implementation on s390x
Disable unit tests that require a working std::hash on s390x, since s390x’s std::hash hashes large classes of data equivalently (see https://bugs.debian.org/977638).
-rw-r--r--debian/patches/series1
-rw-r--r--debian/patches/std-hash.diff46
2 files changed, 47 insertions, 0 deletions
diff --git a/debian/patches/series b/debian/patches/series
index 95a122f0..8dd1d3d3 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
configure.diff
fix-hppa.diff
+std-hash.diff
latomic.diff
diff --git a/debian/patches/std-hash.diff b/debian/patches/std-hash.diff
new file mode 100644
index 00000000..52096742
--- /dev/null
+++ b/debian/patches/std-hash.diff
@@ -0,0 +1,46 @@
+From: Benjamin Barenblat <bbaren@google.com>
+Subject: Work around broken std::hash on s390x
+Forwarded: no
+Bug-Debian: https://bugs.debian.org/977638
+
+On s390x, std::hash hashes large classes of data to the same value, which
+violates assumptions made by the Abseil tests. #ifdef out the test code that
+depends on those assumptions.
+
+--- a/absl/hash/hash_test.cc
++++ b/absl/hash/hash_test.cc
+@@ -358,6 +358,8 @@
+ TEST(HashValueTest, StdBitset) {
+ EXPECT_TRUE((is_hashable<std::bitset<257>>::value));
+
++ // The following assertions fail on s390x (https://bugs.debian.org/977638).
++#ifndef __s390x__
+ EXPECT_TRUE(absl::VerifyTypeImplementsAbslHashCorrectly(
+ {std::bitset<2>("00"), std::bitset<2>("01"), std::bitset<2>("10"),
+ std::bitset<2>("11")}));
+@@ -379,6 +381,7 @@
+ std::bitset<kNumBits>(bit_strings[3].c_str()),
+ std::bitset<kNumBits>(bit_strings[4].c_str()),
+ std::bitset<kNumBits>(bit_strings[5].c_str())}));
++#endif
+ } // namespace
+
+ template <typename T>
+@@ -400,10 +403,15 @@
+ }
+
+ REGISTER_TYPED_TEST_CASE_P(HashValueSequenceTest, BasicUsage);
++// std::vector<bool> tests fail on s390x, so exclude them. See
++// https://bugs.debian.org/977638.
+ using IntSequenceTypes =
+ testing::Types<std::deque<int>, std::forward_list<int>, std::list<int>,
+- std::vector<int>, std::vector<bool>, std::set<int>,
+- std::multiset<int>>;
++ std::vector<int>,
++#ifndef __s390x__
++ std::vector<bool>,
++#endif
++ std::set<int>, std::multiset<int>>;
+ INSTANTIATE_TYPED_TEST_CASE_P(My, HashValueSequenceTest, IntSequenceTypes);
+
+ // Private type that only supports AbslHashValue to make sure our chosen hash