test(libc): cover memmove, memchr, strtoll, strtod and other untested string functions #1843
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1843"
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 NahuelGenchi on 2026-10-08T21:24:20Z.
What
A scan for libc exports that no test mentions turned up a group of basic string functions in
Strings.cpp:memmove,memchr,bzero,bcmp,strcat,strncpy,strrchr,strspn,strcoll,strxfrm,atoi,strtoll,_Stoull,strtodandstrncpy_s. Most of them forward to the host C library, so a wrong signature, a wrong argument order or a host difference would go unnoticed. This addsguest_string_basics, one test with the results the C standard defines for each: overlappingmemmovein both directions,memchrwith a character above 255 and a length limit,strncpypadding and its missing terminator when truncated,strrchron the terminator,strtollbases 0, 16 and 36 with the end pointer and with clamping at both ends,_Stoullwrapping a negative number and clamping above the maximum, andstrtodwith signs, exponents,infand out of range exponents.strncpy_sis checked for the guest error values it returns today (22 and 34), the same wayguest_stringsalready checksstrcpy_s.Left out on purpose because the answer depends on the host C library:
atoioverflow, hex floats andnaninstrtod, andstrncpy_swith a count of-1(truncate), which the code doesn't treat as Annex K does and which I couldn't confirm for the console.I did not touch
GuestStrings.cpp, which #1490 edits, so the two don't conflict. No library code changes.Tested
Ubuntu 26.04, GCC 15.2. The new test passes, and I flipped one expectation to confirm that it aborts when a result is wrong. The convention and test registration checks pass. Not run on Windows locally, so the Windows job is the first run there.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T08:53:45Z.
Closing: this pins what the existing string exports return today and passes on main, so it can't catch anything yet; tests go in with the change they cover. If one of these functions turns out wrong, a fix with this test would be welcome.
Pull request closed