mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-19 04:28:28 +00:00
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>
127 lines
2.5 KiB
Text
127 lines
2.5 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_STRLCPY
|
|
bool "test strlcpy"
|
|
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_BENCH
|
|
bool "throughput benchmark"
|
|
default n
|
|
---help---
|
|
Measure each function across a size sweep and every source and
|
|
destination alignment pair, reporting MB/s and cycles per byte.
|
|
An implementation usually takes its wide path only when the
|
|
pointers meet some alignment condition, so an aligned measurement
|
|
alone does not show what the rest of the input space costs.
|
|
|
|
if TESTING_ARCH_LIBC_BENCH
|
|
|
|
config TESTING_ARCH_LIBC_BENCH_BUFSIZE
|
|
int "benchmark buffer size"
|
|
default 262144
|
|
---help---
|
|
Size of each of the two buffers the benchmark allocates.
|
|
|
|
config TESTING_ARCH_LIBC_BENCH_MINMS
|
|
int "minimum milliseconds per measurement"
|
|
default 250
|
|
---help---
|
|
Each measurement repeats until it has run for at least this long.
|
|
|
|
endif
|
|
|
|
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
|