xref: /aosp_15_r20/external/federated-compute/fcp/patches/googletest.patch (revision 14675a029014e728ec732f129a32e299b2da0601)
1diff -Naur googletest-5a509dbd2e5a6c694116e329c5a20dc190653724/BUILD.bazel googletest.new/BUILD.bazel
2--- BUILD.bazel
3+++ BUILD.bazel
4@@ -159,11 +159,14 @@
5 cc_library(
6     name = "gtest_main",
7     srcs = ["googlemock/src/gmock_main.cc"],
8     features = select({
9         ":windows": ["windows_export_all_symbols"],
10         "//conditions:default": [],
11     }),
12-    deps = [":gtest"],
13+    deps = select({
14+        ":has_absl": ["@com_google_absl//absl/flags:parse"],
15+        "//conditions:default": [],
16+    }) + [":gtest"],
17 )
18
19 # The following rules build samples of how to use gTest.
20diff -Naur googletest-5a509dbd2e5a6c694116e329c5a20dc190653724/googlemock/src/gmock_main.cc googletest.new/googlemock/src/gmock_main.cc
21--- googlemock/src/gmock_main.cc
22+++ googlemock/src/gmock_main.cc
23@@ -32,6 +32,9 @@
24
25 #include <iostream>
26
27+#if GTEST_HAS_ABSL
28+#include "absl/flags/parse.h"
29+#endif  //  GTEST_HAS_ABSL
30 #include "gmock/gmock.h"
31 #include "gtest/gtest.h"
32
33@@ -70,6 +73,9 @@
34   // also responsible for initializing Google Test.  Therefore there's
35   // no need for calling testing::InitGoogleTest() separately.
36   testing::InitGoogleMock(&argc, argv);
37+#if GTEST_HAS_ABSL
38+  absl::ParseCommandLine(argc, argv);
39+#endif  //  GTEST_HAS_ABSL
40   return RUN_ALL_TESTS();
41 }
42 #endif
43diff -Naur googletest-5a509dbd2e5a6c694116e329c5a20dc190653724/googletest/src/gtest_main.cc googletest.new/googletest/src/gtest_main.cc
44--- googletest/src/gtest_main.cc
45+++ googletest/src/gtest_main.cc
46@@ -50,6 +50,9 @@
47 GTEST_API_ int main(int argc, char **argv) {
48   printf("Running main() from %s\n", __FILE__);
49   testing::InitGoogleTest(&argc, argv);
50+#if GTEST_HAS_ABSL
51+  absl::ParseCommandLine(argc, argv);
52+#endif  //  GTEST_HAS_ABSL
53   return RUN_ALL_TESTS();
54 }
55 #endif
56