Move over to ABSL logging and flags.
Removes gperftools too since that wants gflags.
Here come the fireworks.
Change-Id: I79cb7bcf60f1047fbfa28bfffc21a0fd692e4b1c
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/testing/BUILD b/aos/testing/BUILD
index 729c978..52fa271 100644
--- a/aos/testing/BUILD
+++ b/aos/testing/BUILD
@@ -12,8 +12,9 @@
deps = [
"//aos:init",
"//aos/testing:tmpdir",
- "@com_github_gflags_gflags//:gflags",
- "@com_github_google_glog//:glog",
+ "@com_google_absl//absl/flags:flag",
+ "@com_google_absl//absl/log",
+ "@com_google_absl//absl/log:check",
"@com_google_googletest//:gtest",
],
)
@@ -62,7 +63,8 @@
target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
- "@com_github_google_glog//:glog",
+ "@com_google_absl//absl/log",
+ "@com_google_absl//absl/log:check",
],
)
diff --git a/aos/testing/gtest_main.cc b/aos/testing/gtest_main.cc
index 1940988..ecf2889 100644
--- a/aos/testing/gtest_main.cc
+++ b/aos/testing/gtest_main.cc
@@ -1,14 +1,15 @@
-#include "gflags/gflags.h"
-#include "glog/logging.h"
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
#include "gtest/gtest.h"
#include "aos/init.h"
#include "aos/testing/tmpdir.h"
-DEFINE_bool(print_logs, false,
- "Print the log messages as they are being generated.");
-DEFINE_string(log_file, "",
- "Print all log messages to FILE instead of standard output.");
+ABSL_FLAG(bool, print_logs, false,
+ "Print the log messages as they are being generated.");
+ABSL_FLAG(std::string, log_file, "",
+ "Print all log messages to FILE instead of standard output.");
namespace aos::testing {
@@ -20,22 +21,20 @@
GTEST_API_ int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
- FLAGS_logtostderr = true;
-
aos::InitGoogle(&argc, &argv);
- if (FLAGS_print_logs) {
+ if (absl::GetFlag(FLAGS_print_logs)) {
if (::aos::testing::ForcePrintLogsDuringTests) {
::aos::testing::ForcePrintLogsDuringTests();
}
}
- if (!FLAGS_log_file.empty()) {
+ if (!absl::GetFlag(FLAGS_log_file).empty()) {
if (::aos::testing::ForcePrintLogsDuringTests) {
::aos::testing::ForcePrintLogsDuringTests();
}
if (::aos::testing::SetLogFileName) {
- ::aos::testing::SetLogFileName(FLAGS_log_file.c_str());
+ ::aos::testing::SetLogFileName(absl::GetFlag(FLAGS_log_file).c_str());
}
}
diff --git a/aos/testing/prevent_exit.cc b/aos/testing/prevent_exit.cc
index 7c8da60..a475e45 100644
--- a/aos/testing/prevent_exit.cc
+++ b/aos/testing/prevent_exit.cc
@@ -4,7 +4,8 @@
#include <cstdlib>
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
namespace aos::testing {
namespace {
diff --git a/aos/testing/tmpdir.cc b/aos/testing/tmpdir.cc
index 0953a21..0aa00ea 100644
--- a/aos/testing/tmpdir.cc
+++ b/aos/testing/tmpdir.cc
@@ -3,6 +3,8 @@
#include <cstdlib>
#include <string>
+#include "absl/flags/flag.h"
+
#include "aos/ipc_lib/shm_base.h"
namespace aos::testing {
@@ -19,6 +21,8 @@
std::string TestTmpDir() { return TestTmpDirOr("/tmp"); }
-void SetTestShmBase() { SetShmBase(TestTmpDirOr(FLAGS_shm_base)); }
+void SetTestShmBase() {
+ SetShmBase(TestTmpDirOr(absl::GetFlag(FLAGS_shm_base)));
+}
} // namespace aos::testing