From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 68DA8385DC1C for ; Fri, 20 Aug 2021 03:10:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 68DA8385DC1C Received: by mail-pf1-x42e.google.com with SMTP id i21so7379795pfd.8 for ; Thu, 19 Aug 2021 20:10:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=72eA1VvwiXWLtmZPPuhLvqOSOXcDOBwWIAJNASnDCiQ=; b=sVcwWHwXvWvrs7RSwrW0tQrm/GV6/l+V+xR+lqgn/PN7a6rQ0beHtzDizRWKJhzPB7 yTjNQhAKXcEmJXnPofo0IqXFwypbDuLk8LRYyFTb6XF9c0E8T4vnVhUJSJf0cuAEK8+h i5DnXSZzqw725pxqI674DQOge2uG10Go0SWhycy4rA9LNTI7odIZeuZ22aErFCXXXLM3 pmX9s4LTMRF48tyHC5EbEMbmkMfWlKm4l+Akj++UwZVRYVPtY26/jPhK+xP1rcSwAtpn 2B2Fc3nxIBi0L+tr1X+5paf//pM1NlSjP/KECscf7WcJZA7pt8qP+/REt5Z10By7/YKZ A2oQ== X-Gm-Message-State: AOAM531tuaeqEe0LwtVJ6yDcj+doJOM/hwa3WZzrWZ/22AaQHQVvLb4U 2MYimCeiUVjUR7ib7op6Pr3uLITjKJGM6ray4Og= X-Google-Smtp-Source: ABdhPJxgSL/1meV65sG0XibA/UipNWRdVdEmhY2LeSOYExsmeOnVseL+1YR65i4D0lO/TMOKrSAbmxoaHFkQv6be+u0= X-Received: by 2002:a63:4005:: with SMTP id n5mr16578608pga.140.1629429006513; Thu, 19 Aug 2021 20:10:06 -0700 (PDT) MIME-Version: 1.0 References: <20210819191021.3766894-1-hjl.tools@gmail.com> In-Reply-To: <20210819191021.3766894-1-hjl.tools@gmail.com> From: Noah Goldstein Date: Thu, 19 Aug 2021 22:09:56 -0500 Message-ID: Subject: Re: [PATCH] Update string/test-memmove.c to cover 16KB copy To: "H.J. Lu" Cc: GNU C Library X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 03:10:09 -0000 On Thu, Aug 19, 2021, 2:10 PM H.J. Lu via Libc-alpha < libc-alpha@sourceware.org> wrote: > --- > string/test-memmove.c | 49 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 49 insertions(+) > > diff --git a/string/test-memmove.c b/string/test-memmove.c > index b271248b1d..812f6bde9e 100644 > --- a/string/test-memmove.c > +++ b/string/test-memmove.c > @@ -312,6 +312,52 @@ do_test2 (size_t offset) > munmap ((void *) large_buf, size); > } > > +static void > +do_test3 (void) > I think it may be cleaner to make bytes_move and offset function arguments. +{ > + /* Copy 16KB data. */ > + size_t bytes_move = 16384; > I think this should be a function argument. + size_t size = 16384 * 3; > + uint32_t *buf; > + > + buf = mmap (NULL, size, PROT_READ | PROT_WRITE, > + MAP_PRIVATE | MAP_ANON, -1, 0); > + > + if (buf == MAP_FAILED) > + error (EXIT_UNSUPPORTED, errno, "mmap failed"); > + > + size_t arr_size = bytes_move / sizeof (uint32_t); > + size_t i; > + > + FOR_EACH_IMPL (impl, 0) > + { > + for (i = 0; i < arr_size; i++) > + buf[i] = (uint32_t) i; > + > + uint32_t *dst = &buf[arr_size + 3]; > I think + 3 should be a variable and passed to the function. + > +#ifdef TEST_BCOPY > + CALL (impl, (char *) buf, (char *) dst, bytes_move); > +#else > + CALL (impl, (char *) dst, (char *) buf, bytes_move); > +#endif > + > + for (i = 0; i < arr_size; i++) > + { > + if (dst[i] != (uint32_t) i) > + { > + error (0, 0, > + "Wrong result in function %s dst \"%p\" src \"%p\" > offset \"%zd\"", > + impl->name, dst, buf, i); > + ret = 1; > + break; > + } > + } > + } > + > + munmap ((void *) buf, size); > +} > + > int > test_main (void) > { > @@ -356,6 +402,9 @@ test_main (void) > do_test2 (0x200000); > do_test2 (0x4000000 - 1); > do_test2 (0x4000000); > + > + do_test3 (); + > return ret; > } > > -- > 2.31.1 > Okay with this patch but see comments. > >