nuttx-apps/testing/libc/arch_libc
zhangyuan29 413d2ddbc3 testing/libc/arch_libc: Cover unaligned src/dst copy paths.
test_strcpy(), test_strncpy() and test_stpcpy() applied the same offset
to the source and to the destination, so both pointers always shared the
same word congruence.  Architecture optimized copy routines take a
different code path when the two offsets differ: a byte prologue to
align the destination, then either a byte fallback or a shift-merge loop
that recombines two source words per store.  None of that was reached by
the test.

Vary the source and destination offsets independently over 0..7 in those
three tests, so both the equal congruence (aligned word copy) and the
unequal congruence (shift-merge) paths are covered, and report both
offsets on failure so a regression points at the offending combination.

Also drop the ARCH_TOOLCHAIN_GNU dependency from TESTING_ARCH_LIBC.  The
test only uses standard C string functions and perf_gettime(), with no
GNU specific construct, so it builds with non GNU toolchains such as
TASKING as well.

Impact: test only, selected by CONFIG_TESTING_ARCH_LIBC (default n).
Dropping the ARCH_TOOLCHAIN_GNU dependency only widens the set of
toolchains that may select the test, no existing configuration changes.

Testing: built and ran sim:nsh on Linux x86_64 (Ubuntu 24.04,
gcc 13.3.0) with CONFIG_TESTING_ARCH_LIBC=y.  strcpy, strncpy and
stpcpy report PASSED for all 64 offset combinations, and
"arch_libc_test Passed".

Assisted-by: Claude:claude-opus-5
Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2026-08-10 16:55:36 -03:00
..
arch_libc_test_main.c testing/libc/arch_libc: Cover unaligned src/dst copy paths. 2026-08-10 16:55:36 -03:00
CMakeLists.txt apps/testing:move arch_libc, fmemopen, scanftest folders to the new lib folder 2025-01-22 17:18:30 +08:00
Kconfig testing/libc/arch_libc: Cover unaligned src/dst copy paths. 2026-08-10 16:55:36 -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 apps/testing:move arch_libc, fmemopen, scanftest folders to the new lib folder 2025-01-22 17:18:30 +08:00