From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 554933858C52 for ; Mon, 10 Apr 2023 13:53:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 554933858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681134816; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SraN8JV+wrrS8IadWjTZl0XMEpDgM4FMU4EruaSTjV4=; b=bJI/fS54V7TlTv8YuIIfk93CkPhhaFBQayGP9fl4laLa4ThP2GvBcynIkNudcKWl3WrSMU ONXaNENSyib2AF3A5FOLNXdLVRSGmSx+9nQWcd8ZUl7f5RSk6OqLdIpKcnxAWhAy+xYoZw nx+d1maL8KQPgWMrQ5Dqm3/pYD4QZIY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-28-1ZMAf7kbNc-1PDHC50__uw-1; Mon, 10 Apr 2023 09:53:35 -0400 X-MC-Unique: 1ZMAf7kbNc-1PDHC50__uw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3D23B890F64; Mon, 10 Apr 2023 13:53:35 +0000 (UTC) Received: from oak (unknown [10.22.9.86]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F36340C83AC; Mon, 10 Apr 2023 13:53:35 +0000 (UTC) Date: Mon, 10 Apr 2023 09:53:33 -0400 From: Joe Simmons-Talbott To: Adhemerval Zanella Netto Cc: libc-alpha@sourceware.org Subject: Re: [PATCH v3 2/3] string: Add tests for strdup (BZ #30266) Message-ID: <20230410135333.GA2106608@oak> References: <20230329150500.2886135-1-josimmon@redhat.com> <20230404190040.2507343-1-josimmon@redhat.com> <20230404190040.2507343-3-josimmon@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, Apr 07, 2023 at 03:19:38PM -0300, Adhemerval Zanella Netto wrote: > > > On 04/04/23 16:00, Joe Simmons-Talbott via Libc-alpha wrote: > > Copy strcpy tests for strdup. Covers some basic testcases with random > > strings. Add a zero-length string testcase. > > Just minor style issue. > > LGTM, thanks. > > Reviewed-by: Adhemerval Zanella > > > --- > > string/Makefile | 1 + > > string/test-strdup.c | 201 +++++++++++++++++++++++++++++++++++++++++++ > > 2 files changed, 202 insertions(+) > > create mode 100644 string/test-strdup.c > > > > diff --git a/string/Makefile b/string/Makefile > > index c84b49aaa5..472e318aea 100644 > > --- a/string/Makefile > > +++ b/string/Makefile > > @@ -157,6 +157,7 @@ tests := \ > > test-strcmp \ > > test-strcpy \ > > test-strcspn \ > > + test-strdup \ > > test-strlen \ > > test-strncasecmp \ > > test-strncat \ > > diff --git a/string/test-strdup.c b/string/test-strdup.c > > new file mode 100644 > > index 0000000000..f45fb4c852 > > --- /dev/null > > +++ b/string/test-strdup.c > > @@ -0,0 +1,201 @@ > > +/* Test and measure strdup functions. > > + Copyright (C) 2023 Free Software Foundation, Inc. > > + This file is part of the GNU C Library. > > + > > + The GNU C Library is free software; you can redistribute it and/or > > + modify it under the terms of the GNU Lesser General Public > > + License as published by the Free Software Foundation; either > > + version 2.1 of the License, or (at your option) any later version. > > + > > + The GNU C Library is distributed in the hope that it will be useful, > > + but WITHOUT ANY WARRANTY; without even the implied warranty of > > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > + Lesser General Public License for more details. > > + > > + You should have received a copy of the GNU Lesser General Public > > + License along with the GNU C Library; if not, see > > + . */ > > + > > +#include > > + > > +#ifdef WIDE > > +# include > > +# define CHAR wchar_t > > +# define UCHAR wchar_t > > +# define sfmt "ls" > > +# define BIG_CHAR WCHAR_MAX > > +# define SMALL_CHAR 1273 > > +# define STRCMP wcscmp > > +# define MEMCMP wmemcmp > > +# define MEMSET wmemset > > +#else > > +# define CHAR char > > +# define UCHAR unsigned char > > +# define sfmt "s" > > +# define BIG_CHAR CHAR_MAX > > +# define SMALL_CHAR 127 > > +# define STRCMP strcmp > > +# define MEMCMP memcmp > > +# define MEMSET memset > > +#endif > > Do you plan to add wcsdup tests as well? I assumed the above would cover that as well. Do I need to indicate in the Makefile to run these tests with and without WIDE defined? Does TEST_COMPARE_STRING handle wide strings as well? Thanks, Joe