From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by sourceware.org (Postfix) with ESMTPS id DA2CD3848037 for ; Mon, 31 May 2021 16:03:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DA2CD3848037 Received: by mail-oi1-x235.google.com with SMTP id a13so7291230oid.9 for ; Mon, 31 May 2021 09:03:35 -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=COuenWS+A6z9ad/9h7WgJXvNUhPEawN5CT2ureY9IBA=; b=AaNxPYs4hUZSnWBqKQWXHToRHLdG+keg1u8sxbUM69tZHYZofmblEQGgWWqujzUGIT /4OQj0r9f/fpbgnxA6DF/lDiVBtQo1EdcxzIrhLwYM9SFAkdhYxDVHLYRwonlWb2wWfm yVmJiyXL7/9csa4XWEUCvqlUE8p/LepJqihJ2B7kTxZ1bRGu9BHr+wuZwiGucjg8GwBm ntXxOcBsZAAJFmazIddQYvOWiFC5QeB0h+np7jWoN0IDy4Fo+kINXa8XaKOART2yshXs cZjSX312A4HYzQILmmpyY2rmgXt4AvyN+3A5eVtyffY3INttGnpL33aAa+EMzSsOjCjc 9AGw== X-Gm-Message-State: AOAM532QHQtIXEqsEtgwShWRRK9GbiE8uLL1j+6nLNCYTNtyYFpnsWQX 9SRQ7bmxXBWT222ghRpgu7BM7ADPSj3CLjymHW0= X-Google-Smtp-Source: ABdhPJzm/UkPaiVtudbj4ULuG9AHBsTwCKMR0Jj9Gmzp5L1a+mVtc+xPrg/4O6qpqJTpoC7p/WtKfEuXGYxQ6zY84Uc= X-Received: by 2002:a05:6808:a8f:: with SMTP id q15mr17679035oij.35.1622477015369; Mon, 31 May 2021 09:03:35 -0700 (PDT) MIME-Version: 1.0 References: <20210531155938.421952-1-skpgkp2@gmail.com> In-Reply-To: <20210531155938.421952-1-skpgkp2@gmail.com> From: "H.J. Lu" Date: Mon, 31 May 2021 09:02:58 -0700 Message-ID: Subject: Re: [PATCH v2] 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.3 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 16:03:37 -0000 On Mon, May 31, 2021 at 8:59 AM Sunil K Pandey wrote: > > This patch covers following conditions. "the following conditions:" > - String starts with different alignments and ends at the page boundary Strings start ... and end > with less than 64 byte length. > - String starts with different alignments and cross page boundary with Strings starts > 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 > -- H.J.