All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 4/4] syscalls/fsetxattr02.c: Fix the failure of opening device files
Date: Thu, 16 Aug 2018 16:45:47 +0800	[thread overview]
Message-ID: <1534409147-29519-4-git-send-email-yangx.jy@cn.fujitsu.com> (raw)
In-Reply-To: <1534409147-29519-1-git-send-email-yangx.jy@cn.fujitsu.com>

If temporary directory is on the mountpoint which is mounted with nodev
option(or it is mounted with with nodev option directly), open(2) has no
permission to open device files in the temporary directory and returns
EACCES.  as below:
--------------------------------------------------------------------
safe_macros.c:225: BROK: fsetxattr02.c:215: open(fsetxattr02chr,0,00) failed: EACCES
--------------------------------------------------------------------

We prepare a suitable filesystem to test device special files by setting
.needs_devfs flag.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 testcases/kernel/syscalls/fsetxattr/fsetxattr02.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/syscalls/fsetxattr/fsetxattr02.c b/testcases/kernel/syscalls/fsetxattr/fsetxattr02.c
index a1be652..0f769ce 100644
--- a/testcases/kernel/syscalls/fsetxattr/fsetxattr02.c
+++ b/testcases/kernel/syscalls/fsetxattr/fsetxattr02.c
@@ -48,13 +48,14 @@
 #define XATTR_TEST_VALUE "this is a test value"
 #define XATTR_TEST_VALUE_SIZE 20
 
+#define MNTPOINT "mntpoint"
 #define OFFSET    11
 #define FILENAME "fsetxattr02testfile"
 #define DIRNAME  "fsetxattr02testdir"
 #define SYMLINK  "fsetxattr02symlink"
-#define FIFO     "fsetxattr02fifo"
-#define CHR      "fsetxattr02chr"
-#define BLK      "fsetxattr02blk"
+#define FIFO     MNTPOINT"/fsetxattr02fifo"
+#define CHR      MNTPOINT"/fsetxattr02chr"
+#define BLK      MNTPOINT"/fsetxattr02blk"
 #define SOCK     "fsetxattr02sock"
 
 struct test_case {
@@ -139,6 +140,9 @@ static struct test_case tc[] = {
 
 static void verify_fsetxattr(unsigned int i)
 {
+	/* acquire basename to avoid breaking OFFSET logic */
+	tc[i].fname = strstr(tc[i].fname, "fsetxattr02");
+
 	/* some tests might require existing keys for each iteration */
 	if (tc[i].needskeyset) {
 		SAFE_FSETXATTR(tc[i].fd, tc[i].key, tc[i].value, tc[i].size,
@@ -247,7 +251,8 @@ static struct tst_test test = {
 	.test = verify_fsetxattr,
 	.cleanup = cleanup,
 	.tcnt = ARRAY_SIZE(tc),
-	.needs_tmpdir = 1,
+	.needs_devfs = 1,
+	.mntpoint = MNTPOINT,
 	.needs_root = 1,
 };
 
-- 
1.8.3.1




      parent reply	other threads:[~2018-08-16  8:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-04  8:00 [LTP] [PATCH] syscalls/open11.c: Fix the failure of opening device special file Xiao Yang
2018-07-23  1:42 ` Xiao Yang
2018-08-15 11:42 ` Cyril Hrubis
2018-08-16  8:45   ` [LTP] [PATCH v2 1/4] lib/tst_path_has_mnt_flags.c: Factor out tst_path_has_mnt_flags() for new API Xiao Yang
2018-08-16  8:45     ` [LTP] [PATCH v2 2/4] lib/tst_test.c: add .needs_devfs flag Xiao Yang
2018-08-16 13:28       ` Cyril Hrubis
2018-08-17  4:26         ` Xiao Yang
2018-08-17  4:33         ` [LTP] [PATCH v3 2/2] lib/tst_test.c: Add " Xiao Yang
2018-08-30 14:49           ` Cyril Hrubis
2018-08-31  2:58             ` Xiao Yang
2018-09-01  4:07             ` [LTP] [PATCH v4 " Xiao Yang
2018-08-31 12:31               ` Cyril Hrubis
2018-09-03  2:14                 ` Xiao Yang
2018-09-03 13:01                   ` Cyril Hrubis
2018-08-16  8:45     ` [LTP] [PATCH v2 3/4] syscalls/open11.c: Fix the failure of opening device special files Xiao Yang
2018-08-16  8:45     ` Xiao Yang [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=1534409147-29519-4-git-send-email-yangx.jy@cn.fujitsu.com \
    --to=yangx.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 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.