This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: string/tester memrchr test
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Alan Modra <amodra at gmail dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 26 Aug 2013 09:28:04 +0200
- Subject: Re: string/tester memrchr test
- Authentication-results: sourceware.org; auth=none
- References: <20130809045939 dot GF3294 at bubble dot grove dot modra dot org>
On Fri, Aug 09, 2013 at 02:29:39PM +0930, Alan Modra wrote:
> I found this useful at one stage when I was seeing a huge number of
> memrchr failures all of test number 10.
>
This also looks obvious for me.
> * string/tester.c (test_memrchr): Increment reported test cycle.
>
> diff --git a/string/tester.c b/string/tester.c
> index 2fe520c..f1ea438 100644
> --- a/string/tester.c
> +++ b/string/tester.c
> @@ -704,7 +704,7 @@ test_memrchr (void)
> more than 128 byte chunks: */
> {
> char buf[128 + sizeof(long)];
> - long align, len, i, pos;
> + long align, len, i, pos, n = 9;
>
> for (align = 0; align < (long) sizeof(long); ++align) {
> for (len = 0; len < (long) (sizeof(buf) - align); ++len) {
> @@ -715,9 +715,9 @@ test_memrchr (void)
> #if 0
> printf("align %d, len %d, pos %d\n", align, len, pos);
> #endif
> - check(memrchr(buf + align, 'x', len) == buf + align + pos, 9);
> + check(memrchr(buf + align, 'x', len) == buf + align + pos, n++);
> check(memrchr(buf + align + pos + 1, 'x', len - (pos + 1)) == NULL,
> - 10);
> + n++);
> buf[align + pos] = '-';
> }
> }
>
> --
> Alan Modra
> Australia Development Lab, IBM