nuttx-apps/testing/libc/arch_libc
Justin Hammond f4bb54e4d1 testing/libc/arch_libc: Test strlcpy.
strlcpy is the one function in this directory's reach that nothing here
covers, and a machine directory may override it like any other.

Sweep every source and destination alignment pair against sizes 1 to 64,
and for each of those every capacity from zero to one past the length.
Check the return value, which is the length of src whether or not the
copy fit, the truncation point, the content, that a capacity of zero
writes nothing at all, and that nothing lands past the terminator.

The alignment pairs are the point.  An implementation that walks one of
the two pointers to a boundary and then copies a register at a time is
correct whenever the two agree, so a test that only ever passes matching
alignments says nothing about it.

The timing half is guarded.  perf_gettime() is not a system call, so an
application reaches it only where the C library builds its own copy or
where the application and the kernel are one image; calling it
unconditionally leaves the test unbuildable on a kernel build, which is
where the correctness half is still wanted.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-18 15:27:07 -03:00
..
arch_libc_bench.c testing/libc/arch_libc: Add a throughput benchmark. 2026-08-18 15:27:07 -03:00
arch_libc_test_main.c testing/libc/arch_libc: Test strlcpy. 2026-08-18 15:27:07 -03:00
CMakeLists.txt testing/libc/arch_libc: Add a throughput benchmark. 2026-08-18 15:27:07 -03:00
Kconfig testing/libc/arch_libc: Test strlcpy. 2026-08-18 15:27:07 -03:00
Make.defs apps/testing:move arch_libc, fmemopen, scanftest folders to the new lib folder 2025-01-22 17:18:30 +08:00
Makefile testing/libc/arch_libc: Add a throughput benchmark. 2026-08-18 15:27:07 -03:00