Skip to content

Conversation

@brendandahl
Copy link
Collaborator

Previously, allow_raw_pointer<arg> mapped to allow_raw_pointers, which allowed pointers for all arguments. This PR implements the checks to verify just the specified argument or return value are allowed pointers.

Previously, allow_raw_pointer<arg<x>> mapped to allow_raw_pointers, which
allowed pointers for all arguments. This PR implements the checks to
verify just the specified argument or return value are allowed pointers.
@brendandahl brendandahl merged commit 6d61ffd into emscripten-core:main Dec 12, 2025
31 of 34 checks passed
@juj
Copy link
Collaborator

juj commented Dec 13, 2025

The new tests aren't happy on my CI, but give

======================================================================
FAIL: test_embind_no_raw_pointers_wrong_arg_allow (test_other.other.test_embind_no_raw_pointers_wrong_arg_allow)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\buildbot\win11-x64-64gb-9800x3d\emscripten_win11_x64\build\emscripten\main\test\common.py", line 290, in resulting_test
    return func(self, *args)
  File "C:\buildbot\win11-x64-64gb-9800x3d\emscripten_win11_x64\build\emscripten\main\test\test_other.py", line 3369, in test_embind_no_raw_pointers
    self.assert_fail([EMCC, '-lembind', test_file(filename)], 'Implicitly binding raw pointers is illegal')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\buildbot\win11-x64-64gb-9800x3d\emscripten_win11_x64\build\emscripten\main\test\common.py", line 1212, in assert_fail
    err = self.expect_fail(cmd, **kwargs)
  File "C:\buildbot\win11-x64-64gb-9800x3d\emscripten_win11_x64\build\emscripten\main\test\common.py", line 1197, in expect_fail
    self.assertNotEqual(proc.returncode, 0, 'subprocess unexpectedly succeeded. stderr:\n' + proc.stderr)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0 == 0 : subprocess unexpectedly succeeded. stderr:


======================================================================
FAIL: test_embind_no_raw_pointers_wrong_ret_allow (test_other.other.test_embind_no_raw_pointers_wrong_ret_allow)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\buildbot\win11-x64-64gb-9800x3d\emscripten_win11_x64\build\emscripten\main\test\common.py", line 290, in resulting_test
    return func(self, *args)
  File "C:\buildbot\win11-x64-64gb-9800x3d\emscripten_win11_x64\build\emscripten\main\test\test_other.py", line 3369, in test_embind_no_raw_pointers
    self.assert_fail([EMCC, '-lembind', test_file(filename)], 'Implicitly binding raw pointers is illegal')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\buildbot\win11-x64-64gb-9800x3d\emscripten_win11_x64\build\emscripten\main\test\common.py", line 1212, in assert_fail
    err = self.expect_fail(cmd, **kwargs)
  File "C:\buildbot\win11-x64-64gb-9800x3d\emscripten_win11_x64\build\emscripten\main\test\common.py", line 1197, in expect_fail
    self.assertNotEqual(proc.returncode, 0, 'subprocess unexpectedly succeeded. stderr:\n' + proc.stderr)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0 == 0 : subprocess unexpectedly succeeded. stderr:

http://clbri.com:8010/api/v2/logs/273025/raw_inline

Failure happens only on Windows, not on Linux or macOS.

@sbc100
Copy link
Collaborator

sbc100 commented Dec 13, 2025

The new tests aren't happy on my CI, but give

======================================================================
FAIL: test_embind_no_raw_pointers_wrong_arg_allow (test_other.other.test_embind_no_raw_pointers_wrong_arg_allow)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\buildbot\win11-x64-64gb-9800x3d\emscripten_win11_x64\build\emscripten\main\test\common.py", line 290, in resulting_test
    return func(self, *args)
  File "C:\buildbot\win11-x64-64gb-9800x3d\emscripten_win11_x64\build\emscripten\main\test\test_other.py", line 3369, in test_embind_no_raw_pointers
    self.assert_fail([EMCC, '-lembind', test_file(filename)], 'Implicitly binding raw pointers is illegal')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\buildbot\win11-x64-64gb-9800x3d\emscripten_win11_x64\build\emscripten\main\test\common.py", line 1212, in assert_fail
    err = self.expect_fail(cmd, **kwargs)
  File "C:\buildbot\win11-x64-64gb-9800x3d\emscripten_win11_x64\build\emscripten\main\test\common.py", line 1197, in expect_fail
    self.assertNotEqual(proc.returncode, 0, 'subprocess unexpectedly succeeded. stderr:\n' + proc.stderr)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0 == 0 : subprocess unexpectedly succeeded. stderr:


======================================================================
FAIL: test_embind_no_raw_pointers_wrong_ret_allow (test_other.other.test_embind_no_raw_pointers_wrong_ret_allow)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\buildbot\win11-x64-64gb-9800x3d\emscripten_win11_x64\build\emscripten\main\test\common.py", line 290, in resulting_test
    return func(self, *args)
  File "C:\buildbot\win11-x64-64gb-9800x3d\emscripten_win11_x64\build\emscripten\main\test\test_other.py", line 3369, in test_embind_no_raw_pointers
    self.assert_fail([EMCC, '-lembind', test_file(filename)], 'Implicitly binding raw pointers is illegal')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\buildbot\win11-x64-64gb-9800x3d\emscripten_win11_x64\build\emscripten\main\test\common.py", line 1212, in assert_fail
    err = self.expect_fail(cmd, **kwargs)
  File "C:\buildbot\win11-x64-64gb-9800x3d\emscripten_win11_x64\build\emscripten\main\test\common.py", line 1197, in expect_fail
    self.assertNotEqual(proc.returncode, 0, 'subprocess unexpectedly succeeded. stderr:\n' + proc.stderr)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0 == 0 : subprocess unexpectedly succeeded. stderr:

http://clbri.com:8010/api/v2/logs/273025/raw_inline

Failure happens only on Windows, not on Linux or macOS.

Does your CI build the sysroot from clean each time?

The embind headers (like all the system & libc headers) are not automatically re-installed in the sysroot each time they are changed. You would need to do ./embuilder build sysroot --force to do that (or the more brutal ./emcc --clear-cache to re-install everything).

I think ./embuilder build sysroot --force is very cheap (it just copies headers) so maybe you could add it to the start of each test run? On the emscripten CI (and emscripten-releases CI) we always rebuild the sysroot from scratch so we don't run into this. Most users also never run into it either since the sysroot gets cleaned if the emscripten version doesn't match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants