From: Petr Vorel <pvorel@suse.cz>
To: "Ricardo B. Marlière" <rbm@suse.com>
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v5 6/8] syscalls/mknod06: Convert to new API
Date: Fri, 6 Jun 2025 14:06:36 +0200 [thread overview]
Message-ID: <20250606120636.GF1289709@pevik> (raw)
In-Reply-To: <20250605-conversions-mknod-v5-6-0b5cff90c21c@suse.com>
Hi Ricardo,
> +static struct tcase {
> char *pathname;
> char *desc;
> int exp_errno;
> - int (*setupfunc) ();
> -} Test_cases[] = {
> - {"tnode_1", "Specified node already exists", EEXIST, setup1}, {
> - NULL, "Invalid address", EFAULT, no_setup}, {
> - "testdir_2/tnode_2", "Non-existent file", ENOENT, no_setup}, {
> - "", "Pathname is empty", ENOENT, no_setup}, {
> - Longpathname, "Pathname too long", ENAMETOOLONG, longpath_setup}, {
> - "tnode/tnode_3", "Path contains regular file", ENOTDIR, setup3}, {
> - NULL, NULL, 0, no_setup}
> +} tcases[] = {
> + { NULL, "Pathname too long", ENAMETOOLONG },
> + { "tnode_1", "Specified node already exists", EEXIST },
> + { NULL, "Invalid address", EFAULT },
> + { "testdir_2/tnode_2", "Non-existent file", ENOENT },
> + { "", "Pathname is empty", ENOENT },
> + { "tnode/tnode_3", "Path contains regular file", ENOTDIR },
> };
Using some constants for path reused ("tnode_1" and "tnode") would be slightly
clearer, but it can stay as is.
...
> +static void setup(void)
> {
> + SAFE_MKNOD("tnode_1", MODE_FIFO_RWX, 0);
> + SAFE_MKNOD("tnode", MODE_FIFO_RWX, 0);
NOTE: if I were the original patch writer, I would really create an empty file,
not a named pipe:
fd = SAFE_OPEN("tnode", O_WRONLY | O_CREAT | O_TRUNC, 0644);
SAFE_CLOSE(fd);
But maybe there was a reason to create named pipe instead of a regular file.
...
> +static struct tst_test test = {
> + .setup = setup,
> + .test = run,
> + .tcnt = ARRAY_SIZE(tcases),
> + .needs_tmpdir = 1,
> + .bufs = (struct tst_buffers[]) {
> + { &longpathname, .size = PATH_MAX + 2 },
> + {},
+1 for using Guarded buffers.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2025-06-06 12:07 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-05 12:52 [LTP] [PATCH v5 0/8] syscalls/mknod: Refactor all tests Ricardo B. Marlière via ltp
2025-06-05 12:52 ` [LTP] [PATCH v5 1/8] syscalls/mknod01: Fix checkpatch.pl warnings Ricardo B. Marlière via ltp
2025-06-05 12:52 ` [LTP] [PATCH v5 2/8] syscalls/mknod02: Use relative path to avoid use of SAFE_CHDIR Ricardo B. Marlière via ltp
2025-06-06 10:08 ` Petr Vorel
2025-06-05 12:52 ` [LTP] [PATCH v5 3/8] syscalls/mknod03: Convert to new API Ricardo B. Marlière via ltp
2025-06-06 10:34 ` Petr Vorel
2025-06-06 11:49 ` Petr Vorel
2025-06-06 11:57 ` Ricardo B. Marlière via ltp
2025-06-06 12:33 ` Petr Vorel
2025-06-05 12:52 ` [LTP] [PATCH v5 4/8] syscalls/mknod04: " Ricardo B. Marlière via ltp
2025-06-06 10:48 ` Petr Vorel
2025-06-06 11:05 ` Ricardo B. Marlière via ltp
2025-06-06 11:27 ` Petr Vorel
2025-06-06 11:31 ` Ricardo B. Marlière via ltp
2025-06-06 13:59 ` Petr Vorel
2025-06-05 12:52 ` [LTP] [PATCH v5 5/8] syscalls/mknod05: " Ricardo B. Marlière via ltp
2025-06-06 11:44 ` Petr Vorel
2025-06-06 11:45 ` Ricardo B. Marlière via ltp
2025-06-05 12:52 ` [LTP] [PATCH v5 6/8] syscalls/mknod06: " Ricardo B. Marlière via ltp
2025-06-06 12:06 ` Petr Vorel [this message]
2025-06-05 12:52 ` [LTP] [PATCH v5 7/8] syscalls/mknod07: " Ricardo B. Marlière via ltp
2025-06-06 12:21 ` Petr Vorel
2025-06-05 12:52 ` [LTP] [PATCH v5 8/8] syscalls/mknod08: " Ricardo B. Marlière via ltp
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=20250606120636.GF1289709@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
--cc=rbm@suse.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