From patchwork Fri Oct 25 01:59:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xu X-Patchwork-Id: 1183719 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cn.fujitsu.com Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46znPc6RfSz9sP3 for ; Fri, 25 Oct 2019 13:00:20 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 7FE623C235F for ; Fri, 25 Oct 2019 04:00:16 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) by picard.linux.it (Postfix) with ESMTP id A807E3C185E for ; Fri, 25 Oct 2019 04:00:12 +0200 (CEST) Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by in-5.smtp.seeweb.it (Postfix) with ESMTP id 0E7EB600903 for ; Fri, 25 Oct 2019 04:00:10 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.68,226,1569254400"; d="scan'208";a="77448622" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 25 Oct 2019 10:00:08 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 064E14CE164C; Fri, 25 Oct 2019 09:52:13 +0800 (CST) Received: from localhost.localdomain (10.167.220.84) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 25 Oct 2019 10:00:09 +0800 From: Yang Xu To: , Date: Fri, 25 Oct 2019 09:59:40 +0800 Message-ID: <1571968780-4810-1-git-send-email-xuyang2018.jy@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-yoursite-MailScanner-ID: 064E14CE164C.AC9D1 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: xuyang2018.jy@cn.fujitsu.com X-Spam-Status: No, score=0.4 required=7.0 tests=KHOP_HELO_FCRDNS, SPF_HELO_NONE, SPF_NONE autolearn=disabled version=3.4.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH] syscalls/copy_file_range02: skip new error tests if cross-fs isn't supported X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ltp@lists.linux.it Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "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 Reviewed-by: Petr Vorel Tested-by: Petr Vorel --- .../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);