From e0029cc0ff4b85479177a82e13809b6501809272 Mon Sep 17 00:00:00 2001 From: Lucas Manning Date: Tue, 5 Sep 2023 15:49:03 -0700 Subject: [PATCH] A few fixes to run tests on 6.2+ kernels * disable broken socket_inet_loopback test // Lucas Manning * disable lseek tests on anon inodes. They have been broken by commit e7478158e1378325907edfdd960eca98a1be405b Date: Wed Jun 29 15:06:57 2022 +0200 fs: clear or set FMODE_LSEEK based on llseek function * don't check memory.kmem.limit_in_bytes, it has been deprecated and dropped: commit 86327e8eb94c52eca4f93cfece2e29d1bf52acbf Date: Tue Jul 4 13:52:40 2023 +0200 memcg: drop kmem.limit_in_bytes commit 58056f77502f3567b760c9a8fc8d2e9081515b2d Date: Fri Nov 5 13:37:44 2021 -0700 memcg, kmem: further deprecate kmem.limit_in_bytes commit 0158115f702b0ba208ab0b5adf44cae99b3ebcc7 Date: Mon Sep 23 15:37:22 2019 -0700 memcg, kmem: deprecate kmem.limit_in_bytes PiperOrigin-RevId: 562915457 --- test/root/cgroup_test.go | 11 ----------- test/syscalls/linux/eventfd.cc | 3 +++ test/syscalls/linux/flock.cc | 2 +- test/syscalls/linux/inotify.cc | 3 +++ test/syscalls/linux/socket_inet_loopback.cc | 12 +++++++++--- test/syscalls/linux/timerfd.cc | 3 +++ 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/test/root/cgroup_test.go b/test/root/cgroup_test.go index de51b6561..f4133af67 100644 --- a/test/root/cgroup_test.go +++ b/test/root/cgroup_test.go @@ -203,13 +203,6 @@ func TestCgroupV1(t *testing.T) { file: "cpu.cfs_quota_us", want: "3000", }, - { - field: "kernel-memory", - value: 100 << 20, - ctrl: "memory", - file: "memory.kmem.limit_in_bytes", - want: "104857600", - }, { field: "memory", value: 1 << 30, @@ -270,8 +263,6 @@ func TestCgroupV1(t *testing.T) { hostconf.Resources.CPUPeriod = attr.value case "cpu-quota": hostconf.Resources.CPUQuota = attr.value - case "kernel-memory": - hostconf.Resources.KernelMemory = attr.value case "memory": hostconf.Resources.Memory = attr.value case "memory-reservation": @@ -440,8 +431,6 @@ func TestCgroupV2(t *testing.T) { hostconf.Resources.CPUQuota = defaultTestCPUQuota case "cpu-quota": hostconf.Resources.CPUQuota = attr.value - case "kernel-memory": - hostconf.Resources.KernelMemory = attr.value case "memory": hostconf.Resources.Memory = attr.value case "memory-reservation": diff --git a/test/syscalls/linux/eventfd.cc b/test/syscalls/linux/eventfd.cc index b646d18b3..898ae3881 100644 --- a/test/syscalls/linux/eventfd.cc +++ b/test/syscalls/linux/eventfd.cc @@ -101,6 +101,9 @@ TEST(EventfdTest, SmallRead) { } TEST(EventfdTest, IllegalSeek) { + // TODO: b/298787679 - this test fails on 6.0+ kernels. + SKIP_IF(!IsRunningOnGvisor()); + FileDescriptor efd = ASSERT_NO_ERRNO_AND_VALUE(NewEventFD(0, 0)); EXPECT_THAT(lseek(efd.get(), 0, SEEK_SET), SyscallFailsWithErrno(ESPIPE)); } diff --git a/test/syscalls/linux/flock.cc b/test/syscalls/linux/flock.cc index 54b09de69..8293ea6f4 100644 --- a/test/syscalls/linux/flock.cc +++ b/test/syscalls/linux/flock.cc @@ -652,7 +652,7 @@ TEST_F(FlockTest, BlockingLockFirstExclusiveSecondExclusive) { TEST(FlockTestNoFixture, BadFD) { // EBADF: fd is not an open file descriptor. - ASSERT_THAT(flock(-1, 0), SyscallFailsWithErrno(EBADF)); + ASSERT_THAT(flock(-1, LOCK_UN), SyscallFailsWithErrno(EBADF)); } TEST(FlockTestNoFixture, FlockDir) { diff --git a/test/syscalls/linux/inotify.cc b/test/syscalls/linux/inotify.cc index 07fd89c63..b64c8d87e 100644 --- a/test/syscalls/linux/inotify.cc +++ b/test/syscalls/linux/inotify.cc @@ -333,6 +333,9 @@ PosixErrorOr InotifyAddWatch(int fd, const std::string& path, } TEST(Inotify, IllegalSeek) { + // TODO: b/298787679 - this test fails on 6.0+ kernels. + SKIP_IF(!IsRunningOnGvisor()); + const FileDescriptor fd = ASSERT_NO_ERRNO_AND_VALUE(InotifyInit1(0)); EXPECT_THAT(lseek(fd.get(), 0, SEEK_SET), SyscallFailsWithErrno(ESPIPE)); } diff --git a/test/syscalls/linux/socket_inet_loopback.cc b/test/syscalls/linux/socket_inet_loopback.cc index 9a62ce2bc..84b3460fb 100644 --- a/test/syscalls/linux/socket_inet_loopback.cc +++ b/test/syscalls/linux/socket_inet_loopback.cc @@ -1868,7 +1868,9 @@ INSTANTIATE_TEST_SUITE_P( using SocketMultiProtocolInetLoopbackTest = ::testing::TestWithParam; -TEST_P(SocketMultiProtocolInetLoopbackTest, V4MappedLoopbackOnlyReservesV4) { +// TODO: b/298680322 - Investigate why this fails on newer kernel versions. +TEST_P(SocketMultiProtocolInetLoopbackTest, + DISABLED_V4MappedLoopbackOnlyReservesV4) { ProtocolTestParam const& param = GetParam(); for (int i = 0; true; i++) { @@ -1917,7 +1919,9 @@ TEST_P(SocketMultiProtocolInetLoopbackTest, V4MappedLoopbackOnlyReservesV4) { } } -TEST_P(SocketMultiProtocolInetLoopbackTest, V4MappedAnyOnlyReservesV4) { +// TODO: b/298680322 - Investigate why this fails on newer kernel versions. +TEST_P(SocketMultiProtocolInetLoopbackTest, + DISABLED_V4MappedAnyOnlyReservesV4) { ProtocolTestParam const& param = GetParam(); for (int i = 0; true; i++) { @@ -2310,7 +2314,9 @@ TEST_P(SocketMultiProtocolInetLoopbackTest, V6EphemeralPortReserved) { } } -TEST_P(SocketMultiProtocolInetLoopbackTest, V4MappedEphemeralPortReserved) { +// TODO: b/298680322 - Investigate why this fails on newer kernel versions. +TEST_P(SocketMultiProtocolInetLoopbackTest, + DISABLED_V4MappedEphemeralPortReserved) { ProtocolTestParam const& param = GetParam(); for (int i = 0; true; i++) { diff --git a/test/syscalls/linux/timerfd.cc b/test/syscalls/linux/timerfd.cc index 279e5b596..5a65463fb 100644 --- a/test/syscalls/linux/timerfd.cc +++ b/test/syscalls/linux/timerfd.cc @@ -218,6 +218,9 @@ TEST_P(TimerfdTest, SetToPastExpiresEventually) { } TEST_P(TimerfdTest, IllegalSeek) { + // TODO: b/298787679 - this test fails on 6.0+ kernels. + SKIP_IF(!IsRunningOnGvisor()); + auto const tfd = ASSERT_NO_ERRNO_AND_VALUE(TimerfdCreate(GetParam(), 0)); EXPECT_THAT(lseek(tfd.get(), 0, SEEK_SET), SyscallFailsWithErrno(ESPIPE)); }