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 241803858D28 for ; Thu, 25 May 2023 07:44:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 241803858D28 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=1685000681; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OIag3GXKbJke8woM4RZod32mkoK0+p6hk0KwRHxSjnI=; b=M64hS4j/MKVQ1/AKq6y6sJGIQ2liy3b6Mc1F/VOpnXte8unlnEkLNQCcw/06Ru2N1V6q3r 5J/rkgdH2oza/ehJF5wUe3RAsAStBStgWnkNgiBoKlU/Erno+bnLB1ZTVZXPyn2POZihrE 24qq3xbhe5jgVt19Ikvmx0ft2VJlm4g= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-638-QY1v4KSRNk6i-7Xogwo2bQ-1; Thu, 25 May 2023 03:44:38 -0400 X-MC-Unique: QY1v4KSRNk6i-7Xogwo2bQ-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 470E43806706; Thu, 25 May 2023 07:44:38 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.8]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 41EDD40CFD45; Thu, 25 May 2023 07:44:37 +0000 (UTC) From: Florian Weimer To: Roy Eldar Cc: libc-alpha@sourceware.org, carlos@redhat.com Subject: Re: [PATCH] elf: add test for dl-printf References: <87mt2fq6qp.fsf@oldenburg.str.redhat.com> <20230515202942.8307-1-royeldar0@gmail.com> Date: Thu, 25 May 2023 09:44:35 +0200 In-Reply-To: <20230515202942.8307-1-royeldar0@gmail.com> (Roy Eldar's message of "Mon, 15 May 2023 23:29:42 +0300") Message-ID: <87jzwwq2ho.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 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=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-10.9 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,T_SCC_BODY_TEXT_LINE 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: * Roy Eldar: > This patch checks _dl_debug_vdprintf, by passing various inputs to > _dl_dprintf and comparing the output with invocations of snprintf. > > Signed-off-by: Roy Eldar Do you have a copyright assignment on file? If not, Signed-off-by: is sufficient but we should say =E2=80=A6 > diff --git a/elf/tst-dl-printf-static.c b/elf/tst-dl-printf-static.c > new file mode 100644 > index 0000000000..a31759a006 > --- /dev/null > +++ b/elf/tst-dl-printf-static.c > @@ -0,0 +1,75 @@ > +/* Check _dl_debug_vdprintf. > + Copyright (C) 2016-2023 Free Software Foundation, Inc. =E2=80=A6 =E2=80=9CCopyright The GNU Toolchain Authors.=E2=80=9D here. > + 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 > +#include > +#include > +#include > +#include > +#include > + > +#define BUFSZ 64 > + > +#define TEST(fmt, ...) do { = \ GNU style puts { and } on their own lines. > + char str1[BUFSZ], str2[BUFSZ]; = \ > + int len1 =3D snprintf (str1, BUFSZ, fmt, __VA_ARGS__); = \ > + TEST_VERIFY_EXIT (len1 >=3D 0); = \ > + TEST_VERIFY_EXIT (len1 < BUFSZ); = \ > + _dl_dprintf (fds[1], fmt, __VA_ARGS__); = \ > + ssize_t len2 =3D read (fds[0], str2, BUFSZ); = \ > + TEST_VERIFY_EXIT (len2 >=3D 0); = \ > + TEST_VERIFY_EXIT (len2 < BUFSZ); = \ > + str2[len2] =3D '\0'; = \ > + TEST_COMPARE_STRING(str1, str2); = \ Missing space after TEST_COMPARE_STRING. Rest looks good. Thanks, Florian