Skip to content

test(libc): skip floating-point trap tests where the host keeps no unmasked exception - #19838

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
rznas:fix/libc-skip-fp-trap-tests-without-host-traps
Nov 14, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
rznas:fix/libc-skip-fp-trap-tests-without-host-traps

Conversation

@rznas

@rznas rznas commented Nov 14, 2026 •

Copy link
Copy Markdown

What

guest_set_env and guest_raise_except fail on macOS under Rosetta 2, which keeps the six MXCSR exception masks set and raises no x87 SIGFPE (already recorded for feupdateenv in docs/dev/debt/libc.md). The two tests assume a host that can hold and deliver unmasked exceptions. They abort on checks that need one; the library code is not at fault.

Tested

macOS 27.0.1, Apple M3 Pro, AppleClang 21, Ninja, Release, x86-64 full build under Rosetta 2, BUILD_TESTING=ON. The tree also carried the one-file change of #17425 locally, which the full macOS build needs to link libcurl.prx; it is not part of this PR.

  • Before, on main f83d7e1: a full ctest run listed guest_set_env, guest_set_env_pending_0..5, guest_raise_except and guest_raise_except_trap_0..5 as Subprocess aborted. Run alone, guest_set_env printed fesetenv: independent x87/SSE exception masks restored and died with SIGABRT from Require in StateMatrix(); after that check was fixed it stopped at null rejected without state or errno change, and with the three conditions split only the errno one failed.
  • Host probe, a standalone x86-64 program under Rosetta writing each of the 64 SSE exception-mask values: 63 read back as 0x3f; all 64 x87 mask values round-trip.
  • After, rebuilt on main 2ac33b4 (the current main 2b9d71c differs from it only in docs/dev/debt/libSceNKWebKit.md, and the branch is rebased on it): ctest --test-dir build-mac -R '^guest_(set_env|raise_except)' passed 100% (15/15 including guest_raise_exception): guest_set_env and guest_raise_except pass, the 12 pending and trap tests are reported as skipped. guest_set_env_tests run directly prints fesetenv checks passed:196608 state combinations,4096 mask pairs, bounds/errors/tags/threads.
  • Not run here: Linux, Windows and an Intel Mac. On a host where HostKeepsSseTraps is true nothing is skipped and the expected values are unchanged, so the strict checks run as before.
  • python3 tools/check_conventions.py --base origin/main with this title and description.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

…masked exception

Rosetta 2 keeps the six MXCSR exception masks set and raises no x87
SIGFPE, so guest_set_env and guest_raise_except aborted on macOS on
checks that need a host able to trap.

Probe the host with the same HostKeepsSseTraps check that
GuestUpdateEnv and GuestFloatingPoint use. The pending and trap cases
exit 77 and are registered with SKIP_RETURN_CODE 77. The independent
mask checks expect the SSE masks to stay set when the host cannot
clear them. Hosts that keep them run the strict checks unchanged.

The first C++ exception of a macOS process sets errno to ENOENT, which
tripped the null-pointer errno check of guest_set_env, so the test
throws and catches one exception before it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@JJenkx

JJenkx commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Windows check of head 4daaebd4dd, merged onto main 322f2ed19c (8bd7b9e5e8, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.

  • guest_raise_except, guest_raise_except_trap_0, guest_raise_except_trap_1, guest_raise_except_trap_2, guest_raise_except_trap_3, guest_raise_except_trap_4, guest_raise_except_trap_5, guest_set_env, guest_set_env_pending_0, guest_set_env_pending_1, guest_set_env_pending_2, guest_set_env_pending_3, guest_set_env_pending_4, guest_set_env_pending_5 pass in 3 of 3 runs, none skipped.

AI-assisted: yes.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 7447 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 7544 docs/dev/debt/libc.md
PR 7715 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 8150 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 8965 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 9087 docs/dev/debt/libc.md
PR 9340 docs/dev/debt/libc.md
PR 9447 docs/dev/debt/libc.md
PR 9466 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 9526 docs/dev/debt/libc.md
PR 10409 docs/dev/debt/libc.md
PR 11172 docs/dev/debt/libc.md
PR 11332 docs/dev/debt/libc.md
PR 11661 docs/dev/debt/libc.md
PR 11689 docs/dev/debt/libc.md
PR 11698 docs/dev/debt/libc.md
PR 12184 docs/dev/debt/libc.md
PR 12682 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 12688 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 12700 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 12717 core/libs/prx/libc/CMakeLists.txt
PR 12849 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 12965 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 15973 docs/dev/debt/libc.md
PR 16791 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 17026 docs/dev/debt/libc.md
PR 17557 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 17558 core/libs/prx/libc/CMakeLists.txt
docs/dev/debt/libc.md
PR 18380 docs/dev/debt/libc.md
PR 18405 docs/dev/debt/libc.md
PR 18787 docs/dev/debt/libc.md
PR 19181 core/libs/prx/libc/CMakeLists.txt

@oneandonlydean
oneandonlydean merged commit 50051b9 into boykopovar:main Nov 14, 2026
3 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants