opnsense-src/lib/libc/tests/string
Ed Maste 79e4dfe2a5 libc: Have memcmp test what the standard requires
libc's C memcmp currently returns the difference in byte values rather
than just -1/0/1 as the AArch64 assembly implementation, many non-
FreeBSD implementations, and compiler built-in optimizations do.

It is a bug for a user to expect memcmp to return the difference in the
byte values as the compiler is free to inline memcmp() with an
implementation that does not do this.  Change the test to validate only
what the standard requires.

PR:		289084
Reviewed by:	markj, fuz
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D52502

(cherry picked from commit e0eaabb80d1724acf88f04acbc2ca13d42270863)
2025-09-16 13:34:32 -04:00
..
bcmp_test.c lib/libc/tests/string: expand memcmp test to bcmp, timingsafe_{b,mem}cmp 2023-10-02 15:25:31 -04:00
ffs_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
ffsl_test.c lib/libc/tests/string: add unit tests for ffs, ffsl, ffsll, fls, flsl, and flsll 2023-07-03 22:18:27 +02:00
ffsll_test.c lib/libc/tests/string: add unit tests for ffs, ffsl, ffsll, fls, flsl, and flsll 2023-07-03 22:18:27 +02:00
fls_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
flsl_test.c lib/libc/tests/string: add unit tests for ffs, ffsl, ffsll, fls, flsl, and flsll 2023-07-03 22:18:27 +02:00
flsll_test.c lib/libc/tests/string: add unit tests for ffs, ffsl, ffsll, fls, flsl, and flsll 2023-07-03 22:18:27 +02:00
Makefile lib/libc/tests/string: add test for strnlen() 2024-10-15 13:34:45 +02:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
memccpy_test.c lib/libc/tests/string: improve memccpy "bounds" unit test 2024-09-14 20:42:19 +02:00
memcmp_test.c libc: Have memcmp test what the standard requires 2025-09-16 13:34:32 -04:00
memrchr_test.c lib/libc/tests/string: add memrchr unit tests 2023-12-25 14:59:58 +01:00
memset_s_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
memset_test.c libc: Add memset test for int-to-char conversion 2024-07-13 15:07:49 +02:00
stpncpy_test.c lib/libc/tests/string/stpncpy_test.c: extend for upcoming SSE implementation 2023-12-25 14:55:37 +01:00
strcmp_test.c lib/libc/tests/string: add extended unit tests for strcmp() 2023-11-14 12:37:06 -05:00
strcspn_test.c lib/libc/tests/string/strcspn_test.c: add test for correct match order 2023-12-21 03:16:57 +01:00
strerror_test.c Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
strlcpy_test.c lib/libc/tests/string: add unit test for strlcpy 2023-12-25 14:56:02 +01:00
strncmp_test.c lib/libc/tests/string: add unit tests for strncmp(3) 2023-12-25 14:55:08 +01:00
strnlen_test.c lib/libc/tests/string: add test for strnlen() 2024-10-15 13:34:45 +02:00
strspn_test.c lib/libc/tests/string: derive strspn(3) tests from strcspn(3) tests 2023-09-08 17:21:59 -04:00
strverscmp_test.c
strxfrm_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
timingsafe_bcmp_test.c lib/libc/tests/string: expand memcmp test to bcmp, timingsafe_{b,mem}cmp 2023-10-02 15:25:31 -04:00
timingsafe_memcmp_test.c lib/libc/tests/string: expand memcmp test to bcmp, timingsafe_{b,mem}cmp 2023-10-02 15:25:31 -04:00
wcscasecmp_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
wcscoll_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
wcsnlen_test.c libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00