[LTP] [PATCH v3] Add ioctl_ficlone04 test
Jan Kara
jack@suse.cz
Thu Jul 25 16:35:00 CEST 2024
On Wed 24-07-24 22:02:11, Andrea Cervesato wrote:
> From: Andrea Cervesato <andrea.cervesato@suse.com>
>
> This test verifies that ioctl() FICLONE/FICLONERANGE feature raises
> the right error according with bad file descriptors.
>
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
...
> +static void test_bad_fd(struct tst_fd *fd_src, struct tst_fd *fd_dst)
> +{
> + if (fd_src->type == TST_FD_FILE && fd_src->type == fd_dst->type) {
> + tst_res(TCONF, "Skipping file: SUCCESS");
> + return;
> + }
> +
> + if (fd_src->type == TST_FD_MEMFD && fd_src->type == fd_dst->type) {
> + tst_res(TCONF, "Skipping memory: EOPNOTSUPP");
> + return;
> + }
> +
> + int exp_errnos[] = {
> + EISDIR,
> + EBADF,
> + EINVAL,
> + EXDEV,
> + };
Two comments here: Sometimes security modules forbid operations on
unexpected file types and you get EPERM in that case so I'd add it to the
list of allowed error codes. Also the test for EOPNOTSUPP looks a bit
fragile to me. Currently TST_FD_MEMFD is the only fd type where we'd get as
far as checking whether the fs actually supports reflink but that could
change in the future. So I'd not special-case MEMFD and instead add
EOPNOTSUPP as another allowed error code. Otherwise the test looks good to
me.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
More information about the ltp
mailing list