Remove _NoRandomSave tests.
We do not currently run random save tests. PiperOrigin-RevId: 368309921
This commit is contained in:
parent
326394b79a
commit
e83cc06f1b
|
@ -67,7 +67,7 @@ TEST_P(AllSocketPairTest, ListenDecreaseBacklog) {
|
|||
SyscallSucceeds());
|
||||
}
|
||||
|
||||
TEST_P(AllSocketPairTest, ListenBacklogSizes_NoRandomSave) {
|
||||
TEST_P(AllSocketPairTest, ListenBacklogSizes) {
|
||||
DisableSave ds;
|
||||
auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair());
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ void do_nothing_handler(int sig, siginfo_t* siginfo, void* arg) {}
|
|||
|
||||
// No random save as the test relies on alarm timing. Cooperative save tests
|
||||
// already cover the save between alarm and read.
|
||||
TEST(AlarmTest, Interrupt_NoRandomSave) {
|
||||
TEST(AlarmTest, Interrupt) {
|
||||
int pipe_fds[2];
|
||||
ASSERT_THAT(pipe(pipe_fds), SyscallSucceeds());
|
||||
|
||||
|
@ -71,7 +71,7 @@ void inc_alarms_handler(int sig, siginfo_t* siginfo, void* arg) {
|
|||
|
||||
// No random save as the test relies on alarm timing. Cooperative save tests
|
||||
// already cover the save between alarm and read.
|
||||
TEST(AlarmTest, Restart_NoRandomSave) {
|
||||
TEST(AlarmTest, Restart) {
|
||||
alarms_received = 0;
|
||||
|
||||
int pipe_fds[2];
|
||||
|
@ -114,7 +114,7 @@ TEST(AlarmTest, Restart_NoRandomSave) {
|
|||
|
||||
// No random save as the test relies on alarm timing. Cooperative save tests
|
||||
// already cover the save between alarm and pause.
|
||||
TEST(AlarmTest, SaSiginfo_NoRandomSave) {
|
||||
TEST(AlarmTest, SaSiginfo) {
|
||||
// Use a signal handler that interrupts but does nothing rather than using the
|
||||
// default terminate action.
|
||||
struct sigaction sa;
|
||||
|
@ -134,7 +134,7 @@ TEST(AlarmTest, SaSiginfo_NoRandomSave) {
|
|||
|
||||
// No random save as the test relies on alarm timing. Cooperative save tests
|
||||
// already cover the save between alarm and pause.
|
||||
TEST(AlarmTest, SaInterrupt_NoRandomSave) {
|
||||
TEST(AlarmTest, SaInterrupt) {
|
||||
// Use a signal handler that interrupts but does nothing rather than using the
|
||||
// default terminate action.
|
||||
struct sigaction sa;
|
||||
|
|
|
@ -53,7 +53,7 @@ TEST(ChmodTest, ChmodDirSucceeds) {
|
|||
EXPECT_THAT(open(fileInDir.c_str(), O_RDONLY), SyscallFailsWithErrno(EACCES));
|
||||
}
|
||||
|
||||
TEST(ChmodTest, FchmodFileSucceeds_NoRandomSave) {
|
||||
TEST(ChmodTest, FchmodFileSucceeds) {
|
||||
// Drop capabilities that allow us to file directory permissions.
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_OVERRIDE, false));
|
||||
|
||||
|
@ -70,7 +70,7 @@ TEST(ChmodTest, FchmodFileSucceeds_NoRandomSave) {
|
|||
EXPECT_THAT(open(file.path().c_str(), O_RDWR), SyscallFailsWithErrno(EACCES));
|
||||
}
|
||||
|
||||
TEST(ChmodTest, FchmodDirSucceeds_NoRandomSave) {
|
||||
TEST(ChmodTest, FchmodDirSucceeds) {
|
||||
// Drop capabilities that allow us to override file and directory permissions.
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_OVERRIDE, false));
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_READ_SEARCH, false));
|
||||
|
@ -212,7 +212,7 @@ TEST(ChmodTest, FchmodatDir) {
|
|||
SyscallFailsWithErrno(EACCES));
|
||||
}
|
||||
|
||||
TEST(ChmodTest, ChmodDowngradeWritability_NoRandomSave) {
|
||||
TEST(ChmodTest, ChmodDowngradeWritability) {
|
||||
auto file = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFileMode(0666));
|
||||
|
||||
int fd;
|
||||
|
@ -238,7 +238,7 @@ TEST(ChmodTest, ChmodFileToNoPermissionsSucceeds) {
|
|||
SyscallFailsWithErrno(EACCES));
|
||||
}
|
||||
|
||||
TEST(ChmodTest, FchmodDowngradeWritability_NoRandomSave) {
|
||||
TEST(ChmodTest, FchmodDowngradeWritability) {
|
||||
auto file = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFile());
|
||||
|
||||
int fd;
|
||||
|
@ -252,7 +252,7 @@ TEST(ChmodTest, FchmodDowngradeWritability_NoRandomSave) {
|
|||
EXPECT_THAT(close(fd), SyscallSucceeds());
|
||||
}
|
||||
|
||||
TEST(ChmodTest, FchmodFileToNoPermissionsSucceeds_NoRandomSave) {
|
||||
TEST(ChmodTest, FchmodFileToNoPermissionsSucceeds) {
|
||||
// Drop capabilities that allow us to override file permissions.
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_OVERRIDE, false));
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_READ_SEARCH, false));
|
||||
|
|
|
@ -117,7 +117,7 @@ TEST(DevTest, ReadDevNull) {
|
|||
}
|
||||
|
||||
// Do not allow random save as it could lead to partial reads.
|
||||
TEST(DevTest, ReadDevZero_NoRandomSave) {
|
||||
TEST(DevTest, ReadDevZero) {
|
||||
const FileDescriptor fd =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(Open("/dev/zero", O_RDONLY));
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ TEST(EpollTest, LastNonWritable) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(EpollTest, Timeout_NoRandomSave) {
|
||||
TEST(EpollTest, Timeout) {
|
||||
auto epollfd = ASSERT_NO_ERRNO_AND_VALUE(NewEpollFD());
|
||||
std::vector<FileDescriptor> eventfds;
|
||||
for (int i = 0; i < kFDsPerEpoll; i++) {
|
||||
|
@ -290,7 +290,7 @@ TEST(EpollTest, Oneshot) {
|
|||
SyscallSucceedsWithValue(0));
|
||||
}
|
||||
|
||||
TEST(EpollTest, EdgeTriggered_NoRandomSave) {
|
||||
TEST(EpollTest, EdgeTriggered) {
|
||||
// Test edge-triggered entry: make it edge-triggered, first wait should
|
||||
// return it, second one should time out, make it writable again, third wait
|
||||
// should return it, fourth wait should timeout.
|
||||
|
|
|
@ -175,7 +175,7 @@ TEST(EventfdTest, SpliceFromPipePartialSucceeds) {
|
|||
}
|
||||
|
||||
// NotifyNonZero is inherently racy, so random save is disabled.
|
||||
TEST(EventfdTest, NotifyNonZero_NoRandomSave) {
|
||||
TEST(EventfdTest, NotifyNonZero) {
|
||||
// Waits will time out at 10 seconds.
|
||||
constexpr int kEpollTimeoutMs = 10000;
|
||||
// Create an eventfd descriptor.
|
||||
|
|
|
@ -205,7 +205,7 @@ TEST_F(FlockTest, TestSharedLockFailExclusiveHolderNonblocking) {
|
|||
|
||||
void trivial_handler(int signum) {}
|
||||
|
||||
TEST_F(FlockTest, TestSharedLockFailExclusiveHolderBlocking_NoRandomSave) {
|
||||
TEST_F(FlockTest, TestSharedLockFailExclusiveHolderBlocking) {
|
||||
const DisableSave ds; // Timing-related.
|
||||
|
||||
// This test will verify that a shared lock is denied while
|
||||
|
@ -262,7 +262,7 @@ TEST_F(FlockTest, TestExclusiveLockFailExclusiveHolderNonblocking) {
|
|||
ASSERT_THAT(flock(test_file_fd_.get(), LOCK_UN), SyscallSucceedsWithValue(0));
|
||||
}
|
||||
|
||||
TEST_F(FlockTest, TestExclusiveLockFailExclusiveHolderBlocking_NoRandomSave) {
|
||||
TEST_F(FlockTest, TestExclusiveLockFailExclusiveHolderBlocking) {
|
||||
const DisableSave ds; // Timing-related.
|
||||
|
||||
// This test will verify that an exclusive lock is denied while
|
||||
|
@ -499,7 +499,7 @@ TEST_F(FlockTest, TestDupFdFollowedByLock) {
|
|||
// NOTE: These blocking tests are not perfect. Unfortunately it's very hard to
|
||||
// determine if a thread was actually blocked in the kernel so we're forced
|
||||
// to use timing.
|
||||
TEST_F(FlockTest, BlockingLockNoBlockingForSharedLocks_NoRandomSave) {
|
||||
TEST_F(FlockTest, BlockingLockNoBlockingForSharedLocks) {
|
||||
// This test will verify that although LOCK_NB isn't specified
|
||||
// two different fds can obtain shared locks without blocking.
|
||||
ASSERT_THAT(flock(test_file_fd_.get(), LOCK_SH), SyscallSucceeds());
|
||||
|
@ -539,7 +539,7 @@ TEST_F(FlockTest, BlockingLockNoBlockingForSharedLocks_NoRandomSave) {
|
|||
EXPECT_THAT(flock(test_file_fd_.get(), LOCK_UN), SyscallSucceeds());
|
||||
}
|
||||
|
||||
TEST_F(FlockTest, BlockingLockFirstSharedSecondExclusive_NoRandomSave) {
|
||||
TEST_F(FlockTest, BlockingLockFirstSharedSecondExclusive) {
|
||||
// This test will verify that if someone holds a shared lock any attempt to
|
||||
// obtain an exclusive lock will result in blocking.
|
||||
ASSERT_THAT(flock(test_file_fd_.get(), LOCK_SH), SyscallSucceeds());
|
||||
|
@ -576,7 +576,7 @@ TEST_F(FlockTest, BlockingLockFirstSharedSecondExclusive_NoRandomSave) {
|
|||
EXPECT_THAT(flock(test_file_fd_.get(), LOCK_UN), SyscallSucceeds());
|
||||
}
|
||||
|
||||
TEST_F(FlockTest, BlockingLockFirstExclusiveSecondShared_NoRandomSave) {
|
||||
TEST_F(FlockTest, BlockingLockFirstExclusiveSecondShared) {
|
||||
// This test will verify that if someone holds an exclusive lock any attempt
|
||||
// to obtain a shared lock will result in blocking.
|
||||
ASSERT_THAT(flock(test_file_fd_.get(), LOCK_EX), SyscallSucceeds());
|
||||
|
@ -613,7 +613,7 @@ TEST_F(FlockTest, BlockingLockFirstExclusiveSecondShared_NoRandomSave) {
|
|||
EXPECT_THAT(flock(test_file_fd_.get(), LOCK_UN), SyscallSucceeds());
|
||||
}
|
||||
|
||||
TEST_F(FlockTest, BlockingLockFirstExclusiveSecondExclusive_NoRandomSave) {
|
||||
TEST_F(FlockTest, BlockingLockFirstExclusiveSecondExclusive) {
|
||||
// This test will verify that if someone holds an exclusive lock any attempt
|
||||
// to obtain another exclusive lock will result in blocking.
|
||||
ASSERT_THAT(flock(test_file_fd_.get(), LOCK_EX), SyscallSucceeds());
|
||||
|
|
|
@ -220,7 +220,7 @@ TEST_P(PrivateAndSharedFutexTest, Wait_ZeroBitset) {
|
|||
SyscallFailsWithErrno(EINVAL));
|
||||
}
|
||||
|
||||
TEST_P(PrivateAndSharedFutexTest, Wake1_NoRandomSave) {
|
||||
TEST_P(PrivateAndSharedFutexTest, Wake1) {
|
||||
constexpr int kInitialValue = 1;
|
||||
std::atomic<int> a = ATOMIC_VAR_INIT(kInitialValue);
|
||||
|
||||
|
@ -240,7 +240,7 @@ TEST_P(PrivateAndSharedFutexTest, Wake1_NoRandomSave) {
|
|||
EXPECT_THAT(futex_wake(IsPrivate(), &a, 1), SyscallSucceedsWithValue(1));
|
||||
}
|
||||
|
||||
TEST_P(PrivateAndSharedFutexTest, Wake0_NoRandomSave) {
|
||||
TEST_P(PrivateAndSharedFutexTest, Wake0) {
|
||||
constexpr int kInitialValue = 1;
|
||||
std::atomic<int> a = ATOMIC_VAR_INIT(kInitialValue);
|
||||
|
||||
|
@ -261,7 +261,7 @@ TEST_P(PrivateAndSharedFutexTest, Wake0_NoRandomSave) {
|
|||
EXPECT_THAT(futex_wake(IsPrivate(), &a, 0), SyscallSucceedsWithValue(1));
|
||||
}
|
||||
|
||||
TEST_P(PrivateAndSharedFutexTest, WakeAll_NoRandomSave) {
|
||||
TEST_P(PrivateAndSharedFutexTest, WakeAll) {
|
||||
constexpr int kInitialValue = 1;
|
||||
std::atomic<int> a = ATOMIC_VAR_INIT(kInitialValue);
|
||||
|
||||
|
@ -282,7 +282,7 @@ TEST_P(PrivateAndSharedFutexTest, WakeAll_NoRandomSave) {
|
|||
SyscallSucceedsWithValue(kThreads));
|
||||
}
|
||||
|
||||
TEST_P(PrivateAndSharedFutexTest, WakeSome_NoRandomSave) {
|
||||
TEST_P(PrivateAndSharedFutexTest, WakeSome) {
|
||||
constexpr int kInitialValue = 1;
|
||||
std::atomic<int> a = ATOMIC_VAR_INIT(kInitialValue);
|
||||
|
||||
|
@ -331,7 +331,7 @@ TEST_P(PrivateAndSharedFutexTest, WakeSome_NoRandomSave) {
|
|||
EXPECT_EQ(timedout, kThreads - kWokenThreads);
|
||||
}
|
||||
|
||||
TEST_P(PrivateAndSharedFutexTest, WaitBitset_Wake_NoRandomSave) {
|
||||
TEST_P(PrivateAndSharedFutexTest, WaitBitset_Wake) {
|
||||
constexpr int kInitialValue = 1;
|
||||
std::atomic<int> a = ATOMIC_VAR_INIT(kInitialValue);
|
||||
|
||||
|
@ -346,7 +346,7 @@ TEST_P(PrivateAndSharedFutexTest, WaitBitset_Wake_NoRandomSave) {
|
|||
EXPECT_THAT(futex_wake(IsPrivate(), &a, 1), SyscallSucceedsWithValue(1));
|
||||
}
|
||||
|
||||
TEST_P(PrivateAndSharedFutexTest, Wait_WakeBitset_NoRandomSave) {
|
||||
TEST_P(PrivateAndSharedFutexTest, Wait_WakeBitset) {
|
||||
constexpr int kInitialValue = 1;
|
||||
std::atomic<int> a = ATOMIC_VAR_INIT(kInitialValue);
|
||||
|
||||
|
@ -361,7 +361,7 @@ TEST_P(PrivateAndSharedFutexTest, Wait_WakeBitset_NoRandomSave) {
|
|||
SyscallSucceedsWithValue(1));
|
||||
}
|
||||
|
||||
TEST_P(PrivateAndSharedFutexTest, WaitBitset_WakeBitsetMatch_NoRandomSave) {
|
||||
TEST_P(PrivateAndSharedFutexTest, WaitBitset_WakeBitsetMatch) {
|
||||
constexpr int kInitialValue = 1;
|
||||
std::atomic<int> a = ATOMIC_VAR_INIT(kInitialValue);
|
||||
|
||||
|
@ -379,7 +379,7 @@ TEST_P(PrivateAndSharedFutexTest, WaitBitset_WakeBitsetMatch_NoRandomSave) {
|
|||
SyscallSucceedsWithValue(1));
|
||||
}
|
||||
|
||||
TEST_P(PrivateAndSharedFutexTest, WaitBitset_WakeBitsetNoMatch_NoRandomSave) {
|
||||
TEST_P(PrivateAndSharedFutexTest, WaitBitset_WakeBitsetNoMatch) {
|
||||
constexpr int kInitialValue = 1;
|
||||
std::atomic<int> a = ATOMIC_VAR_INIT(kInitialValue);
|
||||
|
||||
|
@ -401,7 +401,7 @@ TEST_P(PrivateAndSharedFutexTest, WaitBitset_WakeBitsetNoMatch_NoRandomSave) {
|
|||
SyscallSucceedsWithValue(0));
|
||||
}
|
||||
|
||||
TEST_P(PrivateAndSharedFutexTest, WakeOpCondSuccess_NoRandomSave) {
|
||||
TEST_P(PrivateAndSharedFutexTest, WakeOpCondSuccess) {
|
||||
constexpr int kInitialValue = 1;
|
||||
std::atomic<int> a = ATOMIC_VAR_INIT(kInitialValue);
|
||||
std::atomic<int> b = ATOMIC_VAR_INIT(kInitialValue);
|
||||
|
@ -428,7 +428,7 @@ TEST_P(PrivateAndSharedFutexTest, WakeOpCondSuccess_NoRandomSave) {
|
|||
EXPECT_EQ(b, kInitialValue + 2);
|
||||
}
|
||||
|
||||
TEST_P(PrivateAndSharedFutexTest, WakeOpCondFailure_NoRandomSave) {
|
||||
TEST_P(PrivateAndSharedFutexTest, WakeOpCondFailure) {
|
||||
constexpr int kInitialValue = 1;
|
||||
std::atomic<int> a = ATOMIC_VAR_INIT(kInitialValue);
|
||||
std::atomic<int> b = ATOMIC_VAR_INIT(kInitialValue);
|
||||
|
@ -457,7 +457,7 @@ TEST_P(PrivateAndSharedFutexTest, WakeOpCondFailure_NoRandomSave) {
|
|||
EXPECT_EQ(b, kInitialValue + 2);
|
||||
}
|
||||
|
||||
TEST_P(PrivateAndSharedFutexTest, NoWakeInterprocessPrivateAnon_NoRandomSave) {
|
||||
TEST_P(PrivateAndSharedFutexTest, NoWakeInterprocessPrivateAnon) {
|
||||
auto const mapping = ASSERT_NO_ERRNO_AND_VALUE(
|
||||
MmapAnon(kPageSize, PROT_READ | PROT_WRITE, MAP_PRIVATE));
|
||||
auto const ptr = static_cast<std::atomic<int>*>(mapping.ptr());
|
||||
|
@ -484,7 +484,7 @@ TEST_P(PrivateAndSharedFutexTest, NoWakeInterprocessPrivateAnon_NoRandomSave) {
|
|||
<< " status " << status;
|
||||
}
|
||||
|
||||
TEST_P(PrivateAndSharedFutexTest, WakeAfterCOWBreak_NoRandomSave) {
|
||||
TEST_P(PrivateAndSharedFutexTest, WakeAfterCOWBreak) {
|
||||
// Use a futex on a non-stack mapping so we can be sure that the child process
|
||||
// below isn't the one that breaks copy-on-write.
|
||||
auto const mapping = ASSERT_NO_ERRNO_AND_VALUE(
|
||||
|
@ -520,7 +520,7 @@ TEST_P(PrivateAndSharedFutexTest, WakeAfterCOWBreak_NoRandomSave) {
|
|||
EXPECT_THAT(futex_wake(IsPrivate(), ptr, 1), SyscallSucceedsWithValue(1));
|
||||
}
|
||||
|
||||
TEST_P(PrivateAndSharedFutexTest, WakeWrongKind_NoRandomSave) {
|
||||
TEST_P(PrivateAndSharedFutexTest, WakeWrongKind) {
|
||||
constexpr int kInitialValue = 1;
|
||||
std::atomic<int> a = ATOMIC_VAR_INIT(kInitialValue);
|
||||
|
||||
|
@ -584,7 +584,7 @@ TEST(PrivateFutexTest, WakeOp0Xor) {
|
|||
EXPECT_EQ(a, 0b0110);
|
||||
}
|
||||
|
||||
TEST(SharedFutexTest, WakeInterprocessSharedAnon_NoRandomSave) {
|
||||
TEST(SharedFutexTest, WakeInterprocessSharedAnon) {
|
||||
auto const mapping = ASSERT_NO_ERRNO_AND_VALUE(
|
||||
MmapAnon(kPageSize, PROT_READ | PROT_WRITE, MAP_SHARED));
|
||||
auto const ptr = static_cast<std::atomic<int>*>(mapping.ptr());
|
||||
|
@ -615,7 +615,7 @@ TEST(SharedFutexTest, WakeInterprocessSharedAnon_NoRandomSave) {
|
|||
<< " status " << status;
|
||||
}
|
||||
|
||||
TEST(SharedFutexTest, WakeInterprocessFile_NoRandomSave) {
|
||||
TEST(SharedFutexTest, WakeInterprocessFile) {
|
||||
auto const file = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFile());
|
||||
ASSERT_THAT(truncate(file.path().c_str(), kPageSize), SyscallSucceeds());
|
||||
auto const fd = ASSERT_NO_ERRNO_AND_VALUE(Open(file.path(), O_RDWR));
|
||||
|
@ -661,7 +661,7 @@ TEST_P(PrivateAndSharedFutexTest, PIBasic) {
|
|||
EXPECT_THAT(futex_unlock_pi(IsPrivate(), &a), SyscallFailsWithErrno(EPERM));
|
||||
}
|
||||
|
||||
TEST_P(PrivateAndSharedFutexTest, PIConcurrency_NoRandomSave) {
|
||||
TEST_P(PrivateAndSharedFutexTest, PIConcurrency) {
|
||||
DisableSave ds; // Too many syscalls.
|
||||
|
||||
std::atomic<int> a = ATOMIC_VAR_INIT(0);
|
||||
|
@ -717,7 +717,7 @@ TEST_P(PrivateAndSharedFutexTest, PITryLock) {
|
|||
ASSERT_THAT(futex_unlock_pi(IsPrivate(), &a), SyscallSucceeds());
|
||||
}
|
||||
|
||||
TEST_P(PrivateAndSharedFutexTest, PITryLockConcurrency_NoRandomSave) {
|
||||
TEST_P(PrivateAndSharedFutexTest, PITryLockConcurrency) {
|
||||
DisableSave ds; // Too many syscalls.
|
||||
|
||||
std::atomic<int> a = ATOMIC_VAR_INIT(0);
|
||||
|
|
|
@ -1156,7 +1156,7 @@ TEST(Inotify, ZeroLengthReadWriteDoesNotGenerateEvent) {
|
|||
EXPECT_TRUE(events.empty());
|
||||
}
|
||||
|
||||
TEST(Inotify, ChmodGeneratesAttribEvent_NoRandomSave) {
|
||||
TEST(Inotify, ChmodGeneratesAttribEvent) {
|
||||
const TempPath root = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateDir());
|
||||
const TempPath file1 =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFileIn(root.path()));
|
||||
|
@ -1999,7 +1999,7 @@ TEST(Inotify, Exec) {
|
|||
//
|
||||
// We need to disable S/R because there are filesystems where we cannot re-open
|
||||
// fds to an unlinked file across S/R, e.g. gofer-backed filesytems.
|
||||
TEST(Inotify, IncludeUnlinkedFile_NoRandomSave) {
|
||||
TEST(Inotify, IncludeUnlinkedFile) {
|
||||
const DisableSave ds;
|
||||
|
||||
const TempPath dir = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateDir());
|
||||
|
@ -2052,7 +2052,7 @@ TEST(Inotify, IncludeUnlinkedFile_NoRandomSave) {
|
|||
//
|
||||
// We need to disable S/R because there are filesystems where we cannot re-open
|
||||
// fds to an unlinked file across S/R, e.g. gofer-backed filesytems.
|
||||
TEST(Inotify, ExcludeUnlink_NoRandomSave) {
|
||||
TEST(Inotify, ExcludeUnlink) {
|
||||
const DisableSave ds;
|
||||
// TODO(gvisor.dev/issue/1624): This test fails on VFS1.
|
||||
SKIP_IF(IsRunningWithVFS1());
|
||||
|
@ -2093,7 +2093,7 @@ TEST(Inotify, ExcludeUnlink_NoRandomSave) {
|
|||
|
||||
// We need to disable S/R because there are filesystems where we cannot re-open
|
||||
// fds to an unlinked file across S/R, e.g. gofer-backed filesytems.
|
||||
TEST(Inotify, ExcludeUnlinkDirectory_NoRandomSave) {
|
||||
TEST(Inotify, ExcludeUnlinkDirectory) {
|
||||
// TODO(gvisor.dev/issue/1624): This test fails on VFS1. Remove once VFS1 is
|
||||
// deleted.
|
||||
SKIP_IF(IsRunningWithVFS1());
|
||||
|
@ -2138,7 +2138,7 @@ TEST(Inotify, ExcludeUnlinkDirectory_NoRandomSave) {
|
|||
//
|
||||
// We need to disable S/R because there are filesystems where we cannot re-open
|
||||
// fds to an unlinked file across S/R, e.g. gofer-backed filesytems.
|
||||
TEST(Inotify, ExcludeUnlinkMultipleChildren_NoRandomSave) {
|
||||
TEST(Inotify, ExcludeUnlinkMultipleChildren) {
|
||||
// Inotify does not work properly with hard links in gofer and overlay fs.
|
||||
SKIP_IF(IsRunningOnGvisor() &&
|
||||
!ASSERT_NO_ERRNO_AND_VALUE(IsTmpfs(GetAbsoluteTestTmpdir())));
|
||||
|
@ -2184,7 +2184,7 @@ TEST(Inotify, ExcludeUnlinkMultipleChildren_NoRandomSave) {
|
|||
//
|
||||
// We need to disable S/R because there are filesystems where we cannot re-open
|
||||
// fds to an unlinked file across S/R, e.g. gofer-backed filesytems.
|
||||
TEST(Inotify, ExcludeUnlinkInodeEvents_NoRandomSave) {
|
||||
TEST(Inotify, ExcludeUnlinkInodeEvents) {
|
||||
// TODO(gvisor.dev/issue/1624): Fails on VFS1.
|
||||
SKIP_IF(IsRunningWithVFS1());
|
||||
|
||||
|
@ -2284,7 +2284,7 @@ TEST(Inotify, OneShot) {
|
|||
// This test helps verify that the lock order of filesystem and inotify locks
|
||||
// is respected when inotify instances and watch targets are concurrently being
|
||||
// destroyed.
|
||||
TEST(InotifyTest, InotifyAndTargetDestructionDoNotDeadlock_NoRandomSave) {
|
||||
TEST(InotifyTest, InotifyAndTargetDestructionDoNotDeadlock) {
|
||||
const DisableSave ds; // Too many syscalls.
|
||||
|
||||
// A file descriptor protected by a mutex. This ensures that while a
|
||||
|
@ -2350,7 +2350,7 @@ TEST(InotifyTest, InotifyAndTargetDestructionDoNotDeadlock_NoRandomSave) {
|
|||
// This test helps verify that the lock order of filesystem and inotify locks
|
||||
// is respected when adding/removing watches occurs concurrently with the
|
||||
// removal of their targets.
|
||||
TEST(InotifyTest, AddRemoveUnlinkDoNotDeadlock_NoRandomSave) {
|
||||
TEST(InotifyTest, AddRemoveUnlinkDoNotDeadlock) {
|
||||
const DisableSave ds; // Too many syscalls.
|
||||
|
||||
// Set up inotify instances.
|
||||
|
@ -2405,7 +2405,7 @@ TEST(InotifyTest, AddRemoveUnlinkDoNotDeadlock_NoRandomSave) {
|
|||
// This test helps verify that the lock order of filesystem and inotify locks
|
||||
// is respected when many inotify events and filesystem operations occur
|
||||
// simultaneously.
|
||||
TEST(InotifyTest, NotifyNoDeadlock_NoRandomSave) {
|
||||
TEST(InotifyTest, NotifyNoDeadlock) {
|
||||
const DisableSave ds; // Too many syscalls.
|
||||
|
||||
const TempPath parent = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateDir());
|
||||
|
|
|
@ -215,7 +215,7 @@ int TestSIGALRMToMainThread() {
|
|||
|
||||
// Random save/restore is disabled as it introduces additional latency and
|
||||
// unpredictable distribution patterns.
|
||||
TEST(ItimerTest, DeliversSIGALRMToMainThread_NoRandomSave) {
|
||||
TEST(ItimerTest, DeliversSIGALRMToMainThread) {
|
||||
pid_t child;
|
||||
int execve_errno;
|
||||
auto kill = ASSERT_NO_ERRNO_AND_VALUE(
|
||||
|
@ -266,7 +266,7 @@ int TestSIGPROFFairness(absl::Duration sleep) {
|
|||
|
||||
// Random save/restore is disabled as it introduces additional latency and
|
||||
// unpredictable distribution patterns.
|
||||
TEST(ItimerTest, DeliversSIGPROFToThreadsRoughlyFairlyActive_NoRandomSave) {
|
||||
TEST(ItimerTest, DeliversSIGPROFToThreadsRoughlyFairlyActive) {
|
||||
// On the KVM and ptrace platforms, switches between sentry and application
|
||||
// context are sometimes extremely slow, causing the itimer to send SIGPROF to
|
||||
// a thread that either already has one pending or has had SIGPROF delivered,
|
||||
|
@ -301,7 +301,7 @@ TEST(ItimerTest, DeliversSIGPROFToThreadsRoughlyFairlyActive_NoRandomSave) {
|
|||
|
||||
// Random save/restore is disabled as it introduces additional latency and
|
||||
// unpredictable distribution patterns.
|
||||
TEST(ItimerTest, DeliversSIGPROFToThreadsRoughlyFairlyIdle_NoRandomSave) {
|
||||
TEST(ItimerTest, DeliversSIGPROFToThreadsRoughlyFairlyIdle) {
|
||||
// See comment in DeliversSIGPROFToThreadsRoughlyFairlyActive.
|
||||
const auto gvisor_platform = GvisorPlatform();
|
||||
SKIP_IF(gvisor_platform == Platform::kKVM ||
|
||||
|
|
|
@ -431,7 +431,7 @@ TEST_F(OpenTest, CanTruncateReadOnly) {
|
|||
|
||||
// If we don't have read permission on the file, opening with
|
||||
// O_TRUNC should fail.
|
||||
TEST_F(OpenTest, CanTruncateReadOnlyNoWritePermission_NoRandomSave) {
|
||||
TEST_F(OpenTest, CanTruncateReadOnlyNoWritePermission) {
|
||||
// Drop capabilities that allow us to override file permissions.
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_OVERRIDE, false));
|
||||
|
||||
|
@ -452,7 +452,7 @@ TEST_F(OpenTest, CanTruncateReadOnlyNoWritePermission_NoRandomSave) {
|
|||
|
||||
// If we don't have read permission but have write permission, opening O_WRONLY
|
||||
// and O_TRUNC should succeed.
|
||||
TEST_F(OpenTest, CanTruncateWriteOnlyNoReadPermission_NoRandomSave) {
|
||||
TEST_F(OpenTest, CanTruncateWriteOnlyNoReadPermission) {
|
||||
const DisableSave ds; // Permissions are dropped.
|
||||
|
||||
EXPECT_THAT(fchmod(test_file_fd_.get(), S_IWUSR | S_IWGRP),
|
||||
|
|
|
@ -52,7 +52,7 @@ TEST(CreateTest, CreateAtFile) {
|
|||
EXPECT_THAT(close(fd), SyscallSucceeds());
|
||||
}
|
||||
|
||||
TEST(CreateTest, HonorsUmask_NoRandomSave) {
|
||||
TEST(CreateTest, HonorsUmask) {
|
||||
const DisableSave ds; // file cannot be re-opened as writable.
|
||||
auto dir = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateDir());
|
||||
TempUmask mask(0222);
|
||||
|
@ -119,7 +119,7 @@ TEST(CreateTest, OpenCreateROThenRW) {
|
|||
EXPECT_THAT(WriteFd(fd2.get(), &c, 1), SyscallSucceedsWithValue(1));
|
||||
}
|
||||
|
||||
TEST(CreateTest, ChmodReadToWriteBetweenOpens_NoRandomSave) {
|
||||
TEST(CreateTest, ChmodReadToWriteBetweenOpens) {
|
||||
// Make sure we don't have CAP_DAC_OVERRIDE, since that allows the user to
|
||||
// override file read/write permissions. CAP_DAC_READ_SEARCH needs to be
|
||||
// cleared for the same reason.
|
||||
|
@ -149,7 +149,7 @@ TEST(CreateTest, ChmodReadToWriteBetweenOpens_NoRandomSave) {
|
|||
EXPECT_EQ(c, 'x');
|
||||
}
|
||||
|
||||
TEST(CreateTest, ChmodWriteToReadBetweenOpens_NoRandomSave) {
|
||||
TEST(CreateTest, ChmodWriteToReadBetweenOpens) {
|
||||
// Make sure we don't have CAP_DAC_OVERRIDE, since that allows the user to
|
||||
// override file read/write permissions.
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_OVERRIDE, false));
|
||||
|
@ -177,7 +177,7 @@ TEST(CreateTest, ChmodWriteToReadBetweenOpens_NoRandomSave) {
|
|||
EXPECT_EQ(c, 'x');
|
||||
}
|
||||
|
||||
TEST(CreateTest, CreateWithReadFlagNotAllowedByMode_NoRandomSave) {
|
||||
TEST(CreateTest, CreateWithReadFlagNotAllowedByMode) {
|
||||
// The only time we can open a file with flags forbidden by its permissions
|
||||
// is when we are creating the file. We cannot re-open with the same flags,
|
||||
// so we cannot restore an fd obtained from such an operation.
|
||||
|
@ -204,7 +204,7 @@ TEST(CreateTest, CreateWithReadFlagNotAllowedByMode_NoRandomSave) {
|
|||
EXPECT_EQ(c, 'x');
|
||||
}
|
||||
|
||||
TEST(CreateTest, CreateWithWriteFlagNotAllowedByMode_NoRandomSave) {
|
||||
TEST(CreateTest, CreateWithWriteFlagNotAllowedByMode) {
|
||||
// The only time we can open a file with flags forbidden by its permissions
|
||||
// is when we are creating the file. We cannot re-open with the same flags,
|
||||
// so we cannot restore an fd obtained from such an operation.
|
||||
|
|
|
@ -320,7 +320,7 @@ PosixErrorOr<sockaddr_storage> InetLoopbackAddr(int family) {
|
|||
// EFAULT. It also verifies that passing a buffer which is made up of 2
|
||||
// pages one valid and one guard page succeeds as long as the write is
|
||||
// for exactly the size of 1 page.
|
||||
TEST_F(PartialBadBufferTest, SendMsgTCP_NoRandomSave) {
|
||||
TEST_F(PartialBadBufferTest, SendMsgTCP) {
|
||||
// FIXME(b/171436815): Netstack save/restore is broken.
|
||||
const DisableSave ds;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace {
|
|||
//
|
||||
// We disable both random/cooperative S/R for this test as it makes way too many
|
||||
// syscalls.
|
||||
TEST(PingSocket, ICMPPortExhaustion_NoRandomSave) {
|
||||
TEST(PingSocket, ICMPPortExhaustion) {
|
||||
DisableSave ds;
|
||||
|
||||
{
|
||||
|
|
|
@ -399,7 +399,7 @@ TEST_P(PipeTest, BlockPartialWriteClosed) {
|
|||
t.Join();
|
||||
}
|
||||
|
||||
TEST_P(PipeTest, ReadFromClosedFd_NoRandomSave) {
|
||||
TEST_P(PipeTest, ReadFromClosedFd) {
|
||||
SKIP_IF(!CreateBlocking());
|
||||
|
||||
absl::Notification notify;
|
||||
|
|
|
@ -57,7 +57,7 @@ TEST_F(PollTest, ZeroTimeout) {
|
|||
|
||||
// If random S/R interrupts the poll, SIGALRM may be delivered before poll
|
||||
// restarts, causing the poll to hang forever.
|
||||
TEST_F(PollTest, NegativeTimeout_NoRandomSave) {
|
||||
TEST_F(PollTest, NegativeTimeout) {
|
||||
// Negative timeout mean wait forever so set a timer.
|
||||
SetTimer(absl::Milliseconds(100));
|
||||
EXPECT_THAT(poll(nullptr, 0, -1), SyscallFailsWithErrno(EINTR));
|
||||
|
|
|
@ -76,7 +76,7 @@ TEST_F(PpollTest, ZeroTimeout) {
|
|||
|
||||
// If random S/R interrupts the ppoll, SIGALRM may be delivered before ppoll
|
||||
// restarts, causing the ppoll to hang forever.
|
||||
TEST_F(PpollTest, NoTimeout_NoRandomSave) {
|
||||
TEST_F(PpollTest, NoTimeout) {
|
||||
// When there's no timeout, ppoll may never return so set a timer.
|
||||
SetTimer(absl::Milliseconds(100));
|
||||
// See that we get interrupted by the timer.
|
||||
|
|
|
@ -144,7 +144,7 @@ TEST_F(Pread64Test, Overflow) {
|
|||
SyscallFailsWithErrno(EINVAL));
|
||||
}
|
||||
|
||||
TEST(Pread64TestNoTempFile, CantReadSocketPair_NoRandomSave) {
|
||||
TEST(Pread64TestNoTempFile, CantReadSocketPair) {
|
||||
int sock_fds[2];
|
||||
EXPECT_THAT(socketpair(AF_UNIX, SOCK_STREAM, 0, sock_fds), SyscallSucceeds());
|
||||
|
||||
|
|
|
@ -1629,7 +1629,7 @@ TEST(ProcPidStatusTest, StateRunning) {
|
|||
IsPosixErrorOkAndHolds(Contains(Pair("State", "R (running)"))));
|
||||
}
|
||||
|
||||
TEST(ProcPidStatusTest, StateSleeping_NoRandomSave) {
|
||||
TEST(ProcPidStatusTest, StateSleeping) {
|
||||
// Starts a child process that blocks and checks that State is sleeping.
|
||||
auto res = WithSubprocess(
|
||||
[&](int pid) -> PosixError {
|
||||
|
|
|
@ -189,7 +189,7 @@ PosixErrorOr<uint64_t> GetSNMPMetricFromProc(const std::string snmp,
|
|||
EINVAL, absl::StrCat("failed to find ", type, "/", item, " in:", snmp));
|
||||
}
|
||||
|
||||
TEST(ProcNetSnmp, TcpReset_NoRandomSave) {
|
||||
TEST(ProcNetSnmp, TcpReset) {
|
||||
// TODO(gvisor.dev/issue/866): epsocket metrics are not savable.
|
||||
DisableSave ds;
|
||||
|
||||
|
@ -231,7 +231,7 @@ TEST(ProcNetSnmp, TcpReset_NoRandomSave) {
|
|||
EXPECT_EQ(oldAttemptFails, newAttemptFails - 1);
|
||||
}
|
||||
|
||||
TEST(ProcNetSnmp, TcpEstab_NoRandomSave) {
|
||||
TEST(ProcNetSnmp, TcpEstab) {
|
||||
// TODO(gvisor.dev/issue/866): epsocket metrics are not savable.
|
||||
DisableSave ds;
|
||||
|
||||
|
@ -325,7 +325,7 @@ TEST(ProcNetSnmp, TcpEstab_NoRandomSave) {
|
|||
EXPECT_EQ(oldEstabResets, newEstabResets - 2);
|
||||
}
|
||||
|
||||
TEST(ProcNetSnmp, UdpNoPorts_NoRandomSave) {
|
||||
TEST(ProcNetSnmp, UdpNoPorts) {
|
||||
// TODO(gvisor.dev/issue/866): epsocket metrics are not savable.
|
||||
DisableSave ds;
|
||||
|
||||
|
@ -359,7 +359,7 @@ TEST(ProcNetSnmp, UdpNoPorts_NoRandomSave) {
|
|||
EXPECT_EQ(oldNoPorts, newNoPorts - 1);
|
||||
}
|
||||
|
||||
TEST(ProcNetSnmp, UdpIn_NoRandomSave) {
|
||||
TEST(ProcNetSnmp, UdpIn) {
|
||||
// TODO(gvisor.dev/issue/866): epsocket metrics are not savable.
|
||||
const DisableSave ds;
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ TEST_F(PselectTest, ZeroTimeout) {
|
|||
|
||||
// If random S/R interrupts the pselect, SIGALRM may be delivered before pselect
|
||||
// restarts, causing the pselect to hang forever.
|
||||
TEST_F(PselectTest, NoTimeout_NoRandomSave) {
|
||||
TEST_F(PselectTest, NoTimeout) {
|
||||
// When there's no timeout, pselect may never return so set a timer.
|
||||
SetTimer(absl::Milliseconds(100));
|
||||
// See that we get interrupted by the timer.
|
||||
|
|
|
@ -1708,8 +1708,7 @@ INSTANTIATE_TEST_SUITE_P(TraceExec, PtraceExecveTest, ::testing::Bool());
|
|||
// This test has expectations on when syscall-enter/exit-stops occur that are
|
||||
// violated if saving occurs, since saving interrupts all syscalls, causing
|
||||
// premature syscall-exit.
|
||||
TEST(PtraceTest,
|
||||
ExitWhenParentIsNotTracer_Syscall_TraceVfork_TraceVforkDone_NoRandomSave) {
|
||||
TEST(PtraceTest, ExitWhenParentIsNotTracer_Syscall_TraceVfork_TraceVforkDone) {
|
||||
constexpr int kExitTraceeExitCode = 99;
|
||||
|
||||
pid_t const child_pid = fork();
|
||||
|
@ -2006,7 +2005,7 @@ TEST(PtraceTest, Sysemu_PokeUser) {
|
|||
}
|
||||
|
||||
// This test also cares about syscall-exit-stop.
|
||||
TEST(PtraceTest, ERESTART_NoRandomSave) {
|
||||
TEST(PtraceTest, ERESTART) {
|
||||
constexpr int kSigno = SIGUSR1;
|
||||
|
||||
pid_t const child_pid = fork();
|
||||
|
|
|
@ -97,7 +97,7 @@ TEST_F(ReadTest, DevNullReturnsEof) {
|
|||
const int kReadSize = 128 * 1024;
|
||||
|
||||
// Do not allow random save as it could lead to partial reads.
|
||||
TEST_F(ReadTest, CanReadFullyFromDevZero_NoRandomSave) {
|
||||
TEST_F(ReadTest, CanReadFullyFromDevZero) {
|
||||
int fd;
|
||||
ASSERT_THAT(fd = open("/dev/zero", O_RDONLY), SyscallSucceeds());
|
||||
|
||||
|
|
|
@ -267,7 +267,7 @@ TEST_F(ReadvTest, ReadvWithOpath) {
|
|||
|
||||
// This test depends on the maximum extent of a single readv() syscall, so
|
||||
// we can't tolerate interruption from saving.
|
||||
TEST(ReadvTestNoFixture, TruncatedAtMax_NoRandomSave) {
|
||||
TEST(ReadvTestNoFixture, TruncatedAtMax) {
|
||||
// Ensure that we won't be interrupted by ITIMER_PROF. This is particularly
|
||||
// important in environments where automated profiling tools may start
|
||||
// ITIMER_PROF automatically.
|
||||
|
|
|
@ -98,7 +98,7 @@ TEST_F(SelectTest, ZeroTimeout) {
|
|||
|
||||
// If random S/R interrupts the select, SIGALRM may be delivered before select
|
||||
// restarts, causing the select to hang forever.
|
||||
TEST_F(SelectTest, NoTimeout_NoRandomSave) {
|
||||
TEST_F(SelectTest, NoTimeout) {
|
||||
// When there's no timeout, select may never return so set a timer.
|
||||
SetTimer(absl::Milliseconds(100));
|
||||
// See that we get interrupted by the timer.
|
||||
|
@ -118,7 +118,7 @@ TEST_F(SelectTest, InvalidTimeoutNegative) {
|
|||
//
|
||||
// If random S/R interrupts the select, SIGALRM may be delivered before select
|
||||
// restarts, causing the select to hang forever.
|
||||
TEST_F(SelectTest, InterruptedBySignal_NoRandomSave) {
|
||||
TEST_F(SelectTest, InterruptedBySignal) {
|
||||
absl::Duration duration(absl::Seconds(5));
|
||||
struct timeval timeout = absl::ToTimeval(duration);
|
||||
SetTimer(absl::Milliseconds(100));
|
||||
|
|
|
@ -287,7 +287,7 @@ TEST(SemaphoreTest, SemOpSimple) {
|
|||
|
||||
// Tests that semaphore can be removed while there are waiters.
|
||||
// NoRandomSave: Test relies on timing that random save throws off.
|
||||
TEST(SemaphoreTest, SemOpRemoveWithWaiter_NoRandomSave) {
|
||||
TEST(SemaphoreTest, SemOpRemoveWithWaiter) {
|
||||
AutoSem sem(semget(IPC_PRIVATE, 2, 0600 | IPC_CREAT));
|
||||
ASSERT_THAT(sem.get(), SyscallSucceeds());
|
||||
|
||||
|
@ -708,7 +708,7 @@ TEST(SemaphoreTest, SemopGetzcntOnSetRemoval) {
|
|||
EXPECT_THAT(semctl(semid, 0, GETZCNT), SyscallFailsWithErrno(EINVAL));
|
||||
}
|
||||
|
||||
TEST(SemaphoreTest, SemopGetzcntOnSignal_NoRandomSave) {
|
||||
TEST(SemaphoreTest, SemopGetzcntOnSignal) {
|
||||
AutoSem sem(semget(IPC_PRIVATE, 1, 0600 | IPC_CREAT));
|
||||
ASSERT_THAT(sem.get(), SyscallSucceeds());
|
||||
ASSERT_THAT(semctl(sem.get(), 0, SETVAL, 1), SyscallSucceeds());
|
||||
|
@ -813,7 +813,7 @@ TEST(SemaphoreTest, SemopGetncntOnSetRemoval) {
|
|||
EXPECT_THAT(semctl(semid, 0, GETNCNT), SyscallFailsWithErrno(EINVAL));
|
||||
}
|
||||
|
||||
TEST(SemaphoreTest, SemopGetncntOnSignal_NoRandomSave) {
|
||||
TEST(SemaphoreTest, SemopGetncntOnSignal) {
|
||||
AutoSem sem(semget(IPC_PRIVATE, 1, 0600 | IPC_CREAT));
|
||||
ASSERT_THAT(sem.get(), SyscallSucceeds());
|
||||
ASSERT_EQ(semctl(sem.get(), 0, GETNCNT), 0);
|
||||
|
|
|
@ -654,7 +654,7 @@ TEST(SendFileTest, SendFileToPipe) {
|
|||
SyscallSucceedsWithValue(kDataSize));
|
||||
}
|
||||
|
||||
TEST(SendFileTest, SendFileToSelf_NoRandomSave) {
|
||||
TEST(SendFileTest, SendFileToSelf) {
|
||||
int rawfd;
|
||||
ASSERT_THAT(rawfd = memfd_create("memfd", 0), SyscallSucceeds());
|
||||
const FileDescriptor fd(rawfd);
|
||||
|
@ -675,7 +675,7 @@ TEST(SendFileTest, SendFileToSelf_NoRandomSave) {
|
|||
static volatile int signaled = 0;
|
||||
void SigUsr1Handler(int sig, siginfo_t* info, void* context) { signaled = 1; }
|
||||
|
||||
TEST(SendFileTest, ToEventFDDoesNotSpin_NoRandomSave) {
|
||||
TEST(SendFileTest, ToEventFDDoesNotSpin) {
|
||||
FileDescriptor efd = ASSERT_NO_ERRNO_AND_VALUE(NewEventFD(0, 0));
|
||||
|
||||
// Write the maximum value of an eventfd to a file.
|
||||
|
|
|
@ -52,7 +52,7 @@ TEST(SigtimedwaitTest, InvalidTimeout) {
|
|||
|
||||
// No random save as the test relies on alarm timing. Cooperative save tests
|
||||
// already cover the save between alarm and wait.
|
||||
TEST(SigtimedwaitTest, AlarmReturnsAlarm_NoRandomSave) {
|
||||
TEST(SigtimedwaitTest, AlarmReturnsAlarm) {
|
||||
struct itimerval itv = {};
|
||||
itv.it_value.tv_sec = kAlarmSecs;
|
||||
const auto itimer_cleanup =
|
||||
|
@ -69,7 +69,7 @@ TEST(SigtimedwaitTest, AlarmReturnsAlarm_NoRandomSave) {
|
|||
|
||||
// No random save as the test relies on alarm timing. Cooperative save tests
|
||||
// already cover the save between alarm and wait.
|
||||
TEST(SigtimedwaitTest, NullTimeoutReturnsEINTR_NoRandomSave) {
|
||||
TEST(SigtimedwaitTest, NullTimeoutReturnsEINTR) {
|
||||
struct sigaction sa;
|
||||
sa.sa_sigaction = NoopHandler;
|
||||
sigfillset(&sa.sa_mask);
|
||||
|
|
|
@ -111,7 +111,7 @@ TEST(SocketTest, UnixSocketStatFS) {
|
|||
EXPECT_EQ(st.f_namelen, NAME_MAX);
|
||||
}
|
||||
|
||||
TEST(SocketTest, UnixSCMRightsOnlyPassedOnce_NoRandomSave) {
|
||||
TEST(SocketTest, UnixSCMRightsOnlyPassedOnce) {
|
||||
const DisableSave ds;
|
||||
|
||||
int sockets[2];
|
||||
|
|
|
@ -618,11 +618,11 @@ TEST_P(SocketInetLoopbackTest, TCPListenShutdownConnectingRead) {
|
|||
});
|
||||
}
|
||||
|
||||
// TODO(b/157236388): Remove _NoRandomSave once bug is fixed. Test fails w/
|
||||
// TODO(b/157236388): Remove once bug is fixed. Test fails w/
|
||||
// random save as established connections which can't be delivered to the accept
|
||||
// queue because the queue is full are not correctly delivered after restore
|
||||
// causing the last accept to timeout on the restore.
|
||||
TEST_P(SocketInetLoopbackTest, TCPAcceptBacklogSizes_NoRandomSave) {
|
||||
TEST_P(SocketInetLoopbackTest, TCPAcceptBacklogSizes) {
|
||||
auto const& param = GetParam();
|
||||
|
||||
TestAddress const& listener = param.listener;
|
||||
|
@ -667,11 +667,11 @@ TEST_P(SocketInetLoopbackTest, TCPAcceptBacklogSizes_NoRandomSave) {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO(b/157236388): Remove _NoRandomSave once bug is fixed. Test fails w/
|
||||
// TODO(b/157236388): Remove once bug is fixed. Test fails w/
|
||||
// random save as established connections which can't be delivered to the accept
|
||||
// queue because the queue is full are not correctly delivered after restore
|
||||
// causing the last accept to timeout on the restore.
|
||||
TEST_P(SocketInetLoopbackTest, TCPBacklog_NoRandomSave) {
|
||||
TEST_P(SocketInetLoopbackTest, TCPBacklog) {
|
||||
auto const& param = GetParam();
|
||||
|
||||
TestAddress const& listener = param.listener;
|
||||
|
@ -754,11 +754,11 @@ TEST_P(SocketInetLoopbackTest, TCPBacklog_NoRandomSave) {
|
|||
ASSERT_GE(client_conns, accepted_conns);
|
||||
}
|
||||
|
||||
// TODO(b/157236388): Remove _NoRandomSave once bug is fixed. Test fails w/
|
||||
// TODO(b/157236388): Remove once bug is fixed. Test fails w/
|
||||
// random save as established connections which can't be delivered to the accept
|
||||
// queue because the queue is full are not correctly delivered after restore
|
||||
// causing the last accept to timeout on the restore.
|
||||
TEST_P(SocketInetLoopbackTest, TCPBacklogAcceptAll_NoRandomSave) {
|
||||
TEST_P(SocketInetLoopbackTest, TCPBacklogAcceptAll) {
|
||||
auto const& param = GetParam();
|
||||
TestAddress const& listener = param.listener;
|
||||
TestAddress const& connector = param.connector;
|
||||
|
@ -855,7 +855,7 @@ TEST_P(SocketInetLoopbackTest, TCPBacklogAcceptAll_NoRandomSave) {
|
|||
//
|
||||
// TCP timers are not S/R today, this can cause this test to be flaky when run
|
||||
// under random S/R due to timer being reset on a restore.
|
||||
TEST_P(SocketInetLoopbackTest, TCPFinWait2Test_NoRandomSave) {
|
||||
TEST_P(SocketInetLoopbackTest, TCPFinWait2Test) {
|
||||
auto const& param = GetParam();
|
||||
TestAddress const& listener = param.listener;
|
||||
TestAddress const& connector = param.connector;
|
||||
|
@ -937,7 +937,7 @@ TEST_P(SocketInetLoopbackTest, TCPFinWait2Test_NoRandomSave) {
|
|||
//
|
||||
// TCP timers are not S/R today, this can cause this test to be flaky when run
|
||||
// under random S/R due to timer being reset on a restore.
|
||||
TEST_P(SocketInetLoopbackTest, TCPLinger2TimeoutAfterClose_NoRandomSave) {
|
||||
TEST_P(SocketInetLoopbackTest, TCPLinger2TimeoutAfterClose) {
|
||||
auto const& param = GetParam();
|
||||
TestAddress const& listener = param.listener;
|
||||
TestAddress const& connector = param.connector;
|
||||
|
@ -1176,7 +1176,7 @@ void setupTimeWaitClose(const TestAddress* listener,
|
|||
//
|
||||
// Test re-binding of client and server bound addresses when the older
|
||||
// connection is in TIME_WAIT.
|
||||
TEST_P(SocketInetLoopbackTest, TCPPassiveCloseNoTimeWaitTest_NoRandomSave) {
|
||||
TEST_P(SocketInetLoopbackTest, TCPPassiveCloseNoTimeWaitTest) {
|
||||
auto const& param = GetParam();
|
||||
sockaddr_storage listen_addr, conn_bound_addr;
|
||||
listen_addr = param.listener.addr;
|
||||
|
@ -1198,8 +1198,7 @@ TEST_P(SocketInetLoopbackTest, TCPPassiveCloseNoTimeWaitTest_NoRandomSave) {
|
|||
SyscallFailsWithErrno(EADDRINUSE));
|
||||
}
|
||||
|
||||
TEST_P(SocketInetLoopbackTest,
|
||||
TCPPassiveCloseNoTimeWaitReuseTest_NoRandomSave) {
|
||||
TEST_P(SocketInetLoopbackTest, TCPPassiveCloseNoTimeWaitReuseTest) {
|
||||
auto const& param = GetParam();
|
||||
sockaddr_storage listen_addr, conn_bound_addr;
|
||||
listen_addr = param.listener.addr;
|
||||
|
@ -1236,7 +1235,7 @@ TEST_P(SocketInetLoopbackTest,
|
|||
SyscallSucceeds());
|
||||
}
|
||||
|
||||
TEST_P(SocketInetLoopbackTest, TCPActiveCloseTimeWaitTest_NoRandomSave) {
|
||||
TEST_P(SocketInetLoopbackTest, TCPActiveCloseTimeWaitTest) {
|
||||
auto const& param = GetParam();
|
||||
sockaddr_storage listen_addr, conn_bound_addr;
|
||||
listen_addr = param.listener.addr;
|
||||
|
@ -1250,7 +1249,7 @@ TEST_P(SocketInetLoopbackTest, TCPActiveCloseTimeWaitTest_NoRandomSave) {
|
|||
SyscallFailsWithErrno(EADDRINUSE));
|
||||
}
|
||||
|
||||
TEST_P(SocketInetLoopbackTest, TCPActiveCloseTimeWaitReuseTest_NoRandomSave) {
|
||||
TEST_P(SocketInetLoopbackTest, TCPActiveCloseTimeWaitReuseTest) {
|
||||
auto const& param = GetParam();
|
||||
sockaddr_storage listen_addr, conn_bound_addr;
|
||||
listen_addr = param.listener.addr;
|
||||
|
@ -1425,7 +1424,7 @@ TEST_P(SocketInetLoopbackTest, TCPAcceptAfterReset) {
|
|||
|
||||
// TODO(gvisor.dev/issue/1688): Partially completed passive endpoints are not
|
||||
// saved. Enable S/R once issue is fixed.
|
||||
TEST_P(SocketInetLoopbackTest, TCPDeferAccept_NoRandomSave) {
|
||||
TEST_P(SocketInetLoopbackTest, TCPDeferAccept) {
|
||||
// TODO(gvisor.dev/issue/1688): Partially completed passive endpoints are not
|
||||
// saved. Enable S/R issue is fixed.
|
||||
DisableSave ds;
|
||||
|
@ -1505,7 +1504,7 @@ TEST_P(SocketInetLoopbackTest, TCPDeferAccept_NoRandomSave) {
|
|||
|
||||
// TODO(gvisor.dev/issue/1688): Partially completed passive endpoints are not
|
||||
// saved. Enable S/R once issue is fixed.
|
||||
TEST_P(SocketInetLoopbackTest, TCPDeferAcceptTimeout_NoRandomSave) {
|
||||
TEST_P(SocketInetLoopbackTest, TCPDeferAcceptTimeout) {
|
||||
// TODO(gvisor.dev/issue/1688): Partially completed passive endpoints are not
|
||||
// saved. Enable S/R once issue is fixed.
|
||||
DisableSave ds;
|
||||
|
@ -1609,9 +1608,9 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
|
||||
using SocketInetReusePortTest = ::testing::TestWithParam<TestParam>;
|
||||
|
||||
// TODO(gvisor.dev/issue/940): Remove _NoRandomSave when portHint/stack.Seed is
|
||||
// TODO(gvisor.dev/issue/940): Remove when portHint/stack.Seed is
|
||||
// saved/restored.
|
||||
TEST_P(SocketInetReusePortTest, TcpPortReuseMultiThread_NoRandomSave) {
|
||||
TEST_P(SocketInetReusePortTest, TcpPortReuseMultiThread) {
|
||||
auto const& param = GetParam();
|
||||
|
||||
TestAddress const& listener = param.listener;
|
||||
|
@ -1721,7 +1720,7 @@ TEST_P(SocketInetReusePortTest, TcpPortReuseMultiThread_NoRandomSave) {
|
|||
EquivalentWithin((kConnectAttempts / kThreadCount), 0.10));
|
||||
}
|
||||
|
||||
TEST_P(SocketInetReusePortTest, UdpPortReuseMultiThread_NoRandomSave) {
|
||||
TEST_P(SocketInetReusePortTest, UdpPortReuseMultiThread) {
|
||||
auto const& param = GetParam();
|
||||
|
||||
TestAddress const& listener = param.listener;
|
||||
|
@ -1832,7 +1831,7 @@ TEST_P(SocketInetReusePortTest, UdpPortReuseMultiThread_NoRandomSave) {
|
|||
EquivalentWithin((kConnectAttempts / kThreadCount), 0.10));
|
||||
}
|
||||
|
||||
TEST_P(SocketInetReusePortTest, UdpPortReuseMultiThreadShort_NoRandomSave) {
|
||||
TEST_P(SocketInetReusePortTest, UdpPortReuseMultiThreadShort) {
|
||||
auto const& param = GetParam();
|
||||
|
||||
TestAddress const& listener = param.listener;
|
||||
|
|
|
@ -86,7 +86,7 @@ using SocketInetLoopbackTest = ::testing::TestWithParam<TestParam>;
|
|||
// We disable S/R because this test creates a large number of sockets.
|
||||
//
|
||||
// FIXME(b/162475855): This test is failing reliably.
|
||||
TEST_P(SocketInetLoopbackTest, DISABLED_TestTCPPortExhaustion_NoRandomSave) {
|
||||
TEST_P(SocketInetLoopbackTest, DISABLED_TestTCPPortExhaustion) {
|
||||
auto const& param = GetParam();
|
||||
TestAddress const& listener = param.listener;
|
||||
TestAddress const& connector = param.connector;
|
||||
|
@ -179,8 +179,7 @@ std::string DescribeProtocolTestParam(
|
|||
using SocketMultiProtocolInetLoopbackTest =
|
||||
::testing::TestWithParam<ProtocolTestParam>;
|
||||
|
||||
TEST_P(SocketMultiProtocolInetLoopbackTest,
|
||||
BindAvoidsListeningPortsReuseAddr_NoRandomSave) {
|
||||
TEST_P(SocketMultiProtocolInetLoopbackTest, BindAvoidsListeningPortsReuseAddr) {
|
||||
const auto& param = GetParam();
|
||||
// UDP sockets are allowed to bind/listen on the port w/ SO_REUSEADDR, for TCP
|
||||
// this is only permitted if there is no other listening socket.
|
||||
|
|
|
@ -1153,7 +1153,7 @@ TEST_P(TCPSocketPairTest, IpMulticastLoopDefault) {
|
|||
EXPECT_EQ(get, 1);
|
||||
}
|
||||
|
||||
TEST_P(TCPSocketPairTest, TCPResetDuringClose_NoRandomSave) {
|
||||
TEST_P(TCPSocketPairTest, TCPResetDuringClose) {
|
||||
DisableSave ds; // Too many syscalls.
|
||||
constexpr int kThreadCount = 1000;
|
||||
std::unique_ptr<ScopedThread> instances[kThreadCount];
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace testing {
|
|||
// Test fixture for tests that apply to pairs of IP sockets.
|
||||
using IPv6UnboundSocketTest = SimpleSocketTest;
|
||||
|
||||
TEST_P(IPv6UnboundSocketTest, ConnectToBadLocalAddress_NoRandomSave) {
|
||||
TEST_P(IPv6UnboundSocketTest, ConnectToBadLocalAddress) {
|
||||
SKIP_IF(!ASSERT_NO_ERRNO_AND_VALUE(HaveCapability(CAP_NET_ADMIN)));
|
||||
|
||||
// TODO(gvisor.dev/issue/4595): Addresses on net devices are not saved
|
||||
|
@ -68,7 +68,7 @@ INSTANTIATE_TEST_SUITE_P(IPUnboundSockets, IPv6UnboundSocketTest,
|
|||
|
||||
using IPv4UnboundSocketTest = SimpleSocketTest;
|
||||
|
||||
TEST_P(IPv4UnboundSocketTest, ConnectToBadLocalAddress_NoRandomSave) {
|
||||
TEST_P(IPv4UnboundSocketTest, ConnectToBadLocalAddress) {
|
||||
SKIP_IF(!ASSERT_NO_ERRNO_AND_VALUE(HaveCapability(CAP_NET_ADMIN)));
|
||||
|
||||
// TODO(gvisor.dev/issue/4595): Addresses on net devices are not saved
|
||||
|
|
|
@ -1625,7 +1625,7 @@ TEST_P(IPv4UDPUnboundSocketTest, TestBindToBcastThenSend) {
|
|||
//
|
||||
// FIXME(gvisor.dev/issue/873): Endpoint order is not restored correctly. Enable
|
||||
// random and co-op save (below) once that is fixed.
|
||||
TEST_P(IPv4UDPUnboundSocketTest, ReuseAddrDistribution_NoRandomSave) {
|
||||
TEST_P(IPv4UDPUnboundSocketTest, ReuseAddrDistribution) {
|
||||
std::vector<std::unique_ptr<FileDescriptor>> sockets;
|
||||
sockets.emplace_back(ASSERT_NO_ERRNO_AND_VALUE(NewSocket()));
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ using IPv4UDPUnboundSocketNogotsanTest = SimpleSocketTest;
|
|||
|
||||
// Check that connect returns EAGAIN when out of local ephemeral ports.
|
||||
// We disable S/R because this test creates a large number of sockets.
|
||||
TEST_P(IPv4UDPUnboundSocketNogotsanTest,
|
||||
UDPConnectPortExhaustion_NoRandomSave) {
|
||||
TEST_P(IPv4UDPUnboundSocketNogotsanTest, UDPConnectPortExhaustion) {
|
||||
auto receiver1 = ASSERT_NO_ERRNO_AND_VALUE(NewSocket());
|
||||
constexpr int kClients = 65536;
|
||||
// Bind the first socket to the loopback and take note of the selected port.
|
||||
|
@ -60,7 +59,7 @@ TEST_P(IPv4UDPUnboundSocketNogotsanTest,
|
|||
|
||||
// Check that bind returns EADDRINUSE when out of local ephemeral ports.
|
||||
// We disable S/R because this test creates a large number of sockets.
|
||||
TEST_P(IPv4UDPUnboundSocketNogotsanTest, UDPBindPortExhaustion_NoRandomSave) {
|
||||
TEST_P(IPv4UDPUnboundSocketNogotsanTest, UDPBindPortExhaustion) {
|
||||
auto receiver1 = ASSERT_NO_ERRNO_AND_VALUE(NewSocket());
|
||||
constexpr int kClients = 65536;
|
||||
auto addr = V4Loopback();
|
||||
|
|
|
@ -68,7 +68,7 @@ TEST_P(BlockingStreamSocketPairTest, BlockPartialWriteClosed) {
|
|||
|
||||
// Random save may interrupt the call to sendmsg() in SendLargeSendMsg(),
|
||||
// causing the write to be incomplete and the test to hang.
|
||||
TEST_P(BlockingStreamSocketPairTest, SendMsgTooLarge_NoRandomSave) {
|
||||
TEST_P(BlockingStreamSocketPairTest, SendMsgTooLarge) {
|
||||
auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair());
|
||||
|
||||
int sndbuf;
|
||||
|
@ -102,7 +102,7 @@ TEST_P(BlockingStreamSocketPairTest, RecvLessThanBuffer) {
|
|||
// Test that MSG_WAITALL causes recv to block until all requested data is
|
||||
// received. Random save can interrupt blocking and cause received data to be
|
||||
// returned, even if the amount received is less than the full requested amount.
|
||||
TEST_P(BlockingStreamSocketPairTest, RecvLessThanBufferWaitAll_NoRandomSave) {
|
||||
TEST_P(BlockingStreamSocketPairTest, RecvLessThanBufferWaitAll) {
|
||||
auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair());
|
||||
|
||||
char sent_data[100];
|
||||
|
|
|
@ -239,7 +239,7 @@ TEST_P(UnixNonStreamSocketPairTest, SendTimeout) {
|
|||
SyscallSucceeds());
|
||||
|
||||
// The buffer size should be big enough to avoid many iterations in the next
|
||||
// loop. Otherwise, this will slow down cooperative_save tests.
|
||||
// loop. Otherwise, this will slow down save tests.
|
||||
std::vector<char> buf(kPageSize);
|
||||
for (;;) {
|
||||
int ret;
|
||||
|
|
|
@ -883,7 +883,7 @@ TEST(SpliceTest, FromPipeToDevZero) {
|
|||
static volatile int signaled = 0;
|
||||
void SigUsr1Handler(int sig, siginfo_t* info, void* context) { signaled = 1; }
|
||||
|
||||
TEST(SpliceTest, ToPipeWithSmallCapacityDoesNotSpin_NoRandomSave) {
|
||||
TEST(SpliceTest, ToPipeWithSmallCapacityDoesNotSpin) {
|
||||
// Writes to a pipe that are less than PIPE_BUF must be atomic. This test
|
||||
// creates a pipe with only 128 bytes of capacity (< PIPE_BUF) and checks that
|
||||
// splicing to the pipe does not spin. See b/170743336.
|
||||
|
|
|
@ -248,7 +248,7 @@ TEST(SymlinkTest, PwriteToSymlink) {
|
|||
EXPECT_THAT(unlink(linkname.c_str()), SyscallSucceeds());
|
||||
}
|
||||
|
||||
TEST(SymlinkTest, SymlinkAtDegradedPermissions_NoRandomSave) {
|
||||
TEST(SymlinkTest, SymlinkAtDegradedPermissions) {
|
||||
// Drop capabilities that allow us to override file and directory permissions.
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_OVERRIDE, false));
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_READ_SEARCH, false));
|
||||
|
@ -299,7 +299,7 @@ TEST(SymlinkTest, ReadlinkAtDirWithOpath) {
|
|||
EXPECT_EQ(0, strncmp("/dangling", buf.data(), linksize));
|
||||
}
|
||||
|
||||
TEST(SymlinkTest, ReadlinkAtDegradedPermissions_NoRandomSave) {
|
||||
TEST(SymlinkTest, ReadlinkAtDegradedPermissions) {
|
||||
// Drop capabilities that allow us to override file and directory permissions.
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_OVERRIDE, false));
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_READ_SEARCH, false));
|
||||
|
|
|
@ -324,7 +324,7 @@ TEST_P(TcpSocketTest, NonblockingLargeWrite) {
|
|||
|
||||
// Test that a blocking write with a buffer that is larger than the send buffer
|
||||
// will block until the entire buffer is sent.
|
||||
TEST_P(TcpSocketTest, BlockingLargeWrite_NoRandomSave) {
|
||||
TEST_P(TcpSocketTest, BlockingLargeWrite) {
|
||||
// Allocate a buffer three times the size of the send buffer on the heap. We
|
||||
// do this as a vector to avoid allocating on the stack.
|
||||
int size = 3 * sendbuf_size_;
|
||||
|
@ -408,7 +408,7 @@ TEST_P(TcpSocketTest, NonblockingLargeSend) {
|
|||
}
|
||||
|
||||
// Same test as above, but calls send instead of write.
|
||||
TEST_P(TcpSocketTest, BlockingLargeSend_NoRandomSave) {
|
||||
TEST_P(TcpSocketTest, BlockingLargeSend) {
|
||||
// Allocate a buffer three times the size of the send buffer. We do this on
|
||||
// with a vector to avoid allocating on the stack.
|
||||
int size = 3 * sendbuf_size_;
|
||||
|
@ -1095,7 +1095,7 @@ TEST_P(SimpleTcpSocketTest, NonBlockingConnectNoListenerPeek) {
|
|||
SyscallFailsWithErrno(ECONNABORTED));
|
||||
}
|
||||
|
||||
TEST_P(SimpleTcpSocketTest, SelfConnectSendRecv_NoRandomSave) {
|
||||
TEST_P(SimpleTcpSocketTest, SelfConnectSendRecv) {
|
||||
// Initialize address to the loopback one.
|
||||
sockaddr_storage addr =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(InetLoopbackAddr(GetParam()));
|
||||
|
@ -1143,7 +1143,7 @@ TEST_P(SimpleTcpSocketTest, SelfConnectSendRecv_NoRandomSave) {
|
|||
EXPECT_EQ(read_bytes, kBufSz);
|
||||
}
|
||||
|
||||
TEST_P(SimpleTcpSocketTest, SelfConnectSend_NoRandomSave) {
|
||||
TEST_P(SimpleTcpSocketTest, SelfConnectSend) {
|
||||
// Initialize address to the loopback one.
|
||||
sockaddr_storage addr =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(InetLoopbackAddr(GetParam()));
|
||||
|
|
|
@ -114,7 +114,7 @@ TEST_P(TimerfdTest, BlockingRead) {
|
|||
EXPECT_GE((end_time - start_time) + TimerSlack(), kDelay);
|
||||
}
|
||||
|
||||
TEST_P(TimerfdTest, NonblockingRead_NoRandomSave) {
|
||||
TEST_P(TimerfdTest, NonblockingRead) {
|
||||
constexpr absl::Duration kDelay = absl::Seconds(5);
|
||||
|
||||
auto const tfd =
|
||||
|
|
|
@ -208,7 +208,7 @@ TEST(TruncateTest, FtruncateWithOpath) {
|
|||
|
||||
// ftruncate(2) should succeed as long as the file descriptor is writeable,
|
||||
// regardless of whether the file permissions allow writing.
|
||||
TEST(TruncateTest, FtruncateWithoutWritePermission_NoRandomSave) {
|
||||
TEST(TruncateTest, FtruncateWithoutWritePermission) {
|
||||
// Drop capabilities that allow us to override file permissions.
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_OVERRIDE, false));
|
||||
|
||||
|
@ -230,7 +230,7 @@ TEST(TruncateTest, TruncateNonExist) {
|
|||
EXPECT_THAT(truncate("/foo/bar", 0), SyscallFailsWithErrno(ENOENT));
|
||||
}
|
||||
|
||||
TEST(TruncateTest, FtruncateVirtualTmp_NoRandomSave) {
|
||||
TEST(TruncateTest, FtruncateVirtualTmp) {
|
||||
auto temp_file = NewTempAbsPathInDir("/dev/shm");
|
||||
const DisableSave ds; // Incompatible permissions.
|
||||
const FileDescriptor fd =
|
||||
|
|
|
@ -64,7 +64,7 @@ TEST(UnlinkTest, AtDir) {
|
|||
ASSERT_THAT(close(dirfd), SyscallSucceeds());
|
||||
}
|
||||
|
||||
TEST(UnlinkTest, AtDirDegradedPermissions_NoRandomSave) {
|
||||
TEST(UnlinkTest, AtDirDegradedPermissions) {
|
||||
// Drop capabilities that allow us to override file and directory permissions.
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_OVERRIDE, false));
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_READ_SEARCH, false));
|
||||
|
@ -162,7 +162,7 @@ TEST(UnlinkTest, AtFile) {
|
|||
EXPECT_THAT(unlinkat(dirfd, "UnlinkAtFile", 0), SyscallSucceeds());
|
||||
}
|
||||
|
||||
TEST(UnlinkTest, OpenFile_NoRandomSave) {
|
||||
TEST(UnlinkTest, OpenFile) {
|
||||
// We can't save unlinked file unless they are on tmpfs.
|
||||
const DisableSave ds;
|
||||
auto file = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFile());
|
||||
|
|
|
@ -87,7 +87,7 @@ TEST(VforkTest, ParentStopsUntilChildExits) {
|
|||
EXPECT_THAT(InForkedProcess(test), IsPosixErrorOkAndHolds(0));
|
||||
}
|
||||
|
||||
TEST(VforkTest, ParentStopsUntilChildExecves_NoRandomSave) {
|
||||
TEST(VforkTest, ParentStopsUntilChildExecves) {
|
||||
ExecveArray const owned_child_argv = {"/proc/self/exe", "--vfork_test_child"};
|
||||
char* const* const child_argv = owned_child_argv.get();
|
||||
|
||||
|
@ -127,7 +127,7 @@ TEST(VforkTest, ParentStopsUntilChildExecves_NoRandomSave) {
|
|||
|
||||
// A vfork child does not unstop the parent a second time when it exits after
|
||||
// exec.
|
||||
TEST(VforkTest, ExecedChildExitDoesntUnstopParent_NoRandomSave) {
|
||||
TEST(VforkTest, ExecedChildExitDoesntUnstopParent) {
|
||||
ExecveArray const owned_child_argv = {"/proc/self/exe", "--vfork_test_child"};
|
||||
char* const* const child_argv = owned_child_argv.get();
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ TEST_F(XattrTest, XattrInvalidPrefix) {
|
|||
|
||||
// Do not allow save/restore cycles after making the test file read-only, as
|
||||
// the restore will fail to open it with r/w permissions.
|
||||
TEST_F(XattrTest, XattrReadOnly_NoRandomSave) {
|
||||
TEST_F(XattrTest, XattrReadOnly) {
|
||||
// Drop capabilities that allow us to override file and directory permissions.
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_OVERRIDE, false));
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_READ_SEARCH, false));
|
||||
|
@ -138,7 +138,7 @@ TEST_F(XattrTest, XattrReadOnly_NoRandomSave) {
|
|||
|
||||
// Do not allow save/restore cycles after making the test file write-only, as
|
||||
// the restore will fail to open it with r/w permissions.
|
||||
TEST_F(XattrTest, XattrWriteOnly_NoRandomSave) {
|
||||
TEST_F(XattrTest, XattrWriteOnly) {
|
||||
// Drop capabilities that allow us to override file and directory permissions.
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_OVERRIDE, false));
|
||||
ASSERT_NO_ERRNO(SetCapability(CAP_DAC_READ_SEARCH, false));
|
||||
|
|
|
@ -27,23 +27,13 @@ namespace gvisor {
|
|||
namespace testing {
|
||||
namespace {
|
||||
|
||||
std::atomic<absl::optional<bool>> cooperative_save_present;
|
||||
std::atomic<absl::optional<bool>> random_save_present;
|
||||
std::atomic<absl::optional<bool>> save_present;
|
||||
|
||||
bool CooperativeSavePresent() {
|
||||
auto present = cooperative_save_present.load();
|
||||
bool SavePresent() {
|
||||
auto present = save_present.load();
|
||||
if (!present.has_value()) {
|
||||
present = getenv("GVISOR_COOPERATIVE_SAVE_TEST") != nullptr;
|
||||
cooperative_save_present.store(present);
|
||||
}
|
||||
return present.value();
|
||||
}
|
||||
|
||||
bool RandomSavePresent() {
|
||||
auto present = random_save_present.load();
|
||||
if (!present.has_value()) {
|
||||
present = getenv("GVISOR_RANDOM_SAVE_TEST") != nullptr;
|
||||
random_save_present.store(present);
|
||||
present = getenv("GVISOR_SAVE_TEST") != nullptr;
|
||||
save_present.store(present);
|
||||
}
|
||||
return present.value();
|
||||
}
|
||||
|
@ -52,12 +42,10 @@ std::atomic<int> save_disable;
|
|||
|
||||
} // namespace
|
||||
|
||||
bool IsRunningWithSaveRestore() {
|
||||
return CooperativeSavePresent() || RandomSavePresent();
|
||||
}
|
||||
bool IsRunningWithSaveRestore() { return SavePresent(); }
|
||||
|
||||
void MaybeSave() {
|
||||
if (CooperativeSavePresent() && save_disable.load() == 0) {
|
||||
if (SavePresent() && save_disable.load() == 0) {
|
||||
internal::DoCooperativeSave();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue