Skip to content

bpo-38692: Skip test_posix.test_pidfd_open() on EPERM #17290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Lib/test/test_posix.py
Original file line number Diff line number Diff line change
Expand Up @@ -1476,6 +1476,8 @@ def test_pidfd_open(self):
os.pidfd_open(-1)
if cm.exception.errno == errno.ENOSYS:
self.skipTest("system does not support pidfd_open")
if isinstance(cm.exception, PermissionError):
self.skipTest(f"pidfd_open syscall blocked: {cm.exception!r}")
self.assertEqual(cm.exception.errno, errno.EINVAL)
os.close(os.pidfd_open(os.getpid(), 0))

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Skip the test_posix.test_pidfd_open() test if ``os.pidfd_open()`` fails with a
:exc:`PermissionError`. This situation can happen in a Linux sandbox using a
syscall whitelist which doesn't allow the ``pidfd_open()`` syscall yet.