nuttx-apps/testing/libc/arch_libc/Kconfig
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

97 lines
1.7 KiB
Text

#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config TESTING_ARCH_LIBC
tristate "arch-specific libc function test"
default n
---help---
Enable the arch libc test
if TESTING_ARCH_LIBC
config TESTING_ARCH_LIBC_MEMCHR
bool "test memchr"
default y
config TESTING_ARCH_LIBC_MEMCMP
bool "test memcmp"
default y
config TESTING_ARCH_LIBC_MEMCPY
bool "test memcpy"
default y
config TESTING_ARCH_LIBC_MEMMOVE
bool "test memmove"
default y
config TESTING_ARCH_LIBC_MEMSET
bool "test memset"
default y
config TESTING_ARCH_LIBC_STRCHR
bool "test strchr"
default y
config TESTING_ARCH_LIBC_STRCMP
bool "test strcmp"
default y
config TESTING_ARCH_LIBC_STRCPY
bool "test strcpy"
default y
config TESTING_ARCH_LIBC_STRLEN
bool "test strlen"
default y
config TESTING_ARCH_LIBC_STRNCMP
bool "test strncmp"
default y
config TESTING_ARCH_LIBC_STRNLEN
bool "test strnlen"
default y
config TESTING_ARCH_LIBC_STRNCPY
bool "test strncpy"
default y
config TESTING_ARCH_LIBC_STPCPY
bool "test stpcpy"
default y
config TESTING_ARCH_LIBC_STRCAT
bool "test strcat"
default y
config TESTING_ARCH_LIBC_STRRCHR
bool "test strrchr"
default y
config TESTING_ARCH_LIBC_STRCHRNUL
bool "test strchrnul"
default y
config TESTING_ARCH_LIBC_PROGNAME
string "Program name"
default "arch_libctest"
---help---
This is the name of the program that will be used when the NSH ELF
program is installed.
config TESTING_ARCH_LIBC_PRIORITY
int "arch libc test priority"
default 100
config TESTING_ARCH_LIBC_STACKSIZE
int "arch libc test stack size"
default DEFAULT_TASK_STACKSIZE
config TESTING_ARCH_LIBC_VERBOSE
bool "Verbose output"
default n
endif