[glibc] string: Improve memchr random test
Wilco Dijkstra via Glibc-cvs <[email protected]> Thu, 18 Jun 2026 19:45:57 +0000 (GMT)
| Newsgroups | gmane.comp.lib.glibc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=cdbefe2f940d0ef87c854e13514812785b062988 commit cdbefe2f940d0ef87c854e13514812785b062988 Author: Wilco Dijkstra <[email protected]> Date: Thu Jun 18 17:02:59 2026 +0000 string: Improve memchr random test Add matches before the start to ensure the memchr test checks they do not result in false matches or missed matches. Reviewed-by: Adhemerval Zanella <[email protected]> Diff: --- string/test-memchr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/string/test-memchr.c b/string/test-memchr.c index df9ce0f22c..42d18a596f 100644 --- a/string/test-memchr.c +++ b/string/test-memchr.c @@ -177,6 +177,11 @@ do_random_tests (void) } } + /* Add matching chars before the start to improve test coverage. */ + i = random () & 31; + if (i < align) + p[i] = seek_char; + if (pos < len) { size_t r = random ();