summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux
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/syscalls/linux
parent5f13338d30fb59241cf7f1aa6374c54c69677314 (diff)
Remove syscall tests' dependency on glog
PiperOrigin-RevId: 245469859 Change-Id: I0610e477cc3a884275852e83028ecfb501f2c039
Diffstat (limited to 'test/syscalls/linux')
-rw-r--r--test/syscalls/linux/affinity.cc3
-rw-r--r--test/syscalls/linux/concurrency.cc1
-rw-r--r--test/syscalls/linux/exec.cc11
-rw-r--r--test/syscalls/linux/poll.cc4
-rw-r--r--test/syscalls/linux/proc.cc10
-rw-r--r--test/syscalls/linux/proc_pid_smaps.cc7
-rw-r--r--test/syscalls/linux/ptrace.cc3
-rw-r--r--test/syscalls/linux/sendfile_socket.cc6
-rw-r--r--test/syscalls/linux/socket_inet_loopback.cc3
-rw-r--r--test/syscalls/linux/socket_netlink_route.cc4
-rw-r--r--test/syscalls/linux/socket_unix_non_stream.cc8
11 files changed, 30 insertions, 30 deletions
diff --git a/test/syscalls/linux/affinity.cc b/test/syscalls/linux/affinity.cc
index 3b59d5777..81bd9bcb5 100644
--- a/test/syscalls/linux/affinity.cc
+++ b/test/syscalls/linux/affinity.cc
@@ -121,8 +121,7 @@ TEST_F(AffinityTest, SchedSetAffinityOnlyNonexistentCPUFails) {
// it's implicitly returned by raw sched_getaffinity syscall.
int cpu = cpuset_size_ * 8 - 1;
if (cpu <= NumCPUs()) {
- LOG(INFO) << "Skipping test: cpu " << cpu << " exists";
- return;
+ GTEST_SKIP() << "Skipping test: cpu " << cpu << " exists";
}
CPU_SET(cpu, &mask_);
EXPECT_THAT(
diff --git a/test/syscalls/linux/concurrency.cc b/test/syscalls/linux/concurrency.cc
index f5a941ca8..7978845c1 100644
--- a/test/syscalls/linux/concurrency.cc
+++ b/test/syscalls/linux/concurrency.cc
@@ -103,7 +103,6 @@ TEST(ConcurrencyTest, MultiProcessConcurrency) {
if (child_pid == 0) {
while (true) {
}
- __builtin_unreachable();
}
ASSERT_THAT(child_pid, SyscallSucceeds());
diff --git a/test/syscalls/linux/exec.cc b/test/syscalls/linux/exec.cc
index d5a938a98..30bc4b608 100644
--- a/test/syscalls/linux/exec.cc
+++ b/test/syscalls/linux/exec.cc
@@ -21,6 +21,7 @@
#include <sys/time.h>
#include <unistd.h>
+#include <iostream>
#include <memory>
#include <string>
#include <vector>
@@ -567,26 +568,26 @@ void ExecFromThread() {
bool ValidateProcCmdlineVsArgv(const int argc, const char* const* argv) {
auto contents_or = GetContents("/proc/self/cmdline");
if (!contents_or.ok()) {
- LOG(ERROR) << "Unable to get /proc/self/cmdline: " << contents_or.error();
+ std::cerr << "Unable to get /proc/self/cmdline: " << contents_or.error();
return false;
}
auto contents = contents_or.ValueOrDie();
if (contents.back() != '\0') {
- LOG(ERROR) << "Non-null terminated /proc/self/cmdline!";
+ std::cerr << "Non-null terminated /proc/self/cmdline!";
return false;
}
contents.pop_back();
std::vector<std::string> procfs_cmdline = absl::StrSplit(contents, '\0');
if (static_cast<int>(procfs_cmdline.size()) != argc) {
- LOG(ERROR) << "argc = " << argc << " != " << procfs_cmdline.size();
+ std::cerr << "argc = " << argc << " != " << procfs_cmdline.size();
return false;
}
for (int i = 0; i < argc; ++i) {
if (procfs_cmdline[i] != argv[i]) {
- LOG(ERROR) << "Procfs command line argument " << i << " mismatch "
- << procfs_cmdline[i] << " != " << argv[i];
+ std::cerr << "Procfs command line argument " << i << " mismatch "
+ << procfs_cmdline[i] << " != " << argv[i];
return false;
}
}
diff --git a/test/syscalls/linux/poll.cc b/test/syscalls/linux/poll.cc
index 67a86cc22..cd2161bb1 100644
--- a/test/syscalls/linux/poll.cc
+++ b/test/syscalls/linux/poll.cc
@@ -16,7 +16,9 @@
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/types.h>
+
#include <algorithm>
+#include <iostream>
#include "gtest/gtest.h"
#include "absl/synchronization/notification.h"
@@ -264,7 +266,7 @@ TEST_F(PollTest, Nfds) {
}
rlim_t max_fds = rlim.rlim_cur;
- LOG(INFO) << "Using limit: " << max_fds;
+ std::cout << "Using limit: " << max_fds;
// Create an eventfd. Since its value is initially zero, it is writable.
FileDescriptor efd = ASSERT_NO_ERRNO_AND_VALUE(NewEventFD());
diff --git a/test/syscalls/linux/proc.cc b/test/syscalls/linux/proc.cc
index 67d3d18c7..a55ecaef1 100644
--- a/test/syscalls/linux/proc.cc
+++ b/test/syscalls/linux/proc.cc
@@ -133,7 +133,6 @@ PosixError WithSubprocess(SubprocessCallback const& running,
while (true) {
SleepSafe(absl::Milliseconds(100));
}
- __builtin_unreachable();
}
close(pipe_fds[1]); // Close the write end.
@@ -565,12 +564,9 @@ TEST(ProcSelfMaps, MapUnmap) {
}
TEST(ProcSelfMaps, Mprotect) {
- if (!IsRunningOnGvisor()) {
- // FIXME: Linux's mprotect() sometimes fails to merge VMAs in this
- // case.
- LOG(WARNING) << "Skipping test on Linux";
- return;
- }
+ // FIXME: Linux's mprotect() sometimes fails to merge VMAs in this
+ // case.
+ SKIP_IF(!IsRunningOnGvisor());
// Reserve 5 pages of address space.
Mapping m = ASSERT_NO_ERRNO_AND_VALUE(
diff --git a/test/syscalls/linux/proc_pid_smaps.cc b/test/syscalls/linux/proc_pid_smaps.cc
index 4aefc1b41..5f9c42ce5 100644
--- a/test/syscalls/linux/proc_pid_smaps.cc
+++ b/test/syscalls/linux/proc_pid_smaps.cc
@@ -16,6 +16,7 @@
#include <stdint.h>
#include <algorithm>
+#include <iostream>
#include <string>
#include <utility>
#include <vector>
@@ -172,7 +173,7 @@ PosixErrorOr<std::vector<ProcPidSmapsEntry>> ParseProcPidSmaps(
return;
}
unknown_fields.insert(std::string(key));
- LOG(INFO) << "skipping unknown smaps field " << key;
+ std::cerr << "skipping unknown smaps field " << key;
};
auto lines = absl::StrSplit(contents, '\n', absl::SkipEmpty());
@@ -189,8 +190,8 @@ PosixErrorOr<std::vector<ProcPidSmapsEntry>> ParseProcPidSmaps(
// "key:value" (where value in practice will be preceded by a variable
// amount of whitespace).
if (!entry) {
- LOG(WARNING) << "smaps line not considered a maps line: "
- << maybe_maps_entry.error_message();
+ std::cerr << "smaps line not considered a maps line: "
+ << maybe_maps_entry.error_message();
return PosixError(
EINVAL,
absl::StrCat("smaps field line without preceding maps line: ", l));
diff --git a/test/syscalls/linux/ptrace.cc b/test/syscalls/linux/ptrace.cc
index 668d49128..7927b1697 100644
--- a/test/syscalls/linux/ptrace.cc
+++ b/test/syscalls/linux/ptrace.cc
@@ -22,6 +22,7 @@
#include <sys/wait.h>
#include <unistd.h>
+#include <iostream>
#include <utility>
#include "gmock/gmock.h"
@@ -1188,7 +1189,7 @@ TEST(PtraceTest, SeizeSetOptions) {
// gVisor is not susceptible to this race because
// kernel.Task.waitCollectTraceeStopLocked() checks specifically for an
// active ptraceStop, which is not initiated if SIGKILL is pending.
- LOG(INFO) << "Observed syscall-exit after SIGKILL";
+ std::cout << "Observed syscall-exit after SIGKILL";
ASSERT_THAT(waitpid(child_pid, &status, 0),
SyscallSucceedsWithValue(child_pid));
}
diff --git a/test/syscalls/linux/sendfile_socket.cc b/test/syscalls/linux/sendfile_socket.cc
index 7010dc211..e2ccf17ce 100644
--- a/test/syscalls/linux/sendfile_socket.cc
+++ b/test/syscalls/linux/sendfile_socket.cc
@@ -17,6 +17,8 @@
#include <sys/sendfile.h>
#include <sys/socket.h>
#include <unistd.h>
+
+#include <iostream>
#include <vector>
#include "gtest/gtest.h"
@@ -110,7 +112,7 @@ TEST(SendFileTest, SendMultiple) {
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr("127.0.0.1");
addr.sin_port = server_addr.sin_port;
- LOG(INFO) << "Connecting on port=" << server_addr.sin_port;
+ std::cout << "Connecting on port=" << server_addr.sin_port;
ASSERT_THAT(
RetryEINTR(connect)(
outf.get(), reinterpret_cast<struct sockaddr *>(&addr), sizeof(addr)),
@@ -119,7 +121,7 @@ TEST(SendFileTest, SendMultiple) {
int cnt = 0;
for (size_t sent = 0; sent < data.size(); cnt++) {
const size_t remain = data.size() - sent;
- LOG(INFO) << "sendfile, size=" << data.size() << ", sent=" << sent
+ std::cout << "sendfile, size=" << data.size() << ", sent=" << sent
<< ", remain=" << remain;
// Send data and verify that sendfile returns the correct value.
diff --git a/test/syscalls/linux/socket_inet_loopback.cc b/test/syscalls/linux/socket_inet_loopback.cc
index 4195e402c..a079b85dd 100644
--- a/test/syscalls/linux/socket_inet_loopback.cc
+++ b/test/syscalls/linux/socket_inet_loopback.cc
@@ -18,6 +18,7 @@
#include <sys/socket.h>
#include <atomic>
+#include <iostream>
#include <memory>
#include <string>
#include <tuple>
@@ -1025,7 +1026,7 @@ TEST_P(SocketMultiProtocolInetLoopbackTest, PortReuseTwoSockets) {
setsockopt(fd2, SOL_SOCKET, SO_REUSEPORT, &portreuse2, sizeof(int)),
SyscallSucceeds());
- LOG(INFO) << portreuse1 << " " << portreuse2;
+ std::cout << portreuse1 << " " << portreuse2;
int ret = bind(fd2, reinterpret_cast<sockaddr*>(&addr), addrlen);
// Verify that two sockets can be bound to the same port only if
diff --git a/test/syscalls/linux/socket_netlink_route.cc b/test/syscalls/linux/socket_netlink_route.cc
index fa895d841..50943d384 100644
--- a/test/syscalls/linux/socket_netlink_route.cc
+++ b/test/syscalls/linux/socket_netlink_route.cc
@@ -18,6 +18,8 @@
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
+
+#include <iostream>
#include <vector>
#include "gtest/gtest.h"
@@ -210,7 +212,7 @@ TEST(NetlinkRouteTest, GetLinkDump) {
ASSERT_GE(hdr->nlmsg_len, NLMSG_SPACE(sizeof(struct ifinfomsg)));
const struct ifinfomsg* msg =
reinterpret_cast<const struct ifinfomsg*>(NLMSG_DATA(hdr));
- LOG(INFO) << "Found interface idx=" << msg->ifi_index
+ std::cout << "Found interface idx=" << msg->ifi_index
<< ", type=" << std::hex << msg->ifi_type;
if (msg->ifi_type == ARPHRD_LOOPBACK) {
loopbackFound = true;
diff --git a/test/syscalls/linux/socket_unix_non_stream.cc b/test/syscalls/linux/socket_unix_non_stream.cc
index a84939011..8e0cbee4c 100644
--- a/test/syscalls/linux/socket_unix_non_stream.cc
+++ b/test/syscalls/linux/socket_unix_non_stream.cc
@@ -138,9 +138,7 @@ TEST_P(UnixNonStreamSocketPairTest, FragmentedSendMsg) {
//
// TODO: When internal UDS support SO_SNDBUF, we can assert that
// we always get the right SO_SNDBUF on gVisor.
- LOG(INFO) << "SO_SNDBUF = " << actual_sndbuf << ", want " << sndbuf
- << ". Skipping test";
- return;
+ GTEST_SKIP() << "SO_SNDBUF = " << actual_sndbuf << ", want " << sndbuf;
}
// Create a contiguous region of memory of 2*UIO_MAXIOV*PAGE_SIZE. We'll call
@@ -196,9 +194,7 @@ TEST_P(UnixNonStreamSocketPairTest, FragmentedRecvMsg) {
//
// TODO: When internal UDS support SO_SNDBUF, we can assert that
// we always get the right SO_SNDBUF on gVisor.
- LOG(INFO) << "SO_SNDBUF = " << actual_sndbuf << ", want " << sndbuf
- << ". Skipping test";
- return;
+ GTEST_SKIP() << "SO_SNDBUF = " << actual_sndbuf << ", want " << sndbuf;
}
std::vector<char> write_buf(buffer_size, 'a');