summaryrefslogtreecommitdiffhomepage
path: root/test/util
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@google.com>2019-04-26 12:46:14 -0700
committerShentubot <shentubot@google.com>2019-04-26 12:47:46 -0700
commit59442238d4d9e48433cd0601ffa53e280fb872bc (patch)
tree0857202d3ffeb4255d872507c4e6baf9329e4a1e /test/util
parent5f13338d30fb59241cf7f1aa6374c54c69677314 (diff)
Remove syscall tests' dependency on glog
PiperOrigin-RevId: 245469859 Change-Id: I0610e477cc3a884275852e83028ecfb501f2c039
Diffstat (limited to 'test/util')
-rw-r--r--test/util/BUILD1
-rw-r--r--test/util/capability_util.cc6
-rw-r--r--test/util/proc_util.cc3
-rw-r--r--test/util/temp_path.cc8
-rw-r--r--test/util/test_util.cc7
-rw-r--r--test/util/test_util.h10
6 files changed, 18 insertions, 17 deletions
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 <sys/mman.h>
#include <sys/wait.h>
+#include <iostream>
+
#include "absl/strings/str_cat.h"
#include "test/util/memory_util.h"
#include "test/util/posix_error.h"
@@ -61,13 +63,13 @@ PosixErrorOr<bool> 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 <algorithm>
+#include <iostream>
#include <vector>
#include "absl/strings/ascii.h"
@@ -86,7 +87,7 @@ PosixErrorOr<std::vector<ProcMapsEntry>> ParseProcMaps(
std::vector<ProcMapsEntry> 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 <unistd.h>
+
#include <atomic>
#include <cstdlib>
+#include <iostream>
#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 <unistd.h>
#include <ctime>
+#include <iostream>
#include <vector>
#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 <vector>
#include <gflags/gflags.h>
-#include <glog/logging.h>
#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 {