From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: "Cyril Hrubis" <chrubis@suse.cz>,
"Andrea Cervesato" <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 10/10] Add setxattrat02 test
Date: Fri, 10 Oct 2025 13:05:50 +0200 [thread overview]
Message-ID: <DDELDHZA33UZ.1OOCM2J6AC6I7@suse.com> (raw)
In-Reply-To: <aOY20kqNr9kZAPuY@yuki.lan>
Hi,
On Wed Oct 8, 2025 at 12:02 PM CEST, Cyril Hrubis wrote:
> Hi!
>> +} tcases[] = {
>> + {
>> + .dfd = &invalid_fd,
>> + .args = &args,
>> + .args_size = sizeof(struct xattr_args),
>> + .exp_errno = EBADF,
>> + .reason = "Invalid directory file descriptor",
>> + },
>
> Maybe it would make sense to use tst_fd to hammer the syscall with all
> kinds of strange file descriptors.
>
This makes sense for a new test, in this test it's better to keep this
approach.
>> + {
>> + .dfd = &tmpdir_fd,
>> + .at_flags = -1,
>> + .args = &args,
>> + .args_size = sizeof(struct xattr_args),
>> + .exp_errno = EINVAL,
>> + .reason = "Invalid AT flags",
>> + },
>> + {
>> + .dfd = &tmpdir_fd,
>> + .at_flags = AT_SYMLINK_NOFOLLOW + 1,
>> + .args = &args,
>> + .args_size = sizeof(struct xattr_args),
>> + .exp_errno = EINVAL,
>> + .reason = "Out of bound AT flags",
>> + },
>> + {
>> + .dfd = &tmpdir_fd,
>> + .args = &null_args,
>> + .args_size = sizeof(struct xattr_args),
>> + .exp_errno = EINVAL,
>> + .reason = "Invalid arguments",
>> + },
>> + {
>> + .dfd = &tmpdir_fd,
>> + .args = &args,
>> + .args_size = SIZE_MAX,
>> + .exp_errno = E2BIG,
>> + .reason = "Arguments size is too big",
>> + },
>> + {
>> + .dfd = &tmpdir_fd,
>> + .args = &args,
>> + .args_size = sizeof(struct xattr_args) - 1,
>> + .exp_errno = EINVAL,
>> + .reason = "Invalid arguments size",
>> + },
>> +};
>> +
>> +static void run(unsigned int i)
>> +{
>> + struct tcase *tc = &tcases[i];
>> +
>> + args->flags = XATTR_CREATE;
>> + args->value = (uint64_t)XATTR_TEST_VALUE;
>> + args->size = XATTR_TEST_VALUE_SIZE;
>> +
>> + TST_EXP_FAIL(tst_syscall(__NR_setxattrat,
>> + tc->dfd, FNAME, tc->at_flags, XATTR_TEST_KEY,
>> + tc->args, tc->args_size),
>> + tc->exp_errno, "%s", tc->reason);
>> +}
>> +
>> +static void setup(void)
>> +{
>> + char *tmpdir;
>> +
>> + tmpdir = tst_tmpdir_path();
>> + tmpdir_fd = SAFE_OPEN(tmpdir, O_DIRECTORY);
>
> Here as well, just use AT_FDCWD.
>
Ok.
>> + SAFE_TOUCH(FNAME, 0777, NULL);
>> +}
>> +
>> +static void cleanup(void)
>> +{
>> + if (tmpdir_fd != -1)
>> + SAFE_CLOSE(tmpdir_fd);
>> +
>> + SAFE_UNLINK(FNAME);
>> +}
>> +
>> +static struct tst_test test = {
>> + .test = run,
>> + .setup = setup,
>> + .cleanup = cleanup,
>> + .tcnt = ARRAY_SIZE(tcases),
>> + .needs_root = 1,
>> + .needs_tmpdir = 1,
>> + .bufs = (struct tst_buffers []) {
>> + {&args, .size = sizeof(struct xattr_args)},
>> + {},
>> + }
>> +};
>>
>> --
>> 2.51.0
>>
>>
>> --
>> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2025-10-10 11:06 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-07 6:46 [LTP] [PATCH v2 00/10] setxattrat coverage Andrea Cervesato
2025-10-07 6:46 ` [LTP] [PATCH v2 01/10] lapi: add struct xattr_args fallback Andrea Cervesato
2025-10-07 11:50 ` Cyril Hrubis
2025-10-07 6:46 ` [LTP] [PATCH v2 02/10] lapi: add setxattrat() fallback definition Andrea Cervesato
2025-10-07 12:05 ` Cyril Hrubis
2025-10-07 15:16 ` Cyril Hrubis
2025-10-07 6:46 ` [LTP] [PATCH v2 03/10] setxattr01: add setxattrat variant Andrea Cervesato
2025-10-07 12:29 ` Cyril Hrubis
2025-10-07 13:16 ` Andrea Cervesato via ltp
2025-10-07 14:35 ` Cyril Hrubis
2025-10-08 10:40 ` Andrea Cervesato via ltp
2025-10-08 12:16 ` Cyril Hrubis
2025-10-07 6:46 ` [LTP] [PATCH v2 04/10] setxattr02: " Andrea Cervesato
2025-10-07 12:40 ` Cyril Hrubis
2025-10-07 6:46 ` [LTP] [PATCH v2 05/10] setxattr03: " Andrea Cervesato
2025-10-07 15:11 ` Cyril Hrubis
2025-10-07 6:46 ` [LTP] [PATCH v2 06/10] lapi: add getxattrat() fallback Andrea Cervesato
2025-10-07 15:21 ` Cyril Hrubis
2025-10-07 6:46 ` [LTP] [PATCH v2 07/10] lapi: add removexattrat() fallback Andrea Cervesato
2025-10-07 15:26 ` Cyril Hrubis
2025-10-07 6:47 ` [LTP] [PATCH v2 08/10] lapi: add safe *xattrat macros Andrea Cervesato
2025-10-08 9:36 ` Cyril Hrubis
2025-10-07 6:47 ` [LTP] [PATCH v2 09/10] Add setxattrat01 test Andrea Cervesato
2025-10-08 9:44 ` Cyril Hrubis
2025-10-13 7:54 ` Andrea Cervesato via ltp
2025-10-07 6:47 ` [LTP] [PATCH v2 10/10] Add setxattrat02 test Andrea Cervesato
2025-10-08 10:02 ` Cyril Hrubis
2025-10-10 11:05 ` Andrea Cervesato via ltp [this message]
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=DDELDHZA33UZ.1OOCM2J6AC6I7@suse.com \
--to=ltp@lists.linux.it \
--cc=andrea.cervesato@suse.com \
--cc=andrea.cervesato@suse.de \
--cc=chrubis@suse.cz \
/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