lib/libc/tests/string: add test for strnlen()Tests for strnlen, checks alignments from up to 16 and buffer sizes upto 64, also checks that passing SIZE_MAX as maxlen works, because it cancause a
lib/libc/tests/string: add test for strnlen()Tests for strnlen, checks alignments from up to 16 and buffer sizes upto 64, also checks that passing SIZE_MAX as maxlen works, because it cancause a wraparound error if strnlen is incorrect.Reviewed by: fuz, emaste (GSoC mentors), kibSponsored by: Google LLC (GSoC 2024)Differential Revision: https://reviews.freebsd.org/D46275
show more ...
lib/libc/tests/string: improve memccpy "bounds" unit testThe purpose of the "bounds" test is to check that the function does notoverread the array bounds. The old unit test, copied from the strlc
lib/libc/tests/string: improve memccpy "bounds" unit testThe purpose of the "bounds" test is to check that the function does notoverread the array bounds. The old unit test, copied from the strlcpy()one, always ensured that we see the character c memccpy() is looking forin the source array before the array ends. While this is correct forstrlcpy(), memccpy()'s specification does not guarantee that c ispresent within the given size limit.The updated test handles this case better, ensuring that the sourcearray ends early if c is not supposed to be present.Reported by: getzApproved by: emasteSee also: D46052Event: GSoC 2024Differential Revision: https://reviews.freebsd.org/D46051
Remove residual blank line at start of MakefileThis is a residual of the $FreeBSD$ removal.MFC After: 3 days (though I'll just run the command on the branches)Sponsored by: Netflix
libc: Add memset test for int-to-char conversionTest case to check if an implementation of memset correctlyhandles the value passed being wider than a byteApproved by: emasteReviewed By: fuz (G
libc: Add memset test for int-to-char conversionTest case to check if an implementation of memset correctlyhandles the value passed being wider than a byteApproved by: emasteReviewed By: fuz (GSoC mentor), emasteSponsored by: Google LLC (GSoC 2024)Differential Revision: https://reviews.freebsd.org/D45738
lib/libc/tests/string: add memrchr unit testsThe "values" test case is specifically crafted to detect the off-by-oneerror previous discovered in the scalar strchrnul implementation.Tested by: de
lib/libc/tests/string: add memrchr unit testsThe "values" test case is specifically crafted to detect the off-by-oneerror previous discovered in the scalar strchrnul implementation.Tested by: developers@, exp-runApproved by: mjgMFC after: 1 monthMFC to: stable/14PR: 275785Differential Revision: https://reviews.freebsd.org/D42925
lib/libc/tests/string: add unit tests for memccpy()Adapted from the strlcpy() unit tests.Tested by: developers@, exp-runApproved by: mjgMFC after: 1 monthMFC to: stable/14PR: 275785
lib/libc/tests/string: add unit test for strlcpyA straightforward derivation from the stpncpy unit test.Sponsored by: The FreeBSD FoundationTested by: developers@, exp-runApproved by: mjgMFC a
lib/libc/tests/string: add unit test for strlcpyA straightforward derivation from the stpncpy unit test.Sponsored by: The FreeBSD FoundationTested by: developers@, exp-runApproved by: mjgMFC after: 1 monthMFC to: stable/14PR: 275785Differential Revision: https://reviews.freebsd.org/D42863
lib/libc/tests/string/stpncpy_test.c: extend for upcoming SSE implementationThis adds additional unit tests validating the function forAll possible alignment offsets of source and destination.Al
lib/libc/tests/string/stpncpy_test.c: extend for upcoming SSE implementationThis adds additional unit tests validating the function forAll possible alignment offsets of source and destination.Also extend the test to allow testing of an external stpncpyimplementation, which greatly simplifies the development ofcustom implementations.Sponsored by: The FreeBSD FoundationTested by: developers@, exp-runApproved by: mjgMFC after: 1 monthMFC to: stable/14PR: 275785Differential Revision: https://reviews.freebsd.org/D42519
lib/libc/tests/string: add unit tests for strncmp(3)These are patterned after the previously added (D41970)strcmp tests, but are extended to check for various lengthconditions.Sponsored by: The
lib/libc/tests/string: add unit tests for strncmp(3)These are patterned after the previously added (D41970)strcmp tests, but are extended to check for various lengthconditions.Sponsored by: The FreeBSD FoundationTested by: developers@, exp-runApproved by: mjgMFC after: 1 monthMFC to: stable/14PR: 275785Differential Revision: https://reviews.freebsd.org/D42122
lib/libc/tests/string/strcspn_test.c: add test for correct match orderThis new unit test verifies that if there are multiplematches, the first match is returned, ignoring latermatches.Approved
lib/libc/tests/string/strcspn_test.c: add test for correct match orderThis new unit test verifies that if there are multiplematches, the first match is returned, ignoring latermatches.Approved by: mjg (blanket, via IRC)MFC after: 1 weekMFC to: stable/14
lib/libc/tests/string: add extended unit tests for strcmp()This changeset add a new set of tests that comprehensively test strcmp() onvarious alignments of the input. This made it easy to smoke ou
lib/libc/tests/string: add extended unit tests for strcmp()This changeset add a new set of tests that comprehensively test strcmp() onvarious alignments of the input. This made it easy to smoke out manyexciting new bugs in the new SSE strcmp() implementation from D41971.MFC after: 1 weekReviewed by: ngieSponsored by: The FreeBSD FoundationDifferential Revision: https://reviews.freebsd.org/D41970
libc: Purge unneeded cdefs.hThese sys/cdefs.h are not needed. Purge them. They are mostly left-overfrom the $FreeBSD$ removal. A few in libc are still required for macrosthat cdefs.h defines. Kee
libc: Purge unneeded cdefs.hThese sys/cdefs.h are not needed. Purge them. They are mostly left-overfrom the $FreeBSD$ removal. A few in libc are still required for macrosthat cdefs.h defines. Keep those.Sponsored by: NetflixDifferential Revision: https://reviews.freebsd.org/D42385
lib/libc/tests/string: expand memcmp test to bcmp, timingsafe_{b,mem}cmpThe four functions more or less perform the same operation.Reuse the same unit test with slight changes so we can coverthem
lib/libc/tests/string: expand memcmp test to bcmp, timingsafe_{b,mem}cmpThe four functions more or less perform the same operation.Reuse the same unit test with slight changes so we can coverthem all. Constant-time operation is not verified for thetimingsafe_* functions.Sponsored by: The FreeBSD FoundationApproved by: ngieMFC after: 1 weekDifferential Revision: https://reviews.freebsd.org/D41528
lib/libc/tests/string/memcmp_test.c: extend test to support custom memcmp functionExtend the tests to permit loading an external memcmp functionand testing it over using the libc version. This was
lib/libc/tests/string/memcmp_test.c: extend test to support custom memcmp functionExtend the tests to permit loading an external memcmp functionand testing it over using the libc version. This was added by theexample of other tests in the test suite doing the same thing andhelped tremendously in development.This change was originally part of D41442 but was taken out topermit separate review as extrapolated from @ngie's request inD41349.Sponsored by: FreeBSD FoundationApproved by: ngieDifferential Revision: https://reviews.freebsd.org/D41528
lib/libc/tests/string/strcspn_test.c: extend tests to catch previous bugThis extends the strcspn() unit tests to catch mistakes in theimplementation that only appear when a mismatch occurs in a ce
lib/libc/tests/string/strcspn_test.c: extend tests to catch previous bugThis extends the strcspn() unit tests to catch mistakes in theimplementation that only appear when a mismatch occurs in a certainposition of the string against a certain position of the set.See also: 52d4a4d4e0dedc72bc33082a3f84c2d0fd6f2cbbSponsored by: The FreeBSD FoundationApproved by: impMFC after: 3 daysDifferential Revision: https://reviews.freebsd.org/D41821
lib/libc/tests/string: derive strspn(3) tests from strcspn(3) testsTo cover the new optimised amd64 strspn(3) SIMD implementation, extendthe previously written strcspn(3) unit test to also cover s
lib/libc/tests/string: derive strspn(3) tests from strcspn(3) testsTo cover the new optimised amd64 strspn(3) SIMD implementation, extendthe previously written strcspn(3) unit test to also cover strspn(3).Sponsored by: The FreeBSD FoundationApproved by: mjgMFC after: 1 weekMFC to: stable/14Differential Revision: https://reviews.freebsd.org/D41567
lib/libc/tests/string: add unit tests for strcspn(3)We currently use the NetBSD test suite to cover strcspn(3). It onlycontains a very rudimentary test of this function. This all new setof unit
lib/libc/tests/string: add unit tests for strcspn(3)We currently use the NetBSD test suite to cover strcspn(3). It onlycontains a very rudimentary test of this function. This all new setof unit tests for the FreeBSD test suite should cover many more edgecases relating to alignment issues.Sponsored by: The FreeBSD FoundationApproved by: mjgMFC after: 1 weekMFC to: stable/14Differential Revision: https://reviews.freebsd.org/D41557
Remove $FreeBSD$: one-line sh patternRemove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
Remove $FreeBSD$: one-line .c patternRemove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
Remove $FreeBSD$: two-line .h patternRemove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
lib/libc/tests/string: add unit tests for ffs, ffsl, ffsll, fls, flsl, and flsllAlso supply CFLAGS+=-fno-builtin to ensure our unit testsactually test libc functions and not clang's builtins.Spo
lib/libc/tests/string: add unit tests for ffs, ffsl, ffsll, fls, flsl, and flsllAlso supply CFLAGS+=-fno-builtin to ensure our unit testsactually test libc functions and not clang's builtins.Sponsored by: FreeBSD FoundationApproved by: kevansMFC after: 1 weekDifferential Revision: https://reviews.freebsd.org/D40729
libc: Add tests for strchrnul(3).MFC after: 1 weekSponsored by: Klara, Inc.Reviewed by: allanjudeDifferential Revision: https://reviews.freebsd.org/D38286
libc: Add strverscmp(3) and versionsort(3)Add a strverscmp(3) function to libc, a GNU extension I implemented byreading its glibc manual page. It orders strings following a much morenatural order
libc: Add strverscmp(3) and versionsort(3)Add a strverscmp(3) function to libc, a GNU extension I implemented byreading its glibc manual page. It orders strings following a much morenatural ordering (e.g. "ent1 < ent2 < ent10" as opposed to"ent1 < ent10 < ent2" with strcmp(3)'s lexicographic ordering).Also add versionsort(3) for use as scandir(3)'s compar argument.Update manual page for scandir(3) and add one for strverscmp(3).Reviewed by: pstef, gbe, kibMFC after: 1 weekDifferential Revision: https://reviews.freebsd.org/D35807
Have stpncpy tests ask the kernel for the page sizeIt may be dynamic so we can't rely on PAGE_SIZE being present orcorrect.
Avoid copying too much from the input string.This avoids reading past the end of the static strings. On a systemwith bounds checking these tests fault.Reviewed by: asomersObtained from: CheriB
Avoid copying too much from the input string.This avoids reading past the end of the static strings. On a systemwith bounds checking these tests fault.Reviewed by: asomersObtained from: CheriBSDMFC after: 1 weekSponsored by: DARPA, AFRLDifferential Revision: https://reviews.freebsd.org/D21004
12