* [LTP] [PATCH] syscalls/copy_file_range02: skip new error tests if cross-fs isn't supported
@ 2019-10-25 1:59 Yang Xu
2019-10-25 8:37 ` Petr Vorel
0 siblings, 1 reply; 5+ messages in thread
From: Yang Xu @ 2019-10-25 1:59 UTC (permalink / raw)
To: ltp
We should not skip the whole error test if cross-fs isn't support because
old errors should be tested on all version. Even we use .mount_device = 1
and .mntpoint = MNTPOINT, the src and dest file are still in tmp directory
instead of mntpoint.
ps: I doubt whether we should skip new error test because it indeed exposed this
unreasonable copy_file_range behavior of the user.
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
---
.../copy_file_range/copy_file_range02.c | 39 +++++++++++--------
1 file changed, 22 insertions(+), 17 deletions(-)
diff --git a/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c b/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
index a55de4111..e4159cad7 100644
--- a/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
+++ b/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
@@ -55,6 +55,7 @@ static int need_unlink;
static int chattr_i_nsup;
static int swap_nsup;
+static int cross_sup;
static int loop_devn;
static struct tcase {
@@ -63,21 +64,22 @@ static struct tcase {
int exp_err;
loff_t len;
const char *tname;
+ int new_error;
} tcases[] = {
- {&fd_rdonly, 0, EBADF, CONTSIZE, "readonly file"},
- {&fd_dir, 0, EISDIR, CONTSIZE, "directory"},
- {&fd_append, 0, EBADF, CONTSIZE, "append to file"},
- {&fd_closed, 0, EBADF, CONTSIZE, "closed file descriptor"},
- {&fd_dest, -1, EINVAL, CONTSIZE, "invalid flags"},
- {&fd_immutable, 0, EPERM, CONTSIZE, "immutable file"},
- {&fd_swapfile, 0, ETXTBSY, CONTSIZE, "swap file"},
- {&fd_dup, 0, EINVAL, CONTSIZE/2, "overlaping range"},
- {&fd_blkdev, 0, EINVAL, CONTSIZE, "block device"},
- {&fd_chrdev, 0, EINVAL, CONTSIZE, "char device"},
- {&fd_fifo, 0, EINVAL, CONTSIZE, "fifo"},
- {&fd_pipe[0], 0, EINVAL, CONTSIZE, "pipe"},
- {&fd_copy, 0, EOVERFLOW, ULLONG_MAX, "max length lenght"},
- {&fd_copy, 0, EFBIG, MIN_OFF, "max file size"},
+ {&fd_rdonly, 0, EBADF, CONTSIZE, "readonly file", 0},
+ {&fd_dir, 0, EISDIR, CONTSIZE, "directory", 0},
+ {&fd_append, 0, EBADF, CONTSIZE, "append to file", 0},
+ {&fd_closed, 0, EBADF, CONTSIZE, "closed file descriptor", 0},
+ {&fd_dest, -1, EINVAL, CONTSIZE, "invalid flags", 0},
+ {&fd_immutable, 0, EPERM, CONTSIZE, "immutable file", 1},
+ {&fd_swapfile, 0, ETXTBSY, CONTSIZE, "swap file", 1},
+ {&fd_dup, 0, EINVAL, CONTSIZE/2, "overlaping range", 1},
+ {&fd_blkdev, 0, EINVAL, CONTSIZE, "block device", 0},
+ {&fd_chrdev, 0, EINVAL, CONTSIZE, "char device", 0},
+ {&fd_fifo, 0, EINVAL, CONTSIZE, "fifo", 0},
+ {&fd_pipe[0], 0, EINVAL, CONTSIZE, "pipe", 0},
+ {&fd_copy, 0, EOVERFLOW, ULLONG_MAX, "max length lenght", 1},
+ {&fd_copy, 0, EFBIG, MIN_OFF, "max file size", 1},
};
static int run_command(char *command, char *option, char *file)
@@ -105,6 +107,11 @@ static void verify_copy_file_range(unsigned int n)
tst_res(TINFO, "Test #%d: %s", n, tc->tname);
+ if (tc->new_error && !cross_sup) {
+ tst_res(TCONF,
+ "copy_file_range() doesn't support cross-device, skip it");
+ return;
+ }
if (tc->copy_to_fd == &fd_immutable && chattr_i_nsup) {
tst_res(TCONF, "filesystem doesn't support chattr +i, skip it");
return;
@@ -178,9 +185,7 @@ static void setup(void)
syscall_info();
char dev_path[1024];
- if (!verify_cross_fs_copy_support(FILE_SRC_PATH, FILE_MNTED_PATH))
- tst_brk(TCONF,
- "copy_file_range() doesn't support cross-device, skip it");
+ cross_sup = verify_cross_fs_copy_support(FILE_SRC_PATH, FILE_MNTED_PATH);
if (access(FILE_DIR_PATH, F_OK) == -1)
SAFE_MKDIR(FILE_DIR_PATH, 0777);
--
2.18.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [LTP] [PATCH] syscalls/copy_file_range02: skip new error tests if cross-fs isn't supported
2019-10-25 1:59 [LTP] [PATCH] syscalls/copy_file_range02: skip new error tests if cross-fs isn't supported Yang Xu
@ 2019-10-25 8:37 ` Petr Vorel
2019-10-25 10:15 ` Amir Goldstein
2019-10-28 7:47 ` Yang Xu
0 siblings, 2 replies; 5+ messages in thread
From: Petr Vorel @ 2019-10-25 8:37 UTC (permalink / raw)
To: ltp
Hi Xu,
> We should not skip the whole error test if cross-fs isn't support because
> old errors should be tested on all version. Even we use .mount_device = 1
> and .mntpoint = MNTPOINT, the src and dest file are still in tmp directory
> instead of mntpoint.
> ps: I doubt whether we should skip new error test because it indeed exposed this
> unreasonable copy_file_range behavior of the user.
> Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Tested-by: Petr Vorel <pvorel@suse.cz>
LGTM, but I'd like to have Amir's review/ack.
Kind regards,
Petr
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH] syscalls/copy_file_range02: skip new error tests if cross-fs isn't supported
2019-10-25 8:37 ` Petr Vorel
@ 2019-10-25 10:15 ` Amir Goldstein
2019-10-28 7:47 ` Yang Xu
1 sibling, 0 replies; 5+ messages in thread
From: Amir Goldstein @ 2019-10-25 10:15 UTC (permalink / raw)
To: ltp
On Fri, Oct 25, 2019 at 11:37 AM Petr Vorel <pvorel@suse.cz> wrote:
>
> Hi Xu,
>
> > We should not skip the whole error test if cross-fs isn't support because
> > old errors should be tested on all version. Even we use .mount_device = 1
> > and .mntpoint = MNTPOINT, the src and dest file are still in tmp directory
> > instead of mntpoint.
>
> > ps: I doubt whether we should skip new error test because it indeed exposed this
> > unreasonable copy_file_range behavior of the user.
>
> > Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> Tested-by: Petr Vorel <pvorel@suse.cz>
>
> LGTM, but I'd like to have Amir's review/ack.
>
ACK. I'm fine with the test code.
If you tested it and it passed on both new and old kernel,
it's fine by me.
Thanks,
Amir.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH] syscalls/copy_file_range02: skip new error tests if cross-fs isn't supported
2019-10-25 8:37 ` Petr Vorel
2019-10-25 10:15 ` Amir Goldstein
@ 2019-10-28 7:47 ` Yang Xu
2019-10-29 12:21 ` Petr Vorel
1 sibling, 1 reply; 5+ messages in thread
From: Yang Xu @ 2019-10-28 7:47 UTC (permalink / raw)
To: ltp
on 2019/10/25 16:37, Petr Vorel wrote:
> Hi Xu,
>
>> We should not skip the whole error test if cross-fs isn't support because
>> old errors should be tested on all version. Even we use .mount_device = 1
>> and .mntpoint = MNTPOINT, the src and dest file are still in tmp directory
>> instead of mntpoint.
>
>> ps: I doubt whether we should skip new error test because it indeed exposed this
>> unreasonable copy_file_range behavior of the user.
>
>> Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> Tested-by: Petr Vorel <pvorel@suse.cz>
>
> LGTM, but I'd like to have Amir's review/ack.
Hi Petr
Now, I think it can be merged if you don't have other doubt.
Thanks
Yang Xu
>
> Kind regards,
> Petr
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH] syscalls/copy_file_range02: skip new error tests if cross-fs isn't supported
2019-10-28 7:47 ` Yang Xu
@ 2019-10-29 12:21 ` Petr Vorel
0 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2019-10-29 12:21 UTC (permalink / raw)
To: ltp
Hi Xu,
> > LGTM, but I'd like to have Amir's review/ack.
> Now, I think it can be merged if you don't have other doubt.
Thanks for your patch, merged.
Kind regards,
Petr
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-10-29 12:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-25 1:59 [LTP] [PATCH] syscalls/copy_file_range02: skip new error tests if cross-fs isn't supported Yang Xu
2019-10-25 8:37 ` Petr Vorel
2019-10-25 10:15 ` Amir Goldstein
2019-10-28 7:47 ` Yang Xu
2019-10-29 12:21 ` Petr Vorel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.