test(libc): cover the standard exception classes and throw helpers #9773
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9773"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-22T14:11:58Z.
What
Line coverage of libc and libkernel over the CPU-side test suite (gcov, Windows) showed about 110 exports in
exception/StandardExceptions.cppthat no test ran. They are the constructors, destructors,whatand assignment of the standard exception classes, plus the throw helpers.How:
tests/GuestStandardExceptionClasses.cpp, registered asguest_standard_exception_classesnext toguest_bad_optional_access(it follows the same pattern):exception,bad_alloc,bad_array_new_length,bad_cast,bad_typeidandbad_function_call:exception,bad_allocforbad_array_new_length, otherwiseexception);whatslot;C1EvandC2Evinstall the vtable, andwhat()is non-empty and matches the vtable'swhat;D1EvandD2Evrun, andD0Evdeletes amalloced object.logic_error,domain_error,invalid_argument,length_error,out_of_rangeandruntime_error:logic_errororexception);what()returns the constructor's message, copied, so changing the caller's buffer afterwards doesn't affect it;bad_weak_ptr(no exported constructor): its type,whatand destructors._Xbad_alloc,_Xrange_error,_Xlength_error,_Xinvalid_argument,_Throw_bad_weak_ptr,_Xbad_function_call,__throw_bad_variant_access,__cxa_bad_cast,__cxa_bad_typeidand__cxa_throw_bad_array_new_length.what()text for the classes without a message is checked only for being non-empty; the console's exact strings are not pinned.Tested
bad_*tests.Assignkeeping the old message, the test fails at the assignment check. Restored, it passes.tools/check_conventions.pypasses.Overlap (
tools/pr_overlap.py --branchplusgit merge-tree):libc/CMakeLists.txt;git merge-treeadds no conflict hunk with any of them.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T14:38:29Z.
Review: APPROVED
The new test checks type records and base relationships, vtable address points, constructors/destructors (including deleting destructors), message ownership and assignment, and all ten throw helpers. I compared its expected object/vtable layout and behavior with
StandardExceptions.cpp; the assertions match the implementation. The reported negative control for assignment adds useful red/green evidence.Hosted
register-contexttests pass on Ubuntu and macOS Intel in Debug and Release; conventions, eligibility, relinker, ASan and write-watch checks also pass. Linux/Windows product jobs are skipped by policy. The current-main commits since the PR base do not touchStandardExceptions.cppor this CMake section; merge-tree and diff-check are clean. I did not rerun CTest locally because there is no configured build and less than 1 GB free on disk.#9775 also adds a separate CMake test registration in this block; the pairwise merge is clean and the registrations do not overlap semantically. No implementation duplicate was found.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T16:59:11Z.
Review: COMMENTED
The exact head
f934c4b2c53aae56b3abebf933c32c27df08ba94has a clean merge tree with current main (11f976b27c16ed91633f00039dba5dfd97dd7cc1); conventions and diff-check pass. The test covers the standard exception hierarchy, vtable slots, constructors/destructors, assignment, and throw helpers. The author reports Windows focused and exception-suite results; hosted register-context/relinker checks pass, while product Linux/Windows jobs are skipped. This branch is based on8b3e39832a, 32 commits behind current main; please rebase and rerunguest_standard_exception_classesbefore merge. I did not rerun locally.Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-26T04:05:47Z.
Review: APPROVED
Re-reviewed
f934c4b2c53aae56b3abebf933c32c27df08ba94. Approve; the earlier validation blocker is resolved.The missing native execution step is complete. Reviewed coverage exercises the standard exception type/vtable records, plain and message-object construction/destruction, message ownership/copies/assignment and the ten throw helpers. No actionable findings.
Validation: Compiled the complete exact GuestStandardExceptionClasses.cpp with the pinned exception runtime through its actual combined translation unit, src/exception/Exports.cpp, using project Windows unwind settings and section conversion. This includes Runtime, TypeInfo, StandardExceptions, Unwind and Personality source in their intended order. The complete test executable returns 0, including all throw/catch assertions.
Scope: Existing libc linkage supplies ancillary symbols; this is not a rebuild of every libc source or all exception tests. The earlier standalone StandardExceptions.cpp compilation failures were reviewer-harness errors caused by bypassing Exports.cpp, not defects introduced by this test. No application/game run.
Pull request closed