- fd inheritance can't be modified because Emscripten doesn't support subprocesses anyway.
- setpriority always fails
- geteuid no longer causes problems with latest emsdk
- umask is a stub
- geteuid / getuid always return 0, but process cannot chown to random uid.
has_subprocess_support = not is_emscripten and not is_wasi
def requires_subprocess():
- """Used for subprocess, os.spawn calls"""
+ """Used for subprocess, os.spawn calls, fd inheritance"""
return unittest.skipUnless(has_subprocess_support, "requires subprocess support")
def test_writev(self):
self.check(os.writev, [b'abc'])
+ @support.requires_subprocess()
def test_inheritable(self):
self.check(os.get_inheritable)
self.check(os.set_inheritable, True)
self.skipTest("Could not determine the number of CPUs")
+# FD inheritance check is only useful for systems with process support.
+@support.requires_subprocess()
class FDInheritanceTests(unittest.TestCase):
def test_get_set_inheritable(self):
fd = os.open(__file__, os.O_RDONLY)
from unittest import mock
from test.support import import_helper
+from test.support import is_emscripten
from test.support import os_helper
from test.support.os_helper import TESTFN, FakePath
self.assertTrue(p.exists())
self.assertEqual(p.stat().st_ctime, st_ctime_first)
+ @unittest.skipIf(is_emscripten, "FS root cannot be modified on Emscripten.")
def test_mkdir_exist_ok_root(self):
# Issue #25803: A drive root could raise PermissionError on Windows.
self.cls('/').resolve().mkdir(exist_ok=True)
self.assertIs((P / 'fileA\x00').is_socket(), False)
@unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required")
+ @unittest.skipIf(
+ is_emscripten, "Unix sockets are not implemented on Emscripten."
+ )
def test_is_socket_true(self):
P = self.cls(BASE, 'mysock')
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
with self.assertRaises(RuntimeError):
print(path.resolve(strict))
+ @unittest.skipIf(
+ is_emscripten, "umask is not implemented on Emscripten."
+ )
def test_open_mode(self):
old_mask = os.umask(0)
self.addCleanup(os.umask, old_mask)
finally:
os.chdir(current_directory)
+ @unittest.skipIf(
+ is_emscripten, "umask is not implemented on Emscripten."
+ )
def test_touch_mode(self):
old_mask = os.umask(0)
self.addCleanup(os.umask, old_mask)
_DUMMY_SYMLINK = os.path.join(tempfile.gettempdir(),
os_helper.TESTFN + '-dummy-symlink')
-requires_32b = unittest.skipUnless(sys.maxsize < 2**32,
- 'test is only meaningful on 32-bit builds')
+requires_32b = unittest.skipUnless(
+ # Emscripten has 32 bits pointers, but support 64 bits syscall args.
+ sys.maxsize < 2**32 and not support.is_emscripten,
+ 'test is only meaningful on 32-bit builds'
+)
def _supports_sched():
if not hasattr(posix, 'sched_getscheduler'):
@unittest.skipUnless(hasattr(os, 'O_CLOEXEC'), "needs os.O_CLOEXEC")
@support.requires_linux_version(2, 6, 23)
+ @support.requires_subprocess()
def test_oscloexec(self):
fd = os.open(os_helper.TESTFN, os.O_RDONLY|os.O_CLOEXEC)
self.addCleanup(os.close, fd)
is_root = (uid in (0, 1))
else:
is_root = (uid == 0)
- if is_root:
+ if support.is_emscripten:
+ # Emscripten getuid() / geteuid() always return 0 (root), but
+ # cannot chown uid/gid to random value.
+ pass
+ elif is_root:
# Try an amusingly large uid/gid to make sure we handle
# large unsigned values. (chown lets you use any
# uid/gid you like, even if they aren't defined.)
@unittest.skipUnless(sys.platform != "win32" and hasattr(os, "umask"),
"Missing umask implementation")
+ @unittest.skipIf(support.is_emscripten, "Emscripten's umask is a stub.")
def test_file_mode(self):
# Test for issue #8464: Create files with correct
# permissions.
ac_cv_func_pwritev=no
ac_cv_func_pipe2=no
ac_cv_func_nice=no
+ac_cv_func_setpriority=no
ac_cv_func_setitimer=no
# unsupported syscall: __syscall_prlimit64
ac_cv_func_prlimit=no
ac_cv_func_setresuid=no
ac_cv_func_setresgid=no
-# Emscripten geteuid() / getegid() always return 0 (root), which breaks
-# assumption in tarfile module and some tests.
-ac_cv_func_getegid=no
-ac_cv_func_geteuid=no
-
# Emscripten does not support hard links, always fails with errno 34
# "Too many links". See emscripten_syscall_stubs.c
ac_cv_func_link=no