Skip to content

[3.11] gh-90473: Skip and document more failing tests on WASI (GH-93436) #93443

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
Jun 3, 2022
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
3 changes: 3 additions & 0 deletions Lib/test/test_compileall.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,9 @@ class CompileallTestsWithoutSourceEpoch(CompileallTestsBase,
pass


# WASI does not have a temp directory and uses cwd instead. The cwd contains
# non-ASCII chars, so _walk_dir() fails to encode self.directory.
@unittest.skipIf(support.is_wasi, "tempdir is not encodable on WASI")
class EncodingTest(unittest.TestCase):
"""Issue 6716: compileall should escape source code when printing errors
to stdout."""
Expand Down
8 changes: 6 additions & 2 deletions Lib/test/test_import/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

from test.support import os_helper
from test.support import (
STDLIB_DIR, is_jython, swap_attr, swap_item, cpython_only, is_emscripten)
STDLIB_DIR, is_jython, swap_attr, swap_item, cpython_only, is_emscripten,
is_wasi)
from test.support.import_helper import (
forget, make_legacy_pyc, unlink, unload, DirsOnSysPath, CleanImport)
from test.support.os_helper import (
Expand Down Expand Up @@ -535,7 +536,10 @@ class FilePermissionTests(unittest.TestCase):

@unittest.skipUnless(os.name == 'posix',
"test meaningful only on posix systems")
@unittest.skipIf(is_emscripten, "Emscripten's umask is a stub.")
@unittest.skipIf(
is_emscripten or is_wasi,
"Emscripten's/WASI's umask is a stub."
)
def test_creation_mode(self):
mask = 0o022
with temp_umask(mask), _ready_to_import() as (name, path):
Expand Down
8 changes: 7 additions & 1 deletion Lib/test/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ def test_access(self):
@unittest.skipIf(
support.is_emscripten, "Test is unstable under Emscripten."
)
@unittest.skipIf(
support.is_wasi, "WASI does not support dup."
)
def test_closerange(self):
first = os.open(os_helper.TESTFN, os.O_CREAT|os.O_RDWR)
# We must allocate two consecutive file descriptors, otherwise
Expand Down Expand Up @@ -1588,7 +1591,10 @@ def test_makedir(self):
'dir5', 'dir6')
os.makedirs(path)

@unittest.skipIf(support.is_emscripten, "Emscripten's umask is a stub.")
@unittest.skipIf(
support.is_emscripten or support.is_wasi,
"Emscripten's/WASI's umask is a stub."
)
def test_mode(self):
with os_helper.temp_umask(0o002):
base = os_helper.TESTFN
Expand Down
3 changes: 3 additions & 0 deletions Lib/test/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2375,6 +2375,9 @@ def test_is_socket_false(self):
@unittest.skipIf(
is_emscripten, "Unix sockets are not implemented on Emscripten."
)
@unittest.skipIf(
is_wasi, "Cannot create socket on WASI."
)
def test_is_socket_true(self):
P = self.cls(BASE, 'mysock')
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
Expand Down
1 change: 1 addition & 0 deletions Lib/test/test_shutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -2652,6 +2652,7 @@ def test_stty_match(self):

self.assertEqual(expected, actual)

@unittest.skipIf(support.is_wasi, "WASI has no /dev/null")
def test_fallback(self):
with os_helper.EnvironmentVarGuard() as env:
del env['LINES']
Expand Down
14 changes: 13 additions & 1 deletion Tools/wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,25 @@ are:
``socket.gethostbyname()`` are not implemented and always fail.
- ``chmod(2)`` is not available. It's not possible to modify file permissions,
yet. A future version of WASI may provide a limited ``set_permissions`` API.
- User/group related features like ``os.chown()``, ``os.getuid``, etc. are
stubs or fail with ``ENOTSUP``.
- File locking (``fcntl``) is not available.
- ``os.pipe()``, ``os.mkfifo()``, and ``os.mknod()`` are not supported.
- ``process_time`` does not work as expected because it's implemented using
wall clock.
- ``os.umask`` is a stub.
- ``os.umask()`` is a stub.
- ``sys.executable`` is empty.
- ``/dev/null`` / ``os.devnull`` may not be available.
- ``os.utime*()`` is buggy in WASM SDK 15.0, see
[utimensat() with timespec=NULL sets wrong time](https://github.com/bytecodealliance/wasmtime/issues/4184)
- ``os.symlink()`` fails with ``PermissionError`` when attempting to create a
symlink with an absolute path with wasmtime 0.36.0. The wasmtime runtime
uses ``openat2(2)`` syscall with flag ``RESOLVE_BENEATH`` to open files.
The flag causes the syscall to reject symlinks with absolute paths.
- ``os.curdir`` (aka ``.``) seems to behave differently, which breaks some
``importlib`` tests that add ``.`` to ``sys.path`` and indirectly
``sys.path_importer_cache``.
- WASI runtime environments may not provide a dedicated temp directory.


# Detect WebAssembly builds
Expand Down
1 change: 1 addition & 0 deletions Tools/wasm/config.site-wasm32-wasi
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ ac_cv_func_mkfifo=no
ac_cv_func_mkfifoat=no
ac_cv_func_mknod=no
ac_cv_func_mknodat=no
ac_cv_func_makedev=no

# fdopendir() fails on SDK 15.0,
# OSError: [Errno 28] Invalid argument: '.'
Expand Down
3 changes: 3 additions & 0 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -6673,10 +6673,13 @@ AS_CASE([$ac_sys_system],
],
[Emscripten/node*], [],
[WASI/*], [
dnl WASI SDK 15.0 does not support file locking.
dnl WASI SDK 15.0 does not support file locking, mmap, and more.
PY_STDLIB_MOD_SET_NA(
[_ctypes_test],
[fcntl],
[fcntl],
[mmap],
[resource],
[termios],
)
]
)
Expand Down