diff options
author | Bhasker Hariharan <bhaskerh@google.com> | 2019-09-05 16:36:27 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-09-05 16:40:46 -0700 |
commit | eb074a61f22fb488b8518c8b6a0f4d9325758203 (patch) | |
tree | 4ed5855485ceaffd8e4e05df9f0ea57a4d50b004 /test/syscalls/linux | |
parent | fbdd3ff1da122c1197d2018268b5956a526363d3 (diff) |
Fix bug in proc_test.
TestNoDuplicates is racy as it tries to read the /proc file system
while the test is running. But it's possible that from the time a
directory entries are read and each entry processed something could
change and in some cases the entry being processed could have been
deleted. In such cases we should not fail the test but just
ignore the error and move on.
PiperOrigin-RevId: 267483094
Diffstat (limited to 'test/syscalls/linux')
-rw-r--r-- | test/syscalls/linux/proc.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/syscalls/linux/proc.cc b/test/syscalls/linux/proc.cc index 2b753b7d1..6f07803d9 100644 --- a/test/syscalls/linux/proc.cc +++ b/test/syscalls/linux/proc.cc @@ -1882,7 +1882,9 @@ void CheckDuplicatesRecursively(std::string path) { errno = 0; DIR* dir = opendir(path.c_str()); if (dir == nullptr) { - ASSERT_THAT(errno, ::testing::AnyOf(EPERM, EACCES)) << path; + // Ignore any directories we can't read or missing directories as the + // directory could have been deleted/mutated from the time the parent + // directory contents were read. return; } auto dir_closer = Cleanup([&dir]() { closedir(dir); }); |