mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix flaky inotify exec test.
I believe in some cases some other process/thread in the testsuite also uses /bin/true, and happens to generate more events than expected. PiperOrigin-RevId: 605760072
This commit is contained in:
committed by
gVisor bot
parent
a3c06e8493
commit
7e75cb107b
@@ -1987,14 +1987,18 @@ TEST(Inotify, Xattr) {
|
||||
TEST(Inotify, Exec) {
|
||||
const FileDescriptor fd =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(InotifyInit1(IN_NONBLOCK));
|
||||
const int wd = ASSERT_NO_ERRNO_AND_VALUE(
|
||||
InotifyAddWatch(fd.get(), "/bin/true", IN_ALL_EVENTS));
|
||||
// Create a new executable file instead of using /bin/true directly in case
|
||||
// the test suite uses it at any point and generates extra events.
|
||||
TempPath p = ASSERT_NO_ERRNO_AND_VALUE(
|
||||
TempPath::CreateFileWith(GetAbsoluteTestTmpdir(), "#!/bin/true", 0755));
|
||||
|
||||
const int wd = ASSERT_NO_ERRNO_AND_VALUE(
|
||||
InotifyAddWatch(fd.get(), p.path(), IN_ALL_EVENTS));
|
||||
// Perform exec.
|
||||
pid_t child = -1;
|
||||
int execve_errno = -1;
|
||||
auto kill = ASSERT_NO_ERRNO_AND_VALUE(
|
||||
ForkAndExec("/bin/true", {}, {}, nullptr, &child, &execve_errno));
|
||||
ForkAndExec(p.path(), {}, {}, nullptr, &child, &execve_errno));
|
||||
ASSERT_EQ(0, execve_errno);
|
||||
|
||||
int status;
|
||||
|
||||
Reference in New Issue
Block a user