All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/3] tst_test: Handle device mkfs/mount int the library
@ 2017-02-14 15:26 Cyril Hrubis
  2017-02-14 15:26 ` [LTP] [PATCH 2/3] syscalls: Make use of format_device/mount_device flags Cyril Hrubis
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Cyril Hrubis @ 2017-02-14 15:26 UTC (permalink / raw)
  To: ltp

This commit adds functionality to format and then mount the test device
to the test library which:

* Saves a few setup steps in most of the testcases that use test device

* The device is umounted in the test library process now -> it will be
  umounted even if the test process has segfaulted.

+ docs

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 doc/test-writing-guidelines.txt | 14 ++++++++++++--
 include/tst_test.h              | 18 +++++++++++++++++-
 lib/newlib_tests/tst_device.c   |  4 ++--
 lib/tst_test.c                  | 39 +++++++++++++++++++++++++++++++++++++--
 4 files changed, 68 insertions(+), 7 deletions(-)

diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt
index a33efb1..4256427 100644
--- a/doc/test-writing-guidelines.txt
+++ b/doc/test-writing-guidelines.txt
@@ -911,8 +911,18 @@ structure is initialized with a path to a test device and default filesystem
 to be used.
 
 You can also request minimal device size in megabytes by setting
-'.device_min_size' in the 'struct tst_test' structure. The device is
-guaranteed to have at least the requested size then.
+'.dev_min_size' the device is guaranteed to have at least the requested size
+then.
+
+If '.format_device' flag is set the device is formatted with a filesystem as
+well. You can use '.dev_fs_type' to override the default filesystem type if
+needed and pass additional options to mkfs via '.dev_fs_opts' and
+'.dev_extra_opt' pointers.
+
+If '.mount_device' is set, the device is mounted at '.mntpoint' which is used
+to pass a directory name that will be created and used as mount destination.
+You can pass additional flags and data to the mount command via '.mnt_flags'
+and '.mnt_data' pointers.
 
 [source,c]
 -------------------------------------------------------------------------------
diff --git a/include/tst_test.h b/include/tst_test.h
index 1ed39db..b196a7d 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -117,8 +117,24 @@ struct tst_test {
 	int forks_child:1;
 	int needs_device:1;
 	int needs_checkpoints:1;
+	int format_device:1;
+	int mount_device:1;
 
-	unsigned int device_min_size;
+	/* Minimal device size in bytes */
+	unsigned int dev_min_size;
+
+	/* Device filesystem type override NULL == default */
+	const char *dev_fs_type;
+
+	/* Options passed to SAFE_MKFS() when format_device is set */
+	struct tst_dev_opts *dev_opts;
+	const char *const *dev_fs_opts;
+	const char *dev_extra_opt;
+
+	/* Device mount options, used if mount_device is set */
+	const char *mntpoint;
+	unsigned int mnt_flags;
+	void *mnt_data;
 
 	/* override default timeout per test run */
 	unsigned int timeout;
diff --git a/lib/newlib_tests/tst_device.c b/lib/newlib_tests/tst_device.c
index 72c2033..9bcdce1 100644
--- a/lib/newlib_tests/tst_device.c
+++ b/lib/newlib_tests/tst_device.c
@@ -37,7 +37,7 @@ static void do_test(void)
 	SAFE_IOCTL(fd, BLKGETSIZE64, &ltp_dev_size);
 	SAFE_CLOSE(fd);
 
-	if (ltp_dev_size/1024/1024 == 160)
+	if (ltp_dev_size/1024/1024 == 300)
 		tst_res(TPASS, "Got expected device size");
 	else
 		tst_res(TFAIL, "Got unexpected device size");
@@ -47,6 +47,6 @@ static struct tst_test test = {
 	.tid = "tst_device",
 	.needs_tmpdir = 1,
 	.needs_device = 1,
-	.device_min_size = 160,
+	.dev_min_size = 300,
 	.test_all = do_test,
 };
diff --git a/lib/tst_test.c b/lib/tst_test.c
index f19f763..f87d9a9 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -40,6 +40,7 @@ struct tst_test *tst_test;
 static int iterations = 1;
 static float duration = -1;
 static pid_t main_pid, lib_pid;
+static int device_mounted;
 
 struct results {
 	int passed;
@@ -644,6 +645,14 @@ static void do_setup(int argc, char *argv[])
 	if (tst_test->min_kver)
 		check_kver();
 
+	if (tst_test->format_device)
+		tst_test->needs_device = 1;
+
+	if (tst_test->mount_device) {
+		tst_test->needs_device = 1;
+		tst_test->format_device = 1;
+	}
+
 	parse_opts(argc, argv);
 
 	setup_ipc();
@@ -652,13 +661,36 @@ static void do_setup(int argc, char *argv[])
 		tst_tmpdir();
 
 	if (tst_test->needs_device) {
-		tdev.dev = tst_acquire_device_(NULL, tst_test->device_min_size);
-		tdev.fs_type = tst_dev_fs_type();
+		tdev.dev = tst_acquire_device_(NULL, tst_test->dev_min_size);
 
 		if (!tdev.dev)
 			tst_brk(TCONF, "Failed to acquire device");
 
 		tst_device = &tdev;
+
+		if (tst_test->dev_fs_type)
+			tdev.fs_type = tst_test->dev_fs_type;
+		else
+			tdev.fs_type = tst_dev_fs_type();
+
+		if (tst_test->format_device) {
+			SAFE_MKFS(tdev.dev, tdev.fs_type,
+			          tst_test->dev_fs_opts,
+				  tst_test->dev_extra_opt);
+		}
+
+		if (tst_test->mount_device) {
+
+			if (!tst_test->mntpoint) {
+				tst_brk(TBROK,
+					"tst_test->mntpoint must be set!");
+			}
+
+			SAFE_MKDIR(tst_test->mntpoint, 0777);
+			SAFE_MOUNT(tdev.dev, tst_test->mntpoint, tdev.fs_type,
+				   tst_test->mnt_flags, tst_test->mnt_data);
+			device_mounted = 1;
+		}
 	}
 
 	if (tst_test->resource_files)
@@ -678,6 +710,9 @@ static void do_test_setup(void)
 
 static void do_cleanup(void)
 {
+	if (device_mounted)
+		tst_umount(tst_test->mntpoint);
+
 	if (tst_test->needs_device && tdev.dev)
 		tst_release_device(tdev.dev);
 
-- 
2.10.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [LTP] [PATCH 2/3] syscalls: Make use of format_device/mount_device flags
  2017-02-14 15:26 [LTP] [PATCH 1/3] tst_test: Handle device mkfs/mount int the library Cyril Hrubis
@ 2017-02-14 15:26 ` Cyril Hrubis
  2017-02-14 15:26 ` [LTP] [PATCH 3/3] ioctl04: Add BLKROSET/BLKROGET test Cyril Hrubis
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2017-02-14 15:26 UTC (permalink / raw)
  To: ltp

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/syscalls/access/access04.c     | 18 +++---------------
 testcases/kernel/syscalls/creat/creat06.c       | 20 +++-----------------
 testcases/kernel/syscalls/quotactl/quotactl01.c | 19 ++++---------------
 testcases/kernel/syscalls/quotactl/quotactl02.c | 20 ++++----------------
 testcases/kernel/syscalls/umount/umount01.c     |  4 +---
 testcases/kernel/syscalls/umount/umount02.c     |  3 +--
 testcases/kernel/syscalls/umount/umount03.c     |  3 +--
 7 files changed, 17 insertions(+), 70 deletions(-)

diff --git a/testcases/kernel/syscalls/access/access04.c b/testcases/kernel/syscalls/access/access04.c
index f43c38c..820aab6 100644
--- a/testcases/kernel/syscalls/access/access04.c
+++ b/testcases/kernel/syscalls/access/access04.c
@@ -54,7 +54,6 @@
 
 static uid_t uid;
 static char longpathname[PATH_MAX + 2];
-int mount_flag;
 
 static struct tcase {
 	const char *pathname;
@@ -119,18 +118,6 @@ static void setup(void)
 
 	SAFE_SYMLINK(SNAME1, SNAME2);
 	SAFE_SYMLINK(SNAME2, SNAME1);
-
-	SAFE_MKFS(tst_device->dev, tst_device->fs_type, NULL, NULL);
-	SAFE_MKDIR(MNT_POINT, 0755);
-	SAFE_MOUNT(tst_device->dev, MNT_POINT, tst_device->fs_type,
-		MS_RDONLY, NULL);
-	mount_flag = 1;
-}
-
-static void cleanup(void)
-{
-	if (mount_flag)
-		tst_umount(MNT_POINT);
 }
 
 static struct tst_test test = {
@@ -138,9 +125,10 @@ static struct tst_test test = {
 	.tcnt = ARRAY_SIZE(tcases),
 	.needs_tmpdir = 1,
 	.needs_root = 1,
-	.needs_device = 1,
 	.forks_child = 1,
+	.mount_device = 1,
+	.mntpoint = MNT_POINT,
+	.mnt_flags = MS_RDONLY,
 	.setup = setup,
-	.cleanup = cleanup,
 	.test = verify_access,
 };
diff --git a/testcases/kernel/syscalls/creat/creat06.c b/testcases/kernel/syscalls/creat/creat06.c
index 73913cd..db0850a 100644
--- a/testcases/kernel/syscalls/creat/creat06.c
+++ b/testcases/kernel/syscalls/creat/creat06.c
@@ -71,7 +71,6 @@
 #define	MODE2		0666
 
 static void setup(void);
-static void cleanup(void);
 static void test6_setup(void);
 static void test6_cleanup(void);
 #if !defined(UCLINUX)
@@ -80,7 +79,6 @@ static void bad_addr_setup(int);
 
 static struct passwd *ltpuser;
 static char long_name[PATH_MAX+2];
-static int mount_flag;
 
 static struct test_case_t {
 	char *fname;
@@ -140,13 +138,6 @@ static void setup(void)
 
 	SAFE_SYMLINK(TEST7_FILE, "test_file_eloop2");
 	SAFE_SYMLINK("test_file_eloop2", TEST7_FILE);
-
-	SAFE_MKFS(tst_device->dev, tst_device->fs_type, NULL, NULL);
-
-	SAFE_MKDIR("mntpoint", 0777);
-	SAFE_MOUNT(tst_device->dev, "mntpoint", tst_device->fs_type,
-	           MS_RDONLY, NULL);
-	mount_flag = 1;
 }
 
 #if !defined(UCLINUX)
@@ -170,19 +161,14 @@ static void test6_cleanup(void)
 	SAFE_SETEUID(0);
 }
 
-static void cleanup(void)
-{
-	if (mount_flag)
-		tst_umount("mntpoint");
-}
-
 static struct tst_test test = {
 	.tid = "creat06",
 	.tcnt = ARRAY_SIZE(tcases),
 	.test = verify_creat,
 	.needs_root = 1,
 	.needs_tmpdir = 1,
-	.needs_device = 1,
-	.cleanup = cleanup,
+	.mount_device = 1,
+	.mntpoint = "mntpoint",
+	.mnt_flags = MS_RDONLY,
 	.setup = setup,
 };
diff --git a/testcases/kernel/syscalls/quotactl/quotactl01.c b/testcases/kernel/syscalls/quotactl/quotactl01.c
index e6baa2e..a994e95 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl01.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl01.c
@@ -78,7 +78,6 @@
 
 # define MNTPOINT	"mntpoint"
 
-static int mount_flag;
 static int32_t fmt_id = FMTID;
 static int test_id;
 static struct dqblk set_dq = {
@@ -163,12 +162,6 @@ static void setup(void)
 	const char *const cmd[] = {"quotacheck", "-ug", MNTPOINT, NULL};
 	int ret;
 
-	SAFE_MKDIR(MNTPOINT, 0755);
-
-	SAFE_MKFS(tst_device->dev, "ext4", NULL, NULL);
-
-	SAFE_MOUNT(tst_device->dev, MNTPOINT, "ext4", 0, "usrquota,grpquota");
-	mount_flag = 1;
 
 	ret = tst_run_cmd(cmd, NULL, NULL, 1);
 	switch (ret) {
@@ -189,12 +182,6 @@ static void setup(void)
 		tst_brk(TFAIL | TERRNO, "group quotafile didn't exist");
 }
 
-static void cleanup(void)
-{
-	if (mount_flag && tst_umount(MNTPOINT) < 0)
-		tst_res(TWARN | TERRNO, "umount(2) failed");
-}
-
 static void verify_quota(unsigned int n)
 {
 	struct tcase *tc = &tcases[n];
@@ -225,9 +212,11 @@ static struct tst_test test = {
 	.needs_root = 1,
 	.test = verify_quota,
 	.tcnt = ARRAY_SIZE(tcases),
-	.needs_device = 1,
+	.mount_device = 1,
+	.dev_fs_type = "ext4",
+	.mntpoint = MNTPOINT,
+	.mnt_data = "usrquota,grpquota",
 	.setup = setup,
-	.cleanup = cleanup
 };
 
 #else
diff --git a/testcases/kernel/syscalls/quotactl/quotactl02.c b/testcases/kernel/syscalls/quotactl/quotactl02.c
index d3bd946..f7ae78b 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl02.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl02.c
@@ -47,7 +47,6 @@ static void check_qon(char *);
 static void check_qlim(char *);
 
 static int test_id;
-static int mount_flag;
 static struct fs_disk_quota set_dquota = {
 	.d_rtb_softlimit = 1000,
 	.d_fieldmask = FS_DQ_RTBSOFT
@@ -138,22 +137,9 @@ static void check_qlim(char *desp)
 
 static void setup(void)
 {
-	SAFE_MKDIR(mntpoint, 0755);
-
-	SAFE_MKFS(tst_device->dev, "xfs", NULL, NULL);
-
-	SAFE_MOUNT(tst_device->dev, mntpoint, "xfs", 0, "usrquota");
-	mount_flag = 1;
-
 	test_id = geteuid();
 }
 
-static void cleanup(void)
-{
-	if (mount_flag && tst_umount(mntpoint) < 0)
-		tst_res(TWARN | TERRNO, "umount() failed");
-}
-
 static void verify_quota(unsigned int n)
 {
 	struct t_case *tc = &tcases[n];
@@ -173,9 +159,11 @@ static struct tst_test test = {
 	.needs_root = 1,
 	.test = verify_quota,
 	.tcnt = ARRAY_SIZE(tcases),
-	.needs_device = 1,
+	.mount_device = 1,
+	.dev_fs_type = "xfs",
+	.mntpoint = mntpoint,
+	.mnt_data = "usrquota",
 	.setup = setup,
-	.cleanup = cleanup
 };
 #else
 	TST_TEST_TCONF("This system didn't support quota or xfs quota");
diff --git a/testcases/kernel/syscalls/umount/umount01.c b/testcases/kernel/syscalls/umount/umount01.c
index a8da4f4..3b5aeb9 100644
--- a/testcases/kernel/syscalls/umount/umount01.c
+++ b/testcases/kernel/syscalls/umount/umount01.c
@@ -55,8 +55,6 @@ static void verify_umount(void)
 
 static void setup(void)
 {
-	SAFE_MKFS(tst_device->dev, tst_device->fs_type, NULL, NULL);
-
 	SAFE_MKDIR(MNTPOINT, 0775);
 }
 
@@ -70,7 +68,7 @@ static struct tst_test test = {
 	.tid = "umount01",
 	.needs_root = 1,
 	.needs_tmpdir = 1,
-	.needs_device = 1,
+	.format_device = 1,
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = verify_umount,
diff --git a/testcases/kernel/syscalls/umount/umount02.c b/testcases/kernel/syscalls/umount/umount02.c
index ecfad1b..690ba5f 100644
--- a/testcases/kernel/syscalls/umount/umount02.c
+++ b/testcases/kernel/syscalls/umount/umount02.c
@@ -76,7 +76,6 @@ static void setup(void)
 {
 	memset(long_path, 'a', PATH_MAX + 1);
 
-	SAFE_MKFS(tst_device->dev, tst_device->fs_type, NULL, NULL);
 	SAFE_MKDIR(MNTPOINT, 0775);
 	SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL);
 	mount_flag = 1;
@@ -98,7 +97,7 @@ static struct tst_test test = {
 	.tcnt = ARRAY_SIZE(tcases),
 	.needs_root = 1,
 	.needs_tmpdir = 1,
-	.needs_device = 1,
+	.format_device = 1,
 	.setup = setup,
 	.cleanup = cleanup,
 	.test = verify_umount,
diff --git a/testcases/kernel/syscalls/umount/umount03.c b/testcases/kernel/syscalls/umount/umount03.c
index 4b13240..c1bcb05 100644
--- a/testcases/kernel/syscalls/umount/umount03.c
+++ b/testcases/kernel/syscalls/umount/umount03.c
@@ -52,7 +52,6 @@ static void setup(void)
 {
 	struct passwd *pw;
 
-	SAFE_MKFS(tst_device->dev, tst_device->fs_type, NULL, NULL);
 	SAFE_MKDIR(MNTPOINT, 0775);
 	SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL);
 	mount_flag = 1;
@@ -74,7 +73,7 @@ static struct tst_test test = {
 	.tid = "umount03",
 	.needs_root = 1,
 	.needs_tmpdir = 1,
-	.needs_device = 1,
+	.format_device = 1,
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = verify_umount,
-- 
2.10.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [LTP] [PATCH 3/3] ioctl04: Add BLKROSET/BLKROGET test.
  2017-02-14 15:26 [LTP] [PATCH 1/3] tst_test: Handle device mkfs/mount int the library Cyril Hrubis
  2017-02-14 15:26 ` [LTP] [PATCH 2/3] syscalls: Make use of format_device/mount_device flags Cyril Hrubis
@ 2017-02-14 15:26 ` Cyril Hrubis
  2017-02-14 15:28 ` [LTP] [PATCH 1/3] tst_test: Handle device mkfs/mount int the library Cyril Hrubis
  2017-02-21 11:27 ` Jan Stancek
  3 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2017-02-14 15:26 UTC (permalink / raw)
  To: ltp

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 runtest/syscalls                          |   1 +
 testcases/kernel/syscalls/.gitignore      |   1 +
 testcases/kernel/syscalls/ioctl/ioctl04.c | 104 ++++++++++++++++++++++++++++++
 3 files changed, 106 insertions(+)
 create mode 100644 testcases/kernel/syscalls/ioctl/ioctl04.c

diff --git a/runtest/syscalls b/runtest/syscalls
index dc03c4c..1ef6161 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -452,6 +452,7 @@ getxattr03 getxattr03
 # Introducing ioctl tests for all /dev/tty* devices
 ioctl01_02   test_ioctl
 ioctl03      ioctl03
+ioctl04      ioctl04
 
 inotify_init1_01 inotify_init1_01
 inotify_init1_02 inotify_init1_02
diff --git a/testcases/kernel/syscalls/.gitignore b/testcases/kernel/syscalls/.gitignore
index 91dccef..4c645f6 100644
--- a/testcases/kernel/syscalls/.gitignore
+++ b/testcases/kernel/syscalls/.gitignore
@@ -384,6 +384,7 @@
 /ioctl/ioctl01
 /ioctl/ioctl02
 /ioctl/ioctl03
+/ioctl/ioctl04
 /ioperm/ioperm01
 /ioperm/ioperm02
 /iopl/iopl01
diff --git a/testcases/kernel/syscalls/ioctl/ioctl04.c b/testcases/kernel/syscalls/ioctl/ioctl04.c
new file mode 100644
index 0000000..d3de368
--- /dev/null
+++ b/testcases/kernel/syscalls/ioctl/ioctl04.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+/*
+ * Basic test for the BLKROSET and BLKROGET ioctls.
+ *
+ * - Set the device read only, read the value back.
+ * - Try to mount the device read write, expect failure.
+ * - Try to mount the device read only, expect success.
+ */
+
+#include <errno.h>
+#include <sys/mount.h>
+#include <linux/fs.h>
+#include "tst_test.h"
+
+static int fd;
+
+static void verify_ioctl(void)
+{
+	int ro = 1;
+
+	SAFE_IOCTL(fd, BLKROGET, &ro);
+
+	if (ro == 0)
+		tst_res(TPASS, "BLKROGET returned 0");
+	else
+		tst_res(TFAIL, "BLKROGET returned %i", ro);
+
+	ro = 1;
+	SAFE_IOCTL(fd, BLKROSET, &ro);
+
+	ro = 0;
+	SAFE_IOCTL(fd, BLKROGET, &ro);
+
+	if (ro == 0)
+		tst_res(TFAIL, "BLKROGET returned 0");
+	else
+		tst_res(TPASS, "BLKROGET returned %i", ro);
+
+	TEST(mount(tst_device->dev, "mntpoint", tst_device->fs_type, 0, NULL));
+
+	if (TEST_RETURN != -1) {
+		tst_res(TFAIL, "Mounting RO device RW succeeded");
+		tst_umount("mntpoint");
+		goto next;
+	}
+
+	if (TEST_ERRNO == EACCES) {
+		tst_res(TPASS | TERRNO, "Mounting RO device RW failed");
+		goto next;
+	}
+
+	tst_res(TFAIL | TERRNO,
+		"Mounting RO device RW failed unexpectedly expected EACCES");
+
+next:
+	TEST(mount(tst_device->dev, "mntpoint", tst_device->fs_type, MS_RDONLY, NULL));
+
+	if (TEST_RETURN == 0) {
+		tst_res(TPASS, "Mounting RO device RO works");
+		tst_umount("mntpoint");
+	} else {
+		tst_res(TFAIL | TTERRNO, "Mounting RO device RO failed");
+	}
+
+	ro = 0;
+	SAFE_IOCTL(fd, BLKROSET, &ro);
+}
+
+static void setup(void)
+{
+	SAFE_MKDIR("mntpoint", 0777);
+	fd = SAFE_OPEN(tst_device->dev, O_RDONLY);
+}
+
+static void cleanup(void)
+{
+	if (fd > 0)
+		SAFE_CLOSE(fd);
+}
+
+static struct tst_test test = {
+	.tid = "ioctl04",
+	.needs_tmpdir = 1,
+	.needs_device = 1,
+	.format_device = 1,
+	.setup = setup,
+	.cleanup = cleanup,
+	.test_all = verify_ioctl,
+};
-- 
2.10.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [LTP] [PATCH 1/3] tst_test: Handle device mkfs/mount int the library
  2017-02-14 15:26 [LTP] [PATCH 1/3] tst_test: Handle device mkfs/mount int the library Cyril Hrubis
  2017-02-14 15:26 ` [LTP] [PATCH 2/3] syscalls: Make use of format_device/mount_device flags Cyril Hrubis
  2017-02-14 15:26 ` [LTP] [PATCH 3/3] ioctl04: Add BLKROSET/BLKROGET test Cyril Hrubis
@ 2017-02-14 15:28 ` Cyril Hrubis
  2017-02-21 11:27 ` Jan Stancek
  3 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2017-02-14 15:28 UTC (permalink / raw)
  To: ltp

Hi!
> +	/* Minimal device size in bytes */
                                  ^
				  This should be megabytes
				  I will fix it in my tree
> +	unsigned int dev_min_size;
> +
> +	/* Device filesystem type override NULL == default */
> +	const char *dev_fs_type;
> +
> +	/* Options passed to SAFE_MKFS() when format_device is set */
> +	struct tst_dev_opts *dev_opts;
> +	const char *const *dev_fs_opts;
> +	const char *dev_extra_opt;
> +
> +	/* Device mount options, used if mount_device is set */
> +	const char *mntpoint;
> +	unsigned int mnt_flags;
> +	void *mnt_data;

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] [PATCH 1/3] tst_test: Handle device mkfs/mount int the library
  2017-02-14 15:26 [LTP] [PATCH 1/3] tst_test: Handle device mkfs/mount int the library Cyril Hrubis
                   ` (2 preceding siblings ...)
  2017-02-14 15:28 ` [LTP] [PATCH 1/3] tst_test: Handle device mkfs/mount int the library Cyril Hrubis
@ 2017-02-21 11:27 ` Jan Stancek
  2017-03-01 13:59   ` Cyril Hrubis
  3 siblings, 1 reply; 6+ messages in thread
From: Jan Stancek @ 2017-02-21 11:27 UTC (permalink / raw)
  To: ltp





----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: ltp@lists.linux.it
> Sent: Tuesday, 14 February, 2017 4:26:37 PM
> Subject: [LTP] [PATCH 1/3] tst_test: Handle device mkfs/mount int the library
> 
> This commit adds functionality to format and then mount the test device
> to the test library which:
> 
> * Saves a few setup steps in most of the testcases that use test device
> 
> * The device is umounted in the test library process now -> it will be
>   umounted even if the test process has segfaulted.
> 
> + docs
> 
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>

Series looks good to me. One issue I ran into is that
quotactl01 fails on RHEL5.6/6.0, but that doesn't seem
to be related to your patch:

# ./quotactl01 
tst_device.c:120: INFO: Found free device '/dev/loop0'
tst_mkfs.c:79: INFO: Formatting /dev/loop0 with ext4 opts='' extra opts=''
mke2fs 1.41.12 (17-May-2010)
tst_test.c:847: INFO: Timeout per run is 0h 05m 00s
quotacheck: Mountpoint (or device) /tmp/quoyk2cuB/mntpoint not found or has no quota enabled.
quotacheck: Cannot find filesystem to check or filesystem not mounted with quota option.
quotactl01.c:179: FAIL: user quotafile didn't exist: ENOENT

RHEL6.0 man-page says:
ext2
       grpquota|noquota|quota|usrquota
              These options are accepted but ignored.
ext4
       quota, noquota, grpquota, usrquota and
       [no]bh are backwardly compatible with ext3 or ext2.

Regards,
Jan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] [PATCH 1/3] tst_test: Handle device mkfs/mount int the library
  2017-02-21 11:27 ` Jan Stancek
@ 2017-03-01 13:59   ` Cyril Hrubis
  0 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2017-03-01 13:59 UTC (permalink / raw)
  To: ltp

Hi!
> Series looks good to me.

Pushed with two more fcntl() tests.

> One issue I ran into is that
> quotactl01 fails on RHEL5.6/6.0, but that doesn't seem
> to be related to your patch:
> 
> # ./quotactl01 
> tst_device.c:120: INFO: Found free device '/dev/loop0'
> tst_mkfs.c:79: INFO: Formatting /dev/loop0 with ext4 opts='' extra opts=''
> mke2fs 1.41.12 (17-May-2010)
> tst_test.c:847: INFO: Timeout per run is 0h 05m 00s
> quotacheck: Mountpoint (or device) /tmp/quoyk2cuB/mntpoint not found or has no quota enabled.
> quotacheck: Cannot find filesystem to check or filesystem not mounted with quota option.
> quotactl01.c:179: FAIL: user quotafile didn't exist: ENOENT

Strange, that looks like the options are accepted but ignored for ext4
as well.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-03-01 13:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-14 15:26 [LTP] [PATCH 1/3] tst_test: Handle device mkfs/mount int the library Cyril Hrubis
2017-02-14 15:26 ` [LTP] [PATCH 2/3] syscalls: Make use of format_device/mount_device flags Cyril Hrubis
2017-02-14 15:26 ` [LTP] [PATCH 3/3] ioctl04: Add BLKROSET/BLKROGET test Cyril Hrubis
2017-02-14 15:28 ` [LTP] [PATCH 1/3] tst_test: Handle device mkfs/mount int the library Cyril Hrubis
2017-02-21 11:27 ` Jan Stancek
2017-03-01 13:59   ` Cyril Hrubis

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.