From fbf44721a138bf40f2be613afdf630620d946104 Mon Sep 17 00:00:00 2001 From: Ayush Ranjan Date: Fri, 15 Apr 2022 10:16:04 -0700 Subject: [PATCH] Unblock buildkite tests. - Excludes a failing java runtime test. This is a known issue being tracked in b/228068134. Disable it to unblock submits. Should be unexcluded when the bug is fixed. - In upstream Linux, 6c25449e1a32 ("net: udp: fix alignment problem in udp4_seq_show()") updated the /pro/net/udp header to add another whitespace. But the other protocols (TCP, Raw, Ping) were not updated. gVisor produces this header in pkg/sentry/fsimpl/proc/task_net.go for all protocols. Instead of specially handling UDP in gVisor, just weaken the test for now. - It seems like there is Linux sendfile bug. A nonblocking pipe blocks on sendfile(2). Excluded the test from running natively for now. PiperOrigin-RevId: 442042678 --- test/runtimes/exclude/java17.csv | 1 + test/syscalls/linux/proc_net_udp.cc | 17 +++++++---------- test/syscalls/linux/sendfile.cc | 4 ++++ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/test/runtimes/exclude/java17.csv b/test/runtimes/exclude/java17.csv index 4bfb09729..f5b8ab2b0 100644 --- a/test/runtimes/exclude/java17.csv +++ b/test/runtimes/exclude/java17.csv @@ -50,6 +50,7 @@ java/net/MulticastSocket/TestDefaults.java,, java/net/MulticastSocket/TimeToLive.java,, java/net/NetworkInterface/NetworkInterfaceStreamTest.java,, java/net/Socket/LinkLocal.java,,java.net.SocketTimeoutException: Receive timed out +java/net/Socket/ReadAfterReset.java,b/228068134,java.lang.RuntimeException: Client read 0 expected 1000 java/net/Socket/SetSoLinger.java,b/78527327,SO_LINGER is not yet supported java/net/Socket/SocketAcceptInterruptTest.java,, java/net/Socket/SocketReadInterruptTest.java,, diff --git a/test/syscalls/linux/proc_net_udp.cc b/test/syscalls/linux/proc_net_udp.cc index 786b4b4af..26717866a 100644 --- a/test/syscalls/linux/proc_net_udp.cc +++ b/test/syscalls/linux/proc_net_udp.cc @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// Copyright 2022 The gVisor Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ #include #include "gtest/gtest.h" +#include "absl/strings/match.h" #include "absl/strings/numbers.h" #include "absl/strings/str_join.h" #include "absl/strings/str_split.h" @@ -34,9 +35,9 @@ using absl::StrCat; using absl::StrFormat; using absl::StrSplit; -constexpr char kProcNetUDPHeader[] = - " sl local_address rem_address st tx_queue rx_queue tr tm->when " - "retrnsmt uid timeout inode ref pointer drops "; +constexpr char kProcNetUDPHeaderSubStr[] = + "sl local_address rem_address st tx_queue rx_queue tr tm->when " + "retrnsmt uid timeout inode ref pointer drops"; // UDPEntry represents a single entry from /proc/net/udp. struct UDPEntry { @@ -120,12 +121,9 @@ PosixErrorOr> ProcNetUDPEntries() { bool found_header = false; std::vector entries; std::vector lines = StrSplit(content, '\n'); - std::cerr << "" << std::endl; for (const std::string& line : lines) { - std::cerr << line << std::endl; - if (!found_header) { - EXPECT_EQ(line, kProcNetUDPHeader); + EXPECT_TRUE(absl::StrContains(line, kProcNetUDPHeaderSubStr)); found_header = true; continue; } @@ -181,8 +179,7 @@ PosixErrorOr> ProcNetUDPEntries() { TEST(ProcNetUDP, Exists) { const std::string content = ASSERT_NO_ERRNO_AND_VALUE(GetContents("/proc/net/udp")); - const std::string header_line = StrCat(kProcNetUDPHeader, "\n"); - EXPECT_THAT(content, ::testing::StartsWith(header_line)); + EXPECT_TRUE(absl::StrContains(content, kProcNetUDPHeaderSubStr)); } TEST(ProcNetUDP, EntryUID) { diff --git a/test/syscalls/linux/sendfile.cc b/test/syscalls/linux/sendfile.cc index 9bd3bd5e8..6fa746221 100644 --- a/test/syscalls/linux/sendfile.cc +++ b/test/syscalls/linux/sendfile.cc @@ -474,6 +474,8 @@ TEST(SendFileTest, SendToNotARegularFile) { } TEST(SendFileTest, SendPipeWouldBlock) { + // This test fails on Linux, likely due to a Linux bug. + SKIP_IF(!IsRunningOnGvisor()); // Create temp file. constexpr char kData[] = "The fool doth think he is wise, but the wise man knows himself to be a " @@ -520,6 +522,8 @@ TEST(SendFileTest, SendPipeEOF) { } TEST(SendFileTest, SendToFullPipeReturnsEAGAIN) { + // This test fails on Linux, likely due to a Linux bug. + SKIP_IF(!IsRunningOnGvisor()); // Create and open an empty input file. const TempPath in_file = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFile()); const FileDescriptor in_fd =