mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-124213: Skip tests failing inside systemd-nspawn --suppress-sync=true (#124215)
Add a helper function that checks whether the test suite is running inside a systemd-nspawn container, and skip the few tests failing with `--suppress-sync=true` in that case. The tests are failing because `--suppress-sync=true` stubs out `fsync()`, `fdatasync()` and `msync()` calls, and therefore they always return success without checking for invalid arguments. Call `os.open(__file__, os.O_RDONLY | os.O_SYNC)` and check the errno to detect whether `--suppress-sync=true` is actually used, and skip the tests only in that scenario.
This commit is contained in:
parent
1a577729e3
commit
342e654b8e
4 changed files with 46 additions and 4 deletions
|
@ -2351,9 +2351,13 @@ class Win32ErrorTests(unittest.TestCase):
|
|||
|
||||
@unittest.skipIf(support.is_wasi, "Cannot create invalid FD on WASI.")
|
||||
class TestInvalidFD(unittest.TestCase):
|
||||
singles = ["fchdir", "dup", "fdatasync", "fstat",
|
||||
"fstatvfs", "fsync", "tcgetpgrp", "ttyname"]
|
||||
singles_fildes = {"fchdir", "fdatasync", "fsync"}
|
||||
singles = ["fchdir", "dup", "fstat", "fstatvfs", "tcgetpgrp", "ttyname"]
|
||||
singles_fildes = {"fchdir"}
|
||||
# systemd-nspawn --suppress-sync=true does not verify fd passed
|
||||
# fdatasync() and fsync(), and always returns success
|
||||
if not support.in_systemd_nspawn_sync_suppressed():
|
||||
singles += ["fdatasync", "fsync"]
|
||||
singles_fildes |= {"fdatasync", "fsync"}
|
||||
#singles.append("close")
|
||||
#We omit close because it doesn't raise an exception on some platforms
|
||||
def get_single(f):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue