-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-124213: Skip tests failing with --suppress-sync=true
when inside systemd-nspawn container
#124215
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
Conversation
…n inside systemd-nspawn container Add a helper functon 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. Technically, this means that the tests are also skipped when running inside systemd-nspawn container without `--suppress-sync=true`. However, to the best of my knowledge the only way to detect this option is to actually reproduce one of the unexpectedly-succeeding syscalls, and since this is precisely what we're testing for, the skip-test and the actual test would be doing the same thing.
Misc/NEWS.d/next/Tests/2024-09-18-18-39-21.gh-issue-124213.AQq_xg.rst
Outdated
Show resolved
Hide resolved
Add a docstring explaining the function in detail. Switch from pathlib to plain `open().read()`. Update the news entry.
Thanks. Updated per your comments. Thinking about it, I think I could make the skips a bit more specific — that is, detect |
Call `os.open("", 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.
Co-authored-by: Victor Stinner <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
self.assertIsNone(result) | ||
if sys.platform.startswith(('linux', 'android')): | ||
if (sys.platform.startswith(('linux', 'android')) | ||
and not in_systemd_nspawn_sync_suppressed()): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I wanted to avoid this because it's very confusing when the condition has the same indent as the code below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but the line was too long. That's the problem of long function names.
if (sys.platform.startswith(('linux', 'android')) | ||
and not in_systemd_nspawn_sync_suppressed()): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could follow black here:
if (sys.platform.startswith(('linux', 'android')) | |
and not in_systemd_nspawn_sync_suppressed()): | |
if ( | |
sys.platform.startswith(("linux", "android")) | |
and not in_systemd_nspawn_sync_suppressed() | |
): |
Merged, thanks. |
Thanks! |
…sync=true (python#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.
…sync=true (python#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.
Add a helper functon 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 outfsync()
,fdatasync()
andmsync()
calls, and therefore they always return success without checking for invalid arguments.Technically, this means that the tests are also skipped when running inside systemd-nspawn container without
--suppress-sync=true
. However, to the best of my knowledge the only way to detect this option is to actually reproduce one of the unexpectedly-succeeding syscalls, and since this is precisely what we're testing for, the skip-test and the actual test would be doing the same thing.systemd-nspawn --suppress-sync=true
container #124213