summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--WORKSPACE19
-rw-r--r--absl/flags/CMakeLists.txt2
-rw-r--r--absl/flags/internal/usage_test.cc18
-rw-r--r--ci/cmake_common.sh2
4 files changed, 29 insertions, 12 deletions
diff --git a/WORKSPACE b/WORKSPACE
index 1a1753a8..3c4d397b 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -20,11 +20,20 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# GoogleTest/GoogleMock framework. Used by most unit-tests.
http_archive(
- name = "com_google_googletest", # 2022-01-28T15:27:11Z
- sha256 = "eb70a6d4520f940956a6b3e37d205d92736bb104c6a1b2b9f82bfc41bd7a2b34",
- strip_prefix = "googletest-28e1da21d8d677bc98f12ccc7fc159ff19e8e817",
- # Keep this URL in sync with ABSL_GOOGLETEST_COMMIT in ci/cmake_common.sh.
- urls = ["https://github.com/google/googletest/archive/28e1da21d8d677bc98f12ccc7fc159ff19e8e817.zip"],
+ name = "com_google_googletest", # 2022-06-01T21:08:04Z
+ sha256 = "df6cad4bf17df72d8d86306628701c01a45b9e001c7f2a3b28971c7e24b1035b",
+ strip_prefix = "googletest-0320f517fd920866d918e564105d68fd4362040a",
+ urls = ["https://github.com/google/googletest/archive/0320f517fd920866d918e564105d68fd4362040a.zip"],
+)
+
+# RE2 (the regular expression library used by GoogleTest)
+# Note this must use a commit from the `abseil` branch of the RE2 project.
+# https://github.com/google/re2/tree/abseil
+http_archive(
+ name = "com_googlesource_code_re2", # 2022-04-08
+ sha256 = "906d0df8ff48f8d3a00a808827f009a840190f404559f649cb8e4d7143255ef9",
+ strip_prefix = "re2-a276a8c738735a0fe45a6ee590fe2df69bcf4502",
+ urls = ["https://github.com/google/re2/archive/a276a8c738735a0fe45a6ee590fe2df69bcf4502.zip"],
)
# Google benchmark.
diff --git a/absl/flags/CMakeLists.txt b/absl/flags/CMakeLists.txt
index 79e51a11..3e9d5adf 100644
--- a/absl/flags/CMakeLists.txt
+++ b/absl/flags/CMakeLists.txt
@@ -466,5 +466,5 @@ absl_cc_test(
absl::flags_reflection
absl::flags_usage
absl::strings
- GTest::gtest
+ GTest::gmock
)
diff --git a/absl/flags/internal/usage_test.cc b/absl/flags/internal/usage_test.cc
index 6a65a1a3..209a7be9 100644
--- a/absl/flags/internal/usage_test.cc
+++ b/absl/flags/internal/usage_test.cc
@@ -20,6 +20,7 @@
#include <sstream>
#include <string>
+#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/flags/flag.h"
#include "absl/flags/internal/parse.h"
@@ -105,14 +106,19 @@ class UsageReportingTest : public testing::Test {
using UsageReportingDeathTest = UsageReportingTest;
TEST_F(UsageReportingDeathTest, TestSetProgramUsageMessage) {
+#if !defined(GTEST_HAS_ABSL) || !GTEST_HAS_ABSL
+ // Check for kTestUsageMessage set in main() below.
EXPECT_EQ(absl::ProgramUsageMessage(), kTestUsageMessage);
+#else
+ // Check for part of the usage message set by GoogleTest.
+ EXPECT_THAT(absl::ProgramUsageMessage(),
+ ::testing::HasSubstr(
+ "This program contains tests written using Google Test"));
+#endif
-#ifndef _WIN32
- // TODO(rogeeff): figure out why this does not work on Windows.
EXPECT_DEATH_IF_SUPPORTED(
absl::SetProgramUsageMessage("custom usage message"),
- ".*SetProgramUsageMessage\\(\\) called twice.*");
-#endif
+ ::testing::HasSubstr("SetProgramUsageMessage() called twice"));
}
// --------------------------------------------------------------------
@@ -489,8 +495,10 @@ path.
int main(int argc, char* argv[]) {
(void)absl::GetFlag(FLAGS_undefok); // Force linking of parse.cc
flags::SetProgramInvocationName("usage_test");
+#if !defined(GTEST_HAS_ABSL) || !GTEST_HAS_ABSL
+ // GoogleTest calls absl::SetProgramUsageMessage() already.
absl::SetProgramUsageMessage(kTestUsageMessage);
+#endif
::testing::InitGoogleTest(&argc, argv);
-
return RUN_ALL_TESTS();
}
diff --git a/ci/cmake_common.sh b/ci/cmake_common.sh
index 8a93389b..de0e9092 100644
--- a/ci/cmake_common.sh
+++ b/ci/cmake_common.sh
@@ -14,7 +14,7 @@
# The commit of GoogleTest to be used in the CMake tests in this directory.
# Keep this in sync with the commit in the WORKSPACE file.
-readonly ABSL_GOOGLETEST_COMMIT="28e1da21d8d677bc98f12ccc7fc159ff19e8e817"
+readonly ABSL_GOOGLETEST_COMMIT="0320f517fd920866d918e564105d68fd4362040a"
# Avoid depending on GitHub by looking for a cached copy of the commit first.
if [[ -r "${KOKORO_GFILE_DIR:-}/distdir/${ABSL_GOOGLETEST_COMMIT}.zip" ]]; then