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
|
@ -1,5 +1,6 @@
|
|||
from test.support import (
|
||||
requires, _2G, _4G, gc_collect, cpython_only, is_emscripten, is_apple,
|
||||
in_systemd_nspawn_sync_suppressed,
|
||||
)
|
||||
from test.support.import_helper import import_module
|
||||
from test.support.os_helper import TESTFN, unlink
|
||||
|
@ -839,7 +840,8 @@ class MmapTests(unittest.TestCase):
|
|||
mm.write(b'python')
|
||||
result = mm.flush()
|
||||
self.assertIsNone(result)
|
||||
if sys.platform.startswith(('linux', 'android')):
|
||||
if (sys.platform.startswith(('linux', 'android'))
|
||||
and not in_systemd_nspawn_sync_suppressed()):
|
||||
# 'offset' must be a multiple of mmap.PAGESIZE on Linux.
|
||||
# See bpo-34754 for details.
|
||||
self.assertRaises(OSError, mm.flush, 1, len(b'python'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue