mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
tests: fix errors detected by asan.
PiperOrigin-RevId: 289467083
This commit is contained in:
@@ -977,7 +977,7 @@ TEST(Inotify, WatchOnRelativePath) {
|
||||
ASSERT_NO_ERRNO_AND_VALUE(Open(file1.path(), O_RDONLY));
|
||||
|
||||
// Change working directory to root.
|
||||
const char* old_working_dir = get_current_dir_name();
|
||||
const FileDescriptor cwd = ASSERT_NO_ERRNO_AND_VALUE(Open(".", O_PATH));
|
||||
EXPECT_THAT(chdir(root.path().c_str()), SyscallSucceeds());
|
||||
|
||||
// Add a watch on file1 with a relative path.
|
||||
@@ -997,7 +997,7 @@ TEST(Inotify, WatchOnRelativePath) {
|
||||
// continue to hold a reference, random save/restore tests can fail if a save
|
||||
// is triggered after "root" is unlinked; we can't save deleted fs objects
|
||||
// with active references.
|
||||
EXPECT_THAT(chdir(old_working_dir), SyscallSucceeds());
|
||||
EXPECT_THAT(fchdir(cwd.get()), SyscallSucceeds());
|
||||
}
|
||||
|
||||
TEST(Inotify, ZeroLengthReadWriteDoesNotGenerateEvent) {
|
||||
|
||||
@@ -275,7 +275,8 @@ TEST_F(PollTest, Nfds) {
|
||||
// Each entry in the 'fds' array refers to the eventfd and polls for
|
||||
// "writable" events (events=POLLOUT). This essentially guarantees that the
|
||||
// poll() is a no-op and allows negative testing of the 'nfds' parameter.
|
||||
std::vector<struct pollfd> fds(max_fds, {.fd = efd.get(), .events = POLLOUT});
|
||||
std::vector<struct pollfd> fds(max_fds + 1,
|
||||
{.fd = efd.get(), .events = POLLOUT});
|
||||
|
||||
// Verify that 'nfds' up to RLIMIT_NOFILE are allowed.
|
||||
EXPECT_THAT(RetryEINTR(poll)(fds.data(), 1, 1), SyscallSucceedsWithValue(1));
|
||||
|
||||
@@ -154,7 +154,7 @@ void ReadBuffersOverlapping(int fd) {
|
||||
char* expected_ptr = expected.data();
|
||||
memcpy(expected_ptr, &kReadvTestData[overlap_bytes], overlap_bytes);
|
||||
memcpy(&expected_ptr[overlap_bytes], &kReadvTestData[overlap_bytes],
|
||||
kReadvTestDataSize);
|
||||
kReadvTestDataSize - overlap_bytes);
|
||||
|
||||
struct iovec iovs[2];
|
||||
iovs[0].iov_base = buffer.data();
|
||||
|
||||
Reference in New Issue
Block a user