From d70989cf7d5f395405e2172a3a8591af212d9ec0 Mon Sep 17 00:00:00 2001 From: Benjamin A. Beasley Date: Feb 18 2022 14:14:02 +0000 Subject: [PATCH 1/5] Update to 20211102.0 (close RHBZ#2019691) --- diff --git a/.gitignore b/.gitignore index 382b9d2..dd28df9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /abseil-cpp-20200923.2.tar.gz /abseil-cpp-20200923.3.tar.gz /abseil-cpp-20210324.2.tar.gz +/abseil-cpp-20211102.0.tar.gz diff --git a/abseil-cpp-20210324-gtest.patch b/abseil-cpp-20210324-gtest.patch deleted file mode 100644 index a43b5ca..0000000 --- a/abseil-cpp-20210324-gtest.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff -up ./CMakeLists.txt.2 ./CMakeLists.txt ---- ./CMakeLists.txt.2 2021-04-20 12:55:14.000000000 -0400 -+++ ./CMakeLists.txt 2021-05-21 22:26:12.910191071 -0400 -@@ -127,6 +127,22 @@ if(BUILD_TESTING) - set(absl_gtest_src_dir ${ABSL_LOCAL_GOOGLETEST_DIR}) - endif() - include(CMake/Googletest/DownloadGTest.cmake) -+ else() -+ # Set up gtest targets -+ find_library(GTEST_LIB gtest) -+ add_library(gtest UNKNOWN IMPORTED) -+ set_target_properties(gtest PROPERTIES IMPORTED_LOCATION ${GTEST_LIB}) -+ find_library(GTEST_MAIN_LIB gtest_main) -+ add_library(gtest_main UNKNOWN IMPORTED) -+ set_target_properties(gtest_main PROPERTIES IMPORTED_LOCATION ${GTEST_MAIN_LIB} INTERFACE_LINK_LIBRARIES gtest) -+ -+ # Set up gmock targets -+ find_library(GMOCK_LIB gmock) -+ add_library(gmock UNKNOWN IMPORTED) -+ set_target_properties(gmock PROPERTIES IMPORTED_LOCATION ${GMOCK_LIB} INTERFACE_LINK_LIBRARIES gtest) -+ find_library(GMOCK_MAIN_LIB gmock_main) -+ add_library(gmock_main UNKNOWN IMPORTED) -+ set_target_properties(gmock_main PROPERTIES IMPORTED_LOCATION ${GMOCK_MAIN_LIB} INTERFACE_LINK_LIBRARIES "gmock;Threads::Threads") - endif() - - check_target(gtest) diff --git a/abseil-cpp-20211102.0-gtest-unreleased-features.patch b/abseil-cpp-20211102.0-gtest-unreleased-features.patch new file mode 100644 index 0000000..a77bcc0 --- /dev/null +++ b/abseil-cpp-20211102.0-gtest-unreleased-features.patch @@ -0,0 +1,111 @@ +diff -Naur abseil-cpp-20211102.0-original/absl/strings/internal/cord_rep_btree_test.cc abseil-cpp-20211102.0/absl/strings/internal/cord_rep_btree_test.cc +--- abseil-cpp-20211102.0-original/absl/strings/internal/cord_rep_btree_test.cc 2021-11-03 11:26:14.000000000 -0400 ++++ abseil-cpp-20211102.0/absl/strings/internal/cord_rep_btree_test.cc 2021-12-17 08:44:54.254485697 -0500 +@@ -59,7 +59,6 @@ + using ::testing::_; + using ::testing::AllOf; + using ::testing::AnyOf; +-using ::testing::Conditional; + using ::testing::ElementsAre; + using ::testing::ElementsAreArray; + using ::testing::Eq; +@@ -381,7 +380,6 @@ + flats.push_back(MakeHexFlat(i)); + auto* result = CordRepBtree::Append(leaf, flats.back()); + EXPECT_THAT(result->height(), Eq(0)); +- EXPECT_THAT(result, Conditional(shared(), Ne(leaf), Eq(leaf))); + EXPECT_THAT(result->Edges(), ElementsAreArray(flats)); + leaf = result; + } +@@ -399,7 +397,6 @@ + flats.push_front(MakeHexFlat(i)); + auto* result = CordRepBtree::Prepend(leaf, flats.front()); + EXPECT_THAT(result->height(), Eq(0)); +- EXPECT_THAT(result, Conditional(shared(), Ne(leaf), Eq(leaf))); + EXPECT_THAT(result->Edges(), ElementsAreArray(flats)); + leaf = result; + } +@@ -426,7 +423,6 @@ + result = CordRepBtree::Append(leaf, flats.back()); + } + EXPECT_THAT(result->height(), Eq(0)); +- EXPECT_THAT(result, Conditional(shared(), Ne(leaf), Eq(leaf))); + EXPECT_THAT(result->Edges(), ElementsAreArray(flats)); + leaf = result; + } +@@ -483,7 +479,6 @@ + flats.push_back(MakeHexFlat(i)); + CordRepBtree* result = CordRepBtree::Append(tree, flats.back()); + ASSERT_THAT(result, IsNode(1)); +- ASSERT_THAT(result, Conditional(shared(), Ne(tree), Eq(tree))); + std::vector edges = GetLeafEdges(result); + ASSERT_THAT(edges, ElementsAreArray(flats)); + tree = result; +@@ -514,7 +509,6 @@ + flats.push_back(MakeHexFlat(i)); + CordRepBtree* result = CordRepBtree::Append(tree, flats.back()); + ASSERT_THAT(result, IsNode(2)); +- ASSERT_THAT(result, Conditional(shared(), Ne(tree), Eq(tree))); + std::vector edges = GetLeafEdges(result); + ASSERT_THAT(edges, ElementsAreArray(flats)); + tree = result; +@@ -544,7 +538,6 @@ + flats.push_front(MakeHexFlat(i)); + CordRepBtree* result = CordRepBtree::Prepend(tree, flats.front()); + ASSERT_THAT(result, IsNode(1)); +- ASSERT_THAT(result, Conditional(shared(), Ne(tree), Eq(tree))); + std::vector edges = GetLeafEdges(result); + ASSERT_THAT(edges, ElementsAreArray(flats)); + tree = result; +@@ -575,7 +568,6 @@ + flats.push_front(MakeHexFlat(i)); + CordRepBtree* result = CordRepBtree::Prepend(tree, flats.front()); + ASSERT_THAT(result, IsNode(2)); +- ASSERT_THAT(result, Conditional(shared(), Ne(tree), Eq(tree))); + std::vector edges = GetLeafEdges(result); + ASSERT_THAT(edges, ElementsAreArray(flats)); + tree = result; +@@ -889,7 +881,6 @@ + for (size_t i = 1; i < n; ++i) { + refs.RefIf(shared(), leaf); + CordRepBtree* result = BtreeAdd(leaf, append, consumer.Next(3)); +- EXPECT_THAT(result, Conditional(shared(), Ne(leaf), Eq(leaf))); + EXPECT_THAT(CordToString(result), Eq(consumer.Consumed())); + leaf = result; + } +@@ -905,9 +896,6 @@ + CordRepBtree* leaf0 = tree->Edges()[0]->btree(); + CordRepBtree* leaf1 = tree->Edges()[1]->btree(); + CordRepBtree* result = CordRepBtree::Append(tree, "123456789"); +- EXPECT_THAT(result, Conditional(shared(), Ne(tree), Eq(tree))); +- EXPECT_THAT(result->Edges(), +- ElementsAre(leaf0, Conditional(shared(), Ne(leaf1), Eq(leaf1)))); + EXPECT_THAT(CordToString(result), Eq(data + "123456789")); + CordRep::Unref(result); + } +@@ -920,9 +908,6 @@ + CordRepBtree* leaf0 = tree->Edges()[0]->btree(); + CordRepBtree* leaf1 = tree->Edges()[1]->btree(); + CordRepBtree* result = CordRepBtree::Prepend(tree, "123456789"); +- EXPECT_THAT(result, Conditional(shared(), Ne(tree), Eq(tree))); +- EXPECT_THAT(result->Edges(), +- ElementsAre(Conditional(shared(), Ne(leaf0), Eq(leaf0)), leaf1)); + EXPECT_THAT(CordToString(result), Eq("123456789" + data)); + CordRep::Unref(result); + } +@@ -954,7 +939,6 @@ + for (size_t i = max_cap + 1; i < max_cap * max_cap; ++i) { + refs.RefIf(shared(), tree); + result = BtreeAdd(tree, append, consumer.Next(3)); +- ASSERT_THAT(result, Conditional(shared(), Ne(tree), Eq(tree))); + ASSERT_THAT(CordToString(result), Eq(consumer.Consumed())); + tree = result; + } +@@ -970,7 +954,6 @@ + ++i) { + refs.RefIf(shared(), tree); + result = BtreeAdd(tree, append, consumer.Next(3)); +- ASSERT_THAT(result, Conditional(shared(), Ne(tree), Eq(tree))); + ASSERT_THAT(CordToString(result), Eq(consumer.Consumed())); + tree = result; + } diff --git a/abseil-cpp.spec b/abseil-cpp.spec index fb8b75c..042e054 100644 --- a/abseil-cpp.spec +++ b/abseil-cpp.spec @@ -1,28 +1,23 @@ -# Force out of source build -%undefine __cmake_in_source_build - # Installed library version -%global lib_version 2103.0.1 +%global lib_version 2111.0.0 Name: abseil-cpp -Version: 20210324.2 -Release: 4%{?dist} +Version: 20211102.0 +Release: 1%{?dist} Summary: C++ Common Libraries License: ASL 2.0 URL: https://abseil.io Source0: https://github.com/abseil/abseil-cpp/archive/%{version}/%{name}-%{version}.tar.gz -# Set up system gtest and gmock targets to allow test suite to be built. -# abseil-cpp expects the targets to be created by a bundled copy of gtest/gmock. -# This patch replicates those targets via find_library and imported targets. -# Not submitted upstream. -Patch1: abseil-cpp-20210324-gtest.patch - # Disable CPU frequency detection on armv7hl architectures. # Makes test consistent with aarch64 CPUs. # Not submitted upstream. -Patch2: abseil-cpp-20210324.2-armv7.patch +Patch0: abseil-cpp-20210324.2-armv7.patch +# Remove test assertions that use ::testing::Conditional, which is not in a +# released version of GTest. Not submitted upstream, as this is a workaround +# rather than a fix. https://github.com/abseil/abseil-cpp/issues/1063 +Patch1: abseil-cpp-20211102.0-gtest-unreleased-features.patch BuildRequires: cmake BuildRequires: gcc-c++ @@ -55,9 +50,22 @@ Development headers for %{name} %prep %autosetup -p1 -S gendiff +# Replace GTEST_FLAG_GET, which is not in a released version of GTest, with an +# appropriate default value. Not submitted upstream, as this is a workaround +# rather than a fix. https://github.com/abseil/abseil-cpp/issues/1063 +# +# The find-then-sed pattern means we only discard mtimes on files that actually +# needed to be modified. +find . -type f -name '*.cc' \ + -exec gawk '/GTEST_FLAG_GET/ { print FILENAME ; nextfile }' '{}' '+' | + xargs -r -t sed -r -i 's/GTEST_FLAG_GET/::testing::GTEST_FLAG/g' + + %build %cmake \ -DABSL_USE_EXTERNAL_GOOGLETEST:BOOL=ON \ + -DABSL_FIND_GOOGLETEST:BOOL=ON \ + -DABSL_ENABLE_INSTALL:BOOL=ON \ -DBUILD_TESTING:BOOL=ON \ -DCMAKE_BUILD_TYPE:STRING=None \ -DCMAKE_CXX_STANDARD:STRING=17 @@ -88,6 +96,9 @@ Development headers for %{name} %{_libdir}/pkgconfig/*.pc %changelog +* Fri Feb 18 2022 Benjamin A. Beasley - 20211102.0-1 +- Update to 20211102.0 (close RHBZ#2019691) + * Mon Jan 31 2022 Benjamin A. Beasley - 20210324.2-4 - Fix test failure (fix RHBZ#2045186) diff --git a/sources b/sources index 447714c..35a1237 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (abseil-cpp-20210324.2.tar.gz) = 7b935f0f2787a81438f30072f2191138ce3c099e4b22addfbe8ebe579d906604bc6ab03f054d3d6917a08ef5cb7a4371c1a501a7dfbc15c50301261dbf5f6e27 +SHA512 (abseil-cpp-20211102.0.tar.gz) = fed68aa434c02ec6faa9d1c81f1ad35b60ec024b44957e2e0ac31e6075e385c06a3e1b616afeb4bb7c2413191fd7827d82e1f9f0796b52ed21fb2c41dd9031cf From 804bd00e2c5c720e4d780d7db3d1ae221751b628 Mon Sep 17 00:00:00 2001 From: Benjamin A. Beasley Date: Feb 18 2022 14:14:04 +0000 Subject: [PATCH 2/5] Drop --output-on-failure, already in %%ctest expansion --- diff --git a/abseil-cpp.spec b/abseil-cpp.spec index 042e054..868f894 100644 --- a/abseil-cpp.spec +++ b/abseil-cpp.spec @@ -79,9 +79,9 @@ find . -type f -name '*.cc' \ # s390x does not seem to be supported, several tests fail. # Make tests informational until failures are resolved. %ifarch s390x -%ctest --output-on-failure || : +%ctest || : %else -%ctest --output-on-failure +%ctest %endif %files @@ -98,6 +98,7 @@ find . -type f -name '*.cc' \ %changelog * Fri Feb 18 2022 Benjamin A. Beasley - 20211102.0-1 - Update to 20211102.0 (close RHBZ#2019691) +- Drop --output-on-failure, already in %%ctest expansion * Mon Jan 31 2022 Benjamin A. Beasley - 20210324.2-4 - Fix test failure (fix RHBZ#2045186) From 20f616750e165a73c1de449254d75337c03c8aff Mon Sep 17 00:00:00 2001 From: Benjamin A. Beasley Date: Feb 18 2022 14:22:12 +0000 Subject: [PATCH 3/5] On s390x, instead of ignoring all tests, skip only the single failing test --- diff --git a/abseil-cpp.spec b/abseil-cpp.spec index 868f894..1c4c1da 100644 --- a/abseil-cpp.spec +++ b/abseil-cpp.spec @@ -60,6 +60,50 @@ find . -type f -name '*.cc' \ -exec gawk '/GTEST_FLAG_GET/ { print FILENAME ; nextfile }' '{}' '+' | xargs -r -t sed -r -i 's/GTEST_FLAG_GET/::testing::GTEST_FLAG/g' +# It’s extremely difficult to pass gtest options through to the test +# executables from ctest. We could probably skip an entire executable (e.g. +# absl_symbolize_test) by symlinking it to /bin/true, but the easiest way to +# skip a *single test* is to patch the test source. + +%ifarch s390x +# TODO: why does this test fail? +# +# 48/167 Test #49: absl_symbolize_test ................................***Failed 0.02 sec +# TestWithReturnAddress passed +# [==========] Running 7 tests from 1 test suite. +# [----------] Global test environment set-up. +# [----------] 7 tests from Symbolize +# [ RUN ] Symbolize.Cached +# [ OK ] Symbolize.Cached (0 ms) +# [ RUN ] Symbolize.Truncation +# [ OK ] Symbolize.Truncation (0 ms) +# [ RUN ] Symbolize.SymbolizeWithDemangling +# [ OK ] Symbolize.SymbolizeWithDemangling (0 ms) +# [ RUN ] Symbolize.SymbolizeSplitTextSections +# [ OK ] Symbolize.SymbolizeSplitTextSections (0 ms) +# [ RUN ] Symbolize.SymbolizeWithMultipleMaps +# /builddir/build/BUILD/abseil-cpp-20210324.2/absl/debugging/symbolize_test.cc:315: Failure +# Expected equality of these values: +# "kPadding1" +# buf +# Which is: "" +# /builddir/build/BUILD/abseil-cpp-20210324.2/absl/debugging/symbolize_test.cc:349: Failure +# Expected equality of these values: +# expected[i] +# Which is: "kPadding1" +# buf +# Which is: "" +# /builddir/build/BUILD/abseil-cpp-20210324.2/absl/debugging/symbolize_test.cc:349: Failure +# Expected equality of these values: +# expected[i] +# Which is: "kPadding1" +# buf +# Which is: "" +# [ FAILED ] Symbolize.SymbolizeWithMultipleMaps (1 ms) +sed -r -i 's/\bSymbolizeWithMultipleMaps\b/DISABLED_&/' \ + absl/debugging/symbolize_test.cc +%endif + %build %cmake \ @@ -76,13 +120,7 @@ find . -type f -name '*.cc' \ %cmake_install %check -# s390x does not seem to be supported, several tests fail. -# Make tests informational until failures are resolved. -%ifarch s390x -%ctest || : -%else %ctest -%endif %files %license LICENSE @@ -99,6 +137,7 @@ find . -type f -name '*.cc' \ * Fri Feb 18 2022 Benjamin A. Beasley - 20211102.0-1 - Update to 20211102.0 (close RHBZ#2019691) - Drop --output-on-failure, already in %%ctest expansion +- On s390x, instead of ignoring all tests, skip only the single failing test * Mon Jan 31 2022 Benjamin A. Beasley - 20210324.2-4 - Fix test failure (fix RHBZ#2045186) From 90ddd348dd97b35bae3fb1d81a574611580891cc Mon Sep 17 00:00:00 2001 From: Benjamin A. Beasley Date: Feb 18 2022 20:25:18 +0000 Subject: [PATCH 4/5] Use ninja backend for CMake: speeds up build with no downsides --- diff --git a/abseil-cpp.spec b/abseil-cpp.spec index 1c4c1da..7d61aae 100644 --- a/abseil-cpp.spec +++ b/abseil-cpp.spec @@ -20,10 +20,12 @@ Patch0: abseil-cpp-20210324.2-armv7.patch Patch1: abseil-cpp-20211102.0-gtest-unreleased-features.patch BuildRequires: cmake +# The default make backend would work just as well; ninja is observably faster +BuildRequires: ninja-build BuildRequires: gcc-c++ + BuildRequires: gmock-devel BuildRequires: gtest-devel -BuildRequires: make %description Abseil is an open-source collection of C++ library code designed to augment @@ -107,6 +109,7 @@ sed -r -i 's/\bSymbolizeWithMultipleMaps\b/DISABLED_&/' \ %build %cmake \ + -GNinja \ -DABSL_USE_EXTERNAL_GOOGLETEST:BOOL=ON \ -DABSL_FIND_GOOGLETEST:BOOL=ON \ -DABSL_ENABLE_INSTALL:BOOL=ON \ @@ -138,6 +141,7 @@ sed -r -i 's/\bSymbolizeWithMultipleMaps\b/DISABLED_&/' \ - Update to 20211102.0 (close RHBZ#2019691) - Drop --output-on-failure, already in %%ctest expansion - On s390x, instead of ignoring all tests, skip only the single failing test +- Use ninja backend for CMake: speeds up build with no downsides * Mon Jan 31 2022 Benjamin A. Beasley - 20210324.2-4 - Fix test failure (fix RHBZ#2045186) From c43daf75e50307a61f4a64f7d44b9e5ddff8a0d4 Mon Sep 17 00:00:00 2001 From: Benjamin A. Beasley Date: Feb 27 2022 18:48:55 +0000 Subject: [PATCH 5/5] Drop patch for armv7hl --- diff --git a/abseil-cpp-20210324.2-armv7.patch b/abseil-cpp-20210324.2-armv7.patch deleted file mode 100644 index 9a5eaec..0000000 --- a/abseil-cpp-20210324.2-armv7.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -up ./absl/base/internal/sysinfo_test.cc.armv7 ./absl/base/internal/sysinfo_test.cc ---- ./absl/base/internal/sysinfo_test.cc.armv7 2021-06-09 21:54:44.503755718 -0400 -+++ ./absl/base/internal/sysinfo_test.cc 2021-06-09 22:56:14.459611843 -0400 -@@ -43,13 +43,13 @@ TEST(SysinfoTest, NumCPUs) { - // 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__))) -+#if !(defined(__linux) && (defined(__ppc64__) || defined(__PPC64__) || defined(__aarch64__) || defined(__arm__))) - TEST(SysinfoTest, NominalCPUFrequency) { - // 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(__riscv) || defined(__s390x__)) || \ -+ defined(__riscv) || defined(__s390x__)) || \ - defined(__EMSCRIPTEN__) - EXPECT_EQ(NominalCPUFrequency(), 1.0) - << "CPU frequency detection was fixed! Please update unittest."; diff --git a/abseil-cpp.spec b/abseil-cpp.spec index 7d61aae..3569a65 100644 --- a/abseil-cpp.spec +++ b/abseil-cpp.spec @@ -10,14 +10,10 @@ License: ASL 2.0 URL: https://abseil.io Source0: https://github.com/abseil/abseil-cpp/archive/%{version}/%{name}-%{version}.tar.gz -# Disable CPU frequency detection on armv7hl architectures. -# Makes test consistent with aarch64 CPUs. -# Not submitted upstream. -Patch0: abseil-cpp-20210324.2-armv7.patch # Remove test assertions that use ::testing::Conditional, which is not in a # released version of GTest. Not submitted upstream, as this is a workaround # rather than a fix. https://github.com/abseil/abseil-cpp/issues/1063 -Patch1: abseil-cpp-20211102.0-gtest-unreleased-features.patch +Patch0: abseil-cpp-20211102.0-gtest-unreleased-features.patch BuildRequires: cmake # The default make backend would work just as well; ninja is observably faster @@ -142,6 +138,7 @@ sed -r -i 's/\bSymbolizeWithMultipleMaps\b/DISABLED_&/' \ - Drop --output-on-failure, already in %%ctest expansion - On s390x, instead of ignoring all tests, skip only the single failing test - Use ninja backend for CMake: speeds up build with no downsides +- Drop patch for armv7hl * Mon Jan 31 2022 Benjamin A. Beasley - 20210324.2-4 - Fix test failure (fix RHBZ#2045186)