public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v7 3/3] syscalls/copy_file_range02: increase coverage and remove EXDEV test
Date: Thu, 8 Aug 2019 11:11:43 +0800	[thread overview]
Message-ID: <5D4B92EF.4090800@cn.fujitsu.com> (raw)
In-Reply-To: <20190807101742.mt6tgowsh4xw5hyt@XZHOUW.usersys.redhat.com>

on 2019/08/07 18:17, Murphy Zhou wrote:

> And I have a question about LTP itself.
>
> If we run the testcase directly like:
> 	 ./testcases/kernel/syscalls/copy_file_range/copy_file_range02
>
> to test all_filesystems, for every filesystem, we mkfs and mount it in
> .mntpoint, but we do not chdir to .mntpoint. So we are running tests in 
> the same tmpdir, fs type of which does not change while looping
> all_filesystems.  Only the .mntpoint in tmpdir has different fs type in
> each loop.
>
> Now we are using this to test cross-device copy in copy_file_range01.c,
> but in copy_file_range02.c, we are not using .mntpint at all, all the
> tests in the all_filesystems loop are running in the same tmpdir. In other
> words, we are NOT testing all filesystems.
>
> Is this expected?
 I removed the mnted test for cross-device copy_file_range in copy_file_range02.c.
And I ignore the non-used mntpoint. IMO, we can directly use the FILE_MNTED to test EFBIG on all filesystems, 

as below:
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 26bfa008a..67974ffa2 100644
--- a/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
+++ b/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
@@ -49,6 +49,7 @@ static int fd_blkdev;
 static int fd_chrdev;
 static int fd_fifo;
 static int fd_copy;
+static int fd_mnted;

 static int chattr_i_nsup;
 static int swap_nsup;

@@ -73,7 +74,7 @@ static struct tcase {
        {&fd_chrdev,    0,   EINVAL,     0,     CONTSIZE},
        {&fd_fifo,      0,   EINVAL,     0,     CONTSIZE},
        {&fd_copy,      0,   EOVERFLOW,  MAX_OFF, ULLONG_MAX},
-       {&fd_copy,      0,   EFBIG,      MAX_OFF, MIN_OFF},
+       {&fd_mnted,      0,   EFBIG,      MAX_OFF, MIN_OFF},
 };

 static int run_command(char *command, char *option, char *file)
@@ -117,7 +118,10 @@ static void verify_copy_file_range(unsigned int n)
                        tst_res(TPASS | TTERRNO,
                                        "copy_file_range failed as expected");
                } else {
-                       tst_res(TFAIL | TTERRNO,
+                       if (tc->exp_err == EFBIG && TST_ERR == EXDEV)
+                               tst_res(TCONF, "copy_file_range doesn't support cross-device,skip it");
+                       else
+                               tst_res(TFAIL | TTERRNO,
                                "copy_file_range failed unexpectedly; expected %s, but got",
                                tst_strerrno(tc->exp_err));
                        return;

@@ -152,6 +156,8 @@ static void cleanup(void)
                SAFE_CLOSE(fd_dup);
        if (fd_copy > 0)
                SAFE_CLOSE(fd_copy);
+       if (fd_mnted > 0)
+               SAFE_CLOSE(fd_mnted);
        SAFE_UNLINK(FILE_FIFO);
 }

@@ -194,6 +200,7 @@ static void setup(void)

        fd_copy = SAFE_OPEN(FILE_COPY_PATH, O_RDWR | O_CREAT | O_TRUNC, 0664);
        chattr_i_nsup = run_command("chattr", "+i", FILE_IMMUTABLE_PATH);
+       fd_mnted  = SAFE_OPEN(FILE_MNTED_PATH, O_RDWR | O_CREAT, 0664);

        if (!tst_fs_has_free(".", sysconf(_SC_PAGESIZE) * 10, TST_BYTES)) {
                tst_res(TCONF, "Insufficient disk space to create swap file");
                swap_nsup = 3;

test12) succeed on extN, failed on both btrfs and xfs, we need to detect filesystem type to handle. Or, I think we 
can set a limit on filesize because this kind of user scene is a bit more than the first one , the EFBIG error can be 
received easily (Also, we don't need  mnt_device mntpoint all_filesystem if so).
What do you think about it?

> I commented out testcases in copy_file_range02.c other then #12, and add
> some nasty debug info:




  parent reply	other threads:[~2019-08-08  3:11 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-03  3:41 [LTP] [PATCH] syscalls/copy_file_range02: increase coverage and remove EXDEV test Yang Xu
2019-07-05 15:22 ` Amir Goldstein
2019-07-05 20:42   ` [LTP] [PATCH v2] " Yang Xu
2019-07-08 15:17     ` Amir Goldstein
2019-07-09  6:57       ` Yang Xu
2019-07-09 10:06         ` Amir Goldstein
2019-07-10  7:18           ` [LTP] [PATCH v3 1/3] lib: alter find_free_loopdev() Yang Xu
2019-07-10  7:18             ` [LTP] [PATCH v3 2/3] syscalls/copy_file_range01: add cross-device test Yang Xu
2019-07-10  7:50               ` Amir Goldstein
2019-07-10  8:22                 ` Yang Xu
2019-07-10  7:18             ` [LTP] [PATCH v3 3/3] syscalls/copy_file_range02: increase coverage and remove EXDEV test Yang Xu
2019-07-10  7:57               ` Amir Goldstein
2019-07-10  9:31                 ` Yang Xu
2019-07-10 10:53                   ` [LTP] [PATCH v4 1/3] lib: alter find_free_loopdev() Yang Xu
2019-07-10 10:53                     ` [LTP] [PATCH v4 2/3] syscalls/copy_file_range01: add cross-device test Yang Xu
2019-07-10 15:56                       ` Xiao Yang
2019-07-11  6:18                         ` Yang Xu
2019-07-10 10:53                     ` [LTP] [PATCH v4 3/3] syscalls/copy_file_range02: increase coverage and remove EXDEV test Yang Xu
2019-07-10 13:57                     ` [LTP] [PATCH v4 1/3] lib: alter find_free_loopdev() Cyril Hrubis
2019-07-11  4:00                       ` Yang Xu
2019-07-11 12:51                         ` Cyril Hrubis
2019-07-12  5:25                           ` Yang Xu
2019-07-17  5:29                             ` Yang Xu
2019-07-17  6:10                             ` Amir Goldstein
2019-07-17  9:44                           ` [LTP] [PATCH v5 " Yang Xu
2019-07-17  9:44                             ` [LTP] [PATCH v5 2/3] syscalls/copy_file_range01: add cross-device test Yang Xu
2019-07-29 13:56                               ` Petr Vorel
2019-07-29 13:59                                 ` Petr Vorel
2019-07-17  9:44                             ` [LTP] [PATCH v5 3/3] syscalls/copy_file_range02: increase coverage and remove EXDEV test Yang Xu
2019-07-17 10:14                             ` [LTP] [PATCH v5 1/3] lib: alter find_free_loopdev() Amir Goldstein
2019-07-17 10:34                               ` Yang Xu
2019-07-17 10:54                                 ` Cyril Hrubis
2019-07-18  7:30                                   ` Yang Xu
2019-07-25  5:01                                     ` [LTP] [PATCH v6 " Yang Xu
2019-07-25  5:01                                       ` [LTP] [PATCH v6 2/3] syscalls/copy_file_range01: add cross-device test Yang Xu
2019-07-29 14:00                                         ` Petr Vorel
2019-07-29 14:10                                           ` Petr Vorel
2019-07-30  8:31                                             ` Yang Xu
2019-07-30 13:35                                               ` Petr Vorel
2019-07-31  7:01                                                 ` Yang Xu
2019-07-31  7:47                                                   ` Petr Vorel
2019-07-25  5:01                                       ` [LTP] [PATCH v6 3/3] syscalls/copy_file_range02: increase coverage and remove EXDEV test Yang Xu
2019-07-25  5:24                                         ` Amir Goldstein
2019-07-25  5:44                                           ` Yang Xu
2019-07-25  8:08                                             ` Amir Goldstein
2019-07-25 10:13                                               ` Yang Xu
2019-07-25 11:02                                                 ` Amir Goldstein
2019-07-30 13:26                                         ` Petr Vorel
2019-07-31  7:09                                           ` Yang Xu
2019-07-29 13:01                                       ` [LTP] [PATCH v6 1/3] lib: alter find_free_loopdev() Cyril Hrubis
2019-07-30 10:42                                         ` Yang Xu
2019-07-30 11:05                                           ` Cyril Hrubis
2019-07-31 10:40                                             ` [LTP] [PATCH v7 " Yang Xu
2019-07-31 10:40                                               ` [LTP] [PATCH v7 2/3] syscalls/copy_file_range01: add cross-device test Yang Xu
2019-07-31 12:28                                                 ` Petr Vorel
2019-07-31 10:40                                               ` [LTP] [PATCH v7 3/3] syscalls/copy_file_range02: increase coverage and remove EXDEV test Yang Xu
2019-07-31 12:28                                                 ` Petr Vorel
2019-08-05  6:58                                                 ` Murphy Zhou
2019-08-05  7:11                                                   ` Yang Xu
2019-08-05 10:22                                                     ` Murphy Zhou
2019-08-05 11:01                                                       ` Yang Xu
2019-08-06  6:37                                                         ` Yang Xu
2019-08-06  9:29                                                           ` Murphy Zhou
2019-08-06 16:27                                                       ` Petr Vorel
2019-08-07 10:17                                                         ` Murphy Zhou
2019-08-07 12:12                                                           ` Dave Chinner
2019-08-08  3:46                                                             ` Murphy Zhou
2019-08-08  3:11                                                           ` Yang Xu [this message]
2019-08-08  3:57                                                             ` Murphy Zhou
2019-08-27 10:04                                                               ` Petr Vorel
2019-07-31 12:05                                               ` [LTP] [PATCH v7 1/3] lib: alter find_free_loopdev() Petr Vorel
2019-07-31 12:28                                                 ` Cyril Hrubis
2019-07-31 12:48                                                   ` Petr Vorel
2019-07-31 13:25                                                     ` Cyril Hrubis
2019-07-31 21:06                                                       ` Petr Vorel
2019-07-31 12:07                                               ` Petr Vorel
2019-07-10  7:47             ` [LTP] [PATCH v3 " Amir Goldstein
2019-07-10  7:32           ` [LTP] [PATCH v2] syscalls/copy_file_range02: increase coverage and remove EXDEV test Yang Xu
2019-07-08 10:38   ` [LTP] [PATCH] " Yang Xu

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=5D4B92EF.4090800@cn.fujitsu.com \
    --to=xuyang2018.jy@cn.fujitsu.com \
    --cc=ltp@lists.linux.it \
    /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