From: Florian Weimer <fweimer@redhat.com>
To: Roy Eldar <royeldar0@gmail.com>
Cc: libc-alpha@sourceware.org, carlos@redhat.com
Subject: Re: [PATCH] elf: add test for dl-printf
Date: Thu, 25 May 2023 09:44:35 +0200 [thread overview]
Message-ID: <87jzwwq2ho.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20230515202942.8307-1-royeldar0@gmail.com> (Roy Eldar's message of "Mon, 15 May 2023 23:29:42 +0300")
* 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 <royeldar0@gmail.com>
Do you have a copyright assignment on file? If not, Signed-off-by: is
sufficient but we should say …
> 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.
… “Copyright The GNU Toolchain Authors.” 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
> + <https://www.gnu.org/licenses/>. */
> +
> +#include <ldsodefs.h>
> +#include <limits.h>
> +#include <stdarg.h>
> +#include <stdio.h>
> +#include <support/check.h>
> +#include <support/xunistd.h>
> +
> +#define BUFSZ 64
> +
> +#define TEST(fmt, ...) do { \
GNU style puts { and } on their own lines.
> + char str1[BUFSZ], str2[BUFSZ]; \
> + int len1 = snprintf (str1, BUFSZ, fmt, __VA_ARGS__); \
> + TEST_VERIFY_EXIT (len1 >= 0); \
> + TEST_VERIFY_EXIT (len1 < BUFSZ); \
> + _dl_dprintf (fds[1], fmt, __VA_ARGS__); \
> + ssize_t len2 = read (fds[0], str2, BUFSZ); \
> + TEST_VERIFY_EXIT (len2 >= 0); \
> + TEST_VERIFY_EXIT (len2 < BUFSZ); \
> + str2[len2] = '\0'; \
> + TEST_COMPARE_STRING(str1, str2); \
Missing space after TEST_COMPARE_STRING.
Rest looks good.
Thanks,
Florian
next prev parent reply other threads:[~2023-05-25 7:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-03 21:16 [PATCH] elf: fix handling of negative numbers in dl-printf Roy Eldar
2023-05-08 13:42 ` Florian Weimer
2023-05-08 18:08 ` Roy E
2023-05-24 17:41 ` Roy E
2023-05-15 20:29 ` [PATCH] elf: add test for dl-printf Roy Eldar
2023-05-25 7:44 ` Florian Weimer [this message]
2023-05-25 14:41 ` [PATCH v2] " Roy Eldar
2023-05-25 17:10 ` Florian Weimer
2023-05-25 7:46 ` [PATCH] elf: fix handling of negative numbers in dl-printf Florian Weimer
2023-05-25 14:41 ` [PATCH v2] " Roy Eldar
2023-05-25 17:10 ` Florian Weimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87jzwwq2ho.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=carlos@redhat.com \
--cc=libc-alpha@sourceware.org \
--cc=royeldar0@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).