Fix inotify_test_native on Buildkite.

PiperOrigin-RevId: 605496604
This commit is contained in:
Jamie Liu
2024-02-08 19:39:42 -08:00
committed by gVisor bot
parent a4c27c0722
commit 272d23e1e2
+19 -4
View File
@@ -1871,11 +1871,26 @@ TEST(Inotify, SpliceOnWatchTarget) {
EXPECT_THAT(splice(pipefds[0], nullptr, fd.get(), nullptr, 1, /*flags=*/0),
SyscallSucceedsWithValue(1));
// On Linux, between 983652c69199 ("splice: report related fsnotify events")
// and d53471ba6f7a ("splice: remove permission hook from
// iter_file_splice_write()"), splice(2) generates two modification events in
// many cases, by calling fsnotify_modify() in both fs/splice.c:do_splice()
// and fs/splice.c:iter_file_splice_write() =>
// fs/read_write.c:vfs_iter_write() => do_iter_write().
events = ASSERT_NO_ERRNO_AND_VALUE(DrainEvents(inotify_fd.get()));
ASSERT_THAT(events, Are({
Event(IN_MODIFY, dir_wd, Basename(file.path())),
Event(IN_MODIFY, file_wd),
}));
if (events.size() == 4) {
EXPECT_THAT(events, Are({
Event(IN_MODIFY, dir_wd, Basename(file.path())),
Event(IN_MODIFY, file_wd),
Event(IN_MODIFY, dir_wd, Basename(file.path())),
Event(IN_MODIFY, file_wd),
}));
} else {
EXPECT_THAT(events, Are({
Event(IN_MODIFY, dir_wd, Basename(file.path())),
Event(IN_MODIFY, file_wd),
}));
}
}
// Watches on a parent should not be triggered by actions on a hard link to one