From 59442238d4d9e48433cd0601ffa53e280fb872bc Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Fri, 26 Apr 2019 12:46:14 -0700 Subject: Remove syscall tests' dependency on glog PiperOrigin-RevId: 245469859 Change-Id: I0610e477cc3a884275852e83028ecfb501f2c039 --- test/util/BUILD | 1 - test/util/capability_util.cc | 6 ++++-- test/util/proc_util.cc | 3 ++- test/util/temp_path.cc | 8 +++++--- test/util/test_util.cc | 7 ++++--- test/util/test_util.h | 10 +++------- 6 files changed, 18 insertions(+), 17 deletions(-) (limited to 'test/util') diff --git a/test/util/BUILD b/test/util/BUILD index fac0730b4..a4b47de56 100644 --- a/test/util/BUILD +++ b/test/util/BUILD @@ -226,7 +226,6 @@ cc_library( "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/time", - "@com_google_glog//:glog", "@com_google_googletest//:gtest", ], ) diff --git a/test/util/capability_util.cc b/test/util/capability_util.cc index 0656775d6..d1dd95e76 100644 --- a/test/util/capability_util.cc +++ b/test/util/capability_util.cc @@ -19,6 +19,8 @@ #include #include +#include + #include "absl/strings/str_cat.h" #include "test/util/memory_util.h" #include "test/util/posix_error.h" @@ -61,13 +63,13 @@ PosixErrorOr CanCreateUserNamespace() { // is in a chroot environment (i.e., the caller's root directory does // not match the root directory of the mount namespace in which it // resides)." - LOG(INFO) << "clone(CLONE_NEWUSER) failed with EPERM"; + std::cerr << "clone(CLONE_NEWUSER) failed with EPERM"; return false; } else if (errno == EUSERS) { // "(since Linux 3.11) CLONE_NEWUSER was specified in flags, and the call // would cause the limit on the number of nested user namespaces to be // exceeded. See user_namespaces(7)." - LOG(INFO) << "clone(CLONE_NEWUSER) failed with EUSERS"; + std::cerr << "clone(CLONE_NEWUSER) failed with EUSERS"; return false; } else { // Unexpected error code; indicate an actual error. diff --git a/test/util/proc_util.cc b/test/util/proc_util.cc index 7ebce0759..2d9eb1986 100644 --- a/test/util/proc_util.cc +++ b/test/util/proc_util.cc @@ -15,6 +15,7 @@ #include "test/util/proc_util.h" #include +#include #include #include "absl/strings/ascii.h" @@ -86,7 +87,7 @@ PosixErrorOr> ParseProcMaps( std::vector entries; auto lines = absl::StrSplit(contents, '\n', absl::SkipEmpty()); for (const auto& l : lines) { - LOG(INFO) << "line: " << l; + std::cout << "line: " << l; ASSIGN_OR_RETURN_ERRNO(auto entry, ParseProcMapsLine(l)); entries.push_back(entry); } diff --git a/test/util/temp_path.cc b/test/util/temp_path.cc index 11c14fb1a..48ce82d20 100644 --- a/test/util/temp_path.cc +++ b/test/util/temp_path.cc @@ -15,8 +15,10 @@ #include "test/util/temp_path.h" #include + #include #include +#include #include "gtest/gtest.h" #include "absl/time/clock.h" @@ -52,9 +54,9 @@ void TryDeleteRecursively(std::string const& path) { int undeleted_files = 0; auto status = RecursivelyDelete(path, &undeleted_dirs, &undeleted_files); if (undeleted_dirs || undeleted_files || !status.ok()) { - LOG(WARNING) << path << ": failed to delete " << undeleted_dirs - << " directories and " << undeleted_files - << " files: " << status; + std::cerr << path << ": failed to delete " << undeleted_dirs + << " directories and " << undeleted_files + << " files: " << status; } } } diff --git a/test/util/test_util.cc b/test/util/test_util.cc index ebcbca238..9b7cfa4dc 100644 --- a/test/util/test_util.cc +++ b/test/util/test_util.cc @@ -25,6 +25,7 @@ #include #include +#include #include #include "absl/base/attributes.h" @@ -54,8 +55,8 @@ Platform GvisorPlatform() { if (strcmp(env, "kvm") == 0) { return Platform::kKVM; } - LOG(FATAL) << "unknown platform " << env; - __builtin_unreachable(); + std::cerr << "unknown platform " << env; + abort(); } // Inline cpuid instruction. Preserve %ebx/%rbx register. In PIC compilations @@ -227,7 +228,7 @@ void SleepSafe(absl::Duration duration) { uint64_t Megabytes(uint64_t n) { // Overflow check, upper 20 bits in n shouldn't be set. - CHECK(!(0xfffff00000000000 & n)); + TEST_CHECK(!(0xfffff00000000000 & n)); return n << 20; } diff --git a/test/util/test_util.h b/test/util/test_util.h index 6f2fa4875..905412b24 100644 --- a/test/util/test_util.h +++ b/test/util/test_util.h @@ -186,7 +186,6 @@ #include #include -#include #include "gmock/gmock.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" @@ -210,12 +209,9 @@ void TestInit(int* argc, char*** argv); // SKIP_IF may be used to skip a test case. // // These cases are still emitted, but a SKIPPED line will appear. -#define SKIP_IF(expr) \ - do { \ - if (expr) { \ - std::cout << "\033[0;33m[ SKIPPED ]\033[m => " << #expr << std::endl; \ - return; \ - } \ +#define SKIP_IF(expr) \ + do { \ + if (expr) GTEST_SKIP() << #expr; \ } while (0) enum class Platform { -- cgit v1.2.3