From patchwork Mon Apr 10 15:59:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Simmons-Talbott X-Patchwork-Id: 1767202 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=SkieAKxV; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PwDFV6w3Hz1yZP for ; Tue, 11 Apr 2023 01:59:58 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E2F7B385770D for ; Mon, 10 Apr 2023 15:59:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E2F7B385770D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681142396; bh=FPdyerRlY345K20JSrigz8HuXvW2Cr6LFlL852k0So0=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=SkieAKxV5UdduOWATnF5jnLvd0pi9zcoHX9ad7wJZGk0CoBKZO8C7U108QisgtowS 1Kwm3miS15rrMpHME5okfIdPnBcT74y+Pt8dHZ8fUNlRBeCD3gKpV/xY5+NEPUeBks ITVh785I9ZLnvGkLZR1p4vwxAQxLGNa7tsmGfpLQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 3576A3858C52 for ; Mon, 10 Apr 2023 15:59:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3576A3858C52 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-145-_vTDVUeWNCOqAHFVm5w-0A-1; Mon, 10 Apr 2023 11:59:40 -0400 X-MC-Unique: _vTDVUeWNCOqAHFVm5w-0A-1 Received: by mail-qt1-f200.google.com with SMTP id bp42-20020a05622a1baa00b003e6748b05edso11192873qtb.2 for ; Mon, 10 Apr 2023 08:59:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681142380; x=1683734380; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FPdyerRlY345K20JSrigz8HuXvW2Cr6LFlL852k0So0=; b=7T81Pt2CiUI+354KFkstPhRr2VEuEPtIbHdBSitCXDewqOL/+cxBKKblhcCVt6U8t2 P4Id3iKAu7TfcF6v1RuOovt6OY118TSfwZh4vIPxLcIqjBqZst3PLQIW7/OFztwZw/co HUAnf3ChA4pBA1+9TRG9b0Pi7F6L10/D+NQjnQxkA9r4v8AwWKhvoBRZdifDEcR7xTqK yBqvOCLE178h/TZjcCkQAhcgN3MXecV4EfBZSoytdRMeSMYCJCgnm1Tjvy1ifx/mvY6W Lnn5t314bhIgSP2pDHOgQi6CigGnapquWSImR96YQ/jVqk7MT5861mcDL7m9/WidCELQ 0Anw== X-Gm-Message-State: AAQBX9fhy/uK/ANWy3egikXGFVwY/0t4O7kqvyfHFqLJr3CfvNX0h6mo xe8KnZ7y20MjBjKCsMRmDn5dB9h+zsNiph0ucTTl7wWS+gfVCurvZwBqxyBi2LoO8pB98ue4gPA RX84ueN4+nFoJWntlE56iUu/uTZvNN1GsuAQiGqOWtj+ItOKjCSzZrOp8XM0RiB3Zq/g5F/GvFA bEBLkb X-Received: by 2002:a05:6214:2627:b0:5c8:dc85:ea0d with SMTP id gv7-20020a056214262700b005c8dc85ea0dmr22940633qvb.26.1681142379805; Mon, 10 Apr 2023 08:59:39 -0700 (PDT) X-Google-Smtp-Source: AKy350ZLu5jbFLF5TNGUGVJLHjvtjvc9caWtt/OLoDudg6jgws7QseoRzehEtGjr/IePAKsPuI6tQw== X-Received: by 2002:a05:6214:2627:b0:5c8:dc85:ea0d with SMTP id gv7-20020a056214262700b005c8dc85ea0dmr22940595qvb.26.1681142379460; Mon, 10 Apr 2023 08:59:39 -0700 (PDT) Received: from oak.redhat.com (c-71-206-142-238.hsd1.va.comcast.net. [71.206.142.238]) by smtp.gmail.com with ESMTPSA id h2-20020ad45442000000b005dd8b9345e0sm3470413qvt.120.2023.04.10.08.59.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 08:59:38 -0700 (PDT) To: libc-alpha@sourceware.org Cc: Joe Simmons-Talbott Subject: [PATCH v4 0/4] string: Add tests for strdup and strndup (BZ #30266) Date: Mon, 10 Apr 2023 11:59:30 -0400 Message-Id: <20230410155934.3503627-1-josimmon@redhat.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230329150500.2886135-1-josimmon@redhat.com> References: <20230329150500.2886135-1-josimmon@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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 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-Patchwork-Original-From: Joe Simmons-Talbott via Libc-alpha From: Joe Simmons-Talbott Reply-To: Joe Simmons-Talbott Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" Copy strcpy and strncpy tests to strdup and strndup repectively. Remove tests that checked the surrounding bytes of the result as they are not needed. Changes to v3: * string/test-strdup.c - Style cleanup. Make sure we're using CHAR rather than char for wide character support. * string/test-strndup.c - Remove unneeded wide character support since there is no wcsndup(). Use TEST_COMPARE_BLOB rather than memcmp(). * wcsmbs - Enable wcsdup() testcases. Changes to v2: Remove the rest of the ifunc bits. Mark two variables as unused so that we can use string/test-string.h for functions that aren't ifuncs. Changes to v1: Since strdup and strndup are not ifuncs and likely won't be, call them directly. Use TEST_COMPARE_BLOB() rather than memcmp(). Clear up wording in a comment. Joe Simmons-Talbott (3): string: Allow use of test-string.h for non-ifunc implementations. string: Add tests for strdup (BZ #30266) string: Add tests for strndup (BZ #30266) string/Makefile | 2 + string/test-strdup.c | 203 ++++++++++++++++++++++++++++++++++++++ string/test-string.h | 4 +- string/test-strndup.c | 222 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 429 insertions(+), 2 deletions(-) create mode 100644 string/test-strdup.c create mode 100644 string/test-strndup.c