From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id D88483858C52 for ; Mon, 10 Apr 2023 14:44:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D88483858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ot1-x32b.google.com with SMTP id bu14-20020a0568300d0e00b0069fab3f4cafso2372760otb.9 for ; Mon, 10 Apr 2023 07:44:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681137876; x=1683729876; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=KeqjuCeMMpEy449ejMO894LI0XROsK/j7x13QVN2Zvk=; b=WNIPF7h8SqDJipl+8IG3D7dm+9EP1iR3BvWwjI5xBfNtuG8glyWsSl24BM26Txl0ok c5cx1dUss+PVM4WPKy0VPb8imtsp0sbBeC8T1OyiAE352zdqUIJQEfeE/+CrZIRwOsBW BSJo0GLpBsF/DLEaY8J2ssAwky3KGuOYusLVRji5xLO7mrkOZgPG/yZszQssjBfWGbQt /IwHJFB8fkFG6S19rOpHvjjY63BAxRO0lwuZpICtKnReQWjJfa7YvYKZVuILEME7Aiin aymoDYqbmUEOBQQu7Qo9Zb100Nn7nOQsJ5EteC+jalb95Q0gpkL7L26KuTvAdAeEHSLB RTVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681137876; x=1683729876; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=KeqjuCeMMpEy449ejMO894LI0XROsK/j7x13QVN2Zvk=; b=H4xVGhlGqXZs+wZ7ZhBEIdut7lZMpBRGvbxez8ooVwL9cfIp3LX/CAi4RGEiMFIrg1 O89bipaDJbL4V3DPpE+4/ZDc6i2btxTB1bUTFuPoYUVlhAP4gsdICf3aF2RUJIotBF3g LNafFqY3z+a3HqtU6FtgGtetk5NebftKEVLod4rKfIMfcXxDqwRHF/TaYMaX9AdyNNlX DKWJ4uA1ElovK/KkFusjDTVnOZc/ctet3oDvCtSbV69f8Njbgo0zrVNpA5GMn6dLuPtZ +ruGX3fQ64GZUcnI9Cgh7oX/NrixQ0JVFKuXmqDolCY5V5GIz0gAgQ7i4tzUWOAkO3eK ACnw== X-Gm-Message-State: AAQBX9dJSBZ6RzOIMYLo+D8uJUwcy3NYv0Nul2cW8j227FNyQgguz35l CmVahd/CVmwrylpUt/rFW5wHVw== X-Google-Smtp-Source: AKy350axVh3N80Q2KncJE4n2C3eu+Hs6k1qIPyc6/oDtaEcyhXX8LmCGY6KWoLYhhfPgyeHU+JRYeA== X-Received: by 2002:a9d:7ac4:0:b0:69f:b541:3f6e with SMTP id m4-20020a9d7ac4000000b0069fb5413f6emr5125859otn.19.1681137876076; Mon, 10 Apr 2023 07:44:36 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c2:55a1:1474:97d8:bf65:d9d0? ([2804:1b3:a7c2:55a1:1474:97d8:bf65:d9d0]) by smtp.gmail.com with ESMTPSA id c6-20020a9d67c6000000b006a143873c6bsm4340307otn.50.2023.04.10.07.44.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Apr 2023 07:44:35 -0700 (PDT) Message-ID: <10faa1e6-bd16-3f93-701c-aad5c9d83165@linaro.org> Date: Mon, 10 Apr 2023 11:44:33 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH v3 2/3] string: Add tests for strdup (BZ #30266) To: Joe Simmons-Talbott Cc: libc-alpha@sourceware.org References: <20230329150500.2886135-1-josimmon@redhat.com> <20230404190040.2507343-1-josimmon@redhat.com> <20230404190040.2507343-3-josimmon@redhat.com> <20230410135333.GA2106608@oak> Content-Language: en-US From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <20230410135333.GA2106608@oak> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-14.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 10/04/23 10:53, Joe Simmons-Talbott wrote: > 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? You need to actually enable by adding it on wcsmbs/Makefile.