From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by sourceware.org (Postfix) with ESMTPS id 72A7A3858004 for ; Mon, 31 May 2021 18:22:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 72A7A3858004 Received: by mail-oi1-x231.google.com with SMTP id x15so13040793oic.13 for ; Mon, 31 May 2021 11:22:27 -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=dgGnR1yL0fdTBvKwB2cMEFpoXOzWORoiuKtuZ0p8of8=; b=ccDHM21pQ+t9lcZl9v/jEFi4ENL1PXu+cTwR4adkEkrTzO3QftooJuV+ii1zFn/UfL wPP2YJgmUf2oMM6KyZRIuUJTv0LgGXiEJmMJWy0dNK5C9j8bcVcQLCu5RJmnfT+0sZA3 +mCusI4m+9bfZpsylUi4X4bdjZL1rNJUIgmuey0dqkSJ6572nfXlBABHhIke4P5cdEzW GkMQiQMrvhjU7jZ6b9+SWVcCLmiTetQlyzsXGoOWsfheBBrt8CA66e9yIYBZflaAED+e HomBlqZo+RMj5I49QBzSud2FLw6w2Tj6CdjVyXJCtl9MaO7m9kkm6b+BnaJwEJ9ZhNiX CjRg== X-Gm-Message-State: AOAM531wLJQAhuhjN82vO8Oxb9GjBKEDiEkGiRXRoqL1rZYkTXyGfSnj /S/INBv2ZV1/Vmnk9B83+XPWP0R8MDE88IGymDY= X-Google-Smtp-Source: ABdhPJyqvcLlmiRcgwltfd3YVZHJFBZZ39J2v6eLKjpKQEl6jMbuT7NCjallDaSLyaauOmnMuZjHciZ2tar8E4WSFjs= X-Received: by 2002:aca:3c4:: with SMTP id 187mr7370525oid.116.1622485346943; Mon, 31 May 2021 11:22:26 -0700 (PDT) MIME-Version: 1.0 References: <20210531180812.501625-1-skpgkp2@gmail.com> In-Reply-To: <20210531180812.501625-1-skpgkp2@gmail.com> From: "H.J. Lu" Date: Mon, 31 May 2021 11:21:50 -0700 Message-ID: Subject: Re: [PATCH v3] Improve test coverage of strlen function To: Sunil K Pandey Cc: GNU C Library Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3034.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: Mon, 31 May 2021 18:22:28 -0000 On Mon, May 31, 2021 at 11:08 AM Sunil K Pandey wrote: > > This patch covers the following conditions: > > - Strings start with different alignments and end at the page boundary > with less than 64 byte length. > - Strings starts with different alignments and cross page boundary with > fixed length. > --- > string/test-strlen.c | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/string/test-strlen.c b/string/test-strlen.c > index 6e67d1f1f1..c9a7afb339 100644 > --- a/string/test-strlen.c > +++ b/string/test-strlen.c > @@ -79,7 +79,7 @@ do_test (size_t align, size_t len) > { > size_t i; > > - align &= 63; > + align &= (getpagesize () / sizeof (CHAR)) - 1; > if (align + sizeof (CHAR) * len >= page_size) > return; > > @@ -160,6 +160,19 @@ test_main (void) > do_test (sizeof (CHAR) * i, (size_t)((1 << i) / 1.5)); > } > > + /* Test strings near page boundary */ > + > + size_t maxlength = 64 / sizeof (CHAR) - 1; > + size_t pagesize = getpagesize () / sizeof (CHAR); > + > + for (i = maxlength ; i > 1; --i) > + { > + /* String stays on the same page. */ > + do_test (pagesize - i, i - 1); > + /* String crosses page boundary. */ > + do_test (pagesize - i, maxlength); > + } > + > do_random_tests (); > return ret; > } > -- > 2.31.1 > LGTM. Reviewed-by: H.J. Lu Thanks. -- H.J.