All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/6] tst_test: Allow priting TINFO without initialized IPC
@ 2017-02-08 11:02 Cyril Hrubis
  2017-02-08 11:02 ` [LTP] [PATCH 2/6] tst_device: Split the tst_acquire_device code again Cyril Hrubis
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Cyril Hrubis @ 2017-02-08 11:02 UTC (permalink / raw)
  To: ltp

If we try to print TINFO messages while the shared memory to store
results is not initialized we stop the test execution with TBROK.

But we do not store anything on TINFO hence it does not make much sense
to exit at this point.

The motivation for this change is that test library code that prints
messages with TINFO (tst_device.c for instance) cannot be used without
doing full test initialization, which is unfortunate since I wanted to
reuse the code to create a helper binary for shell testcases.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 lib/tst_test.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/tst_test.c b/lib/tst_test.c
index e78b412..b8d10ee 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -146,6 +146,9 @@ void tst_reinit(void)
 
 static void update_results(const char *file, unsigned int lineno, int ttype)
 {
+	if (ttype == TINFO)
+		return;
+
 	if (!results) {
 		tst_brk(TBROK,
 		        "%s: %d: Results IPC not initialized!", file, lineno);
-- 
2.10.2


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

* [LTP] [PATCH 2/6] tst_device: Split the tst_acquire_device code again
  2017-02-08 11:02 [LTP] [PATCH 1/6] tst_test: Allow priting TINFO without initialized IPC Cyril Hrubis
@ 2017-02-08 11:02 ` Cyril Hrubis
  2017-02-08 11:02 ` [LTP] [PATCH 3/6] lib: Add new tst_device for shell Cyril Hrubis
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2017-02-08 11:02 UTC (permalink / raw)
  To: ltp

This splits the tst_acquire_device code into two parts so that the
function with two underscores returns exit value rather than calling
tst_brkm() with a cleanup pointer.

Once this is done we can reuse the code in shell helper binary so that
we have all the device related code in a single place.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 include/old/old_device.h |   4 +-
 lib/tst_device.c         | 121 +++++++++++++++++++++++++++++++++--------------
 2 files changed, 88 insertions(+), 37 deletions(-)

diff --git a/include/old/old_device.h b/include/old/old_device.h
index aabc617..4dbb3ff 100644
--- a/include/old/old_device.h
+++ b/include/old/old_device.h
@@ -44,6 +44,8 @@ const char *tst_dev_fs_type(void);
  */
 const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size);
 
+const char *tst_acquire_device__(unsigned int size);
+
 static inline const char *tst_acquire_device(void (cleanup_fn)(void))
 {
 	return tst_acquire_device_(cleanup_fn, 0);
@@ -52,7 +54,7 @@ static inline const char *tst_acquire_device(void (cleanup_fn)(void))
 /*
  * @dev: device path returned by the tst_acquire_device()
  */
-void tst_release_device(const char *dev);
+int tst_release_device(const char *dev);
 
 /*
  * Just like umount() but retries several times on failure.
diff --git a/lib/tst_device.c b/lib/tst_device.c
index 3c62df0..24e8c6f 100644
--- a/lib/tst_device.c
+++ b/lib/tst_device.c
@@ -129,35 +129,44 @@ static int find_free_loopdev(void)
 	return 1;
 }
 
-static void attach_device(void (*cleanup_fn)(void),
-                          const char *dev, const char *file)
+static int attach_device(const char *dev, const char *file)
 {
-	int dev_fd, file_fd, err;
+	int dev_fd, file_fd;
 
-	dev_fd = SAFE_OPEN(cleanup_fn, dev, O_RDWR);
-	file_fd = SAFE_OPEN(cleanup_fn, file, O_RDWR);
+	dev_fd = open(dev, O_RDWR);
+	if (dev_fd < 0) {
+		tst_resm(TWARN | TERRNO, "open('%s', O_RDWR) failed", dev);
+		return 1;
+	}
+
+	file_fd = open(file, O_RDWR);
+	if (file_fd < 0) {
+		tst_resm(TWARN | TERRNO, "open('%s', O_RDWR) failed", file);
+		close(dev_fd);
+		return 1;
+	}
 
 	if (ioctl(dev_fd, LOOP_SET_FD, file_fd) < 0) {
-		err = errno;
 		close(dev_fd);
 		close(file_fd);
-		tst_brkm(TBROK, cleanup_fn,
-		         "ioctl(%s, LOOP_SET_FD, %s) failed: %s",
-			 dev, file, tst_strerrno(err));
+		tst_resm(TWARN | TERRNO, "ioctl(%s, LOOP_SET_FD, %s) failed",
+			 dev, file);
+		return 1;
 	}
 
 	close(dev_fd);
 	close(file_fd);
+	return 0;
 }
 
-static void detach_device(const char *dev)
+static int detach_device(const char *dev)
 {
 	int dev_fd, ret, i;
 
 	dev_fd = open(dev, O_RDONLY);
 	if (dev_fd < 0) {
 		tst_resm(TWARN | TERRNO, "open(%s) failed", dev);
-		return;
+		return 1;
 	}
 
 	/* keep trying to clear LOOPDEV until we get ENXIO, a quick succession
@@ -167,13 +176,15 @@ static void detach_device(const char *dev)
 
 		if (ret && (errno == ENXIO)) {
 			close(dev_fd);
-			return;
+			return 0;
 		}
 
 		if (ret && (errno != EBUSY)) {
 			tst_resm(TWARN,
 				 "ioctl(%s, LOOP_CLR_FD, 0) unexpectedly failed with: %s",
 				 dev, tst_strerrno(errno));
+			close(dev_fd);
+			return 1;
 		}
 
 		usleep(50000);
@@ -182,9 +193,10 @@ static void detach_device(const char *dev)
 	close(dev_fd);
 	tst_resm(TWARN,
 		"ioctl(%s, LOOP_CLR_FD, 0) no ENXIO for too long", dev);
+	return 1;
 }
 
-const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size)
+const char *tst_acquire_device__(unsigned int size)
 {
 	int fd;
 	char *dev;
@@ -194,35 +206,48 @@ const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size)
 
 	acq_dev_size = size > 150 ? size : 150;
 
-	if (device_acquired)
-		tst_brkm(TBROK, cleanup_fn, "Device allready acquired");
-
-	if (!tst_tmpdir_created()) {
-		tst_brkm(TBROK, cleanup_fn,
-		         "Cannot acquire device without tmpdir() created");
-	}
-
 	dev = getenv("LTP_DEV");
 
 	if (dev) {
 		tst_resm(TINFO, "Using test device LTP_DEV='%s'", dev);
 
-		SAFE_STAT(cleanup_fn, dev, &st);
+		if (stat(dev, &st)) {
+			tst_resm(TWARN | TERRNO, "stat() failed");
+			return NULL;
+		}
 
 		if (!S_ISBLK(st.st_mode)) {
-			tst_brkm(TBROK, cleanup_fn,
-			         "%s is not a block device", dev);
+			tst_resm(TWARN, "%s is not a block device", dev);
+			return NULL;
+		}
+
+		fd = open(dev, O_RDONLY);
+		if (fd < 0) {
+			tst_resm(TWARN | TERRNO,
+				 "open(%s, O_RDONLY) failed", dev);
+			return NULL;
+		}
+
+		if (ioctl(fd, BLKGETSIZE64, &ltp_dev_size)) {
+			tst_resm(TWARN | TERRNO,
+				 "ioctl(fd, BLKGETSIZE64, ...) failed");
+			close(fd);
+			return NULL;
+		}
+
+		if (close(fd)) {
+			tst_resm(TWARN | TERRNO,
+				 "close(fd) failed");
+			return NULL;
 		}
 
-		fd = SAFE_OPEN(cleanup_fn, dev, O_RDONLY);
-		SAFE_IOCTL(cleanup_fn, fd, BLKGETSIZE64, &ltp_dev_size);
-		SAFE_CLOSE(cleanup_fn, fd);
 		ltp_dev_size = ltp_dev_size/1024/1024;
 
 		if (acq_dev_size <= ltp_dev_size) {
 			if (tst_fill_file(dev, 0, 1024, 512)) {
-				tst_brkm(TBROK | TERRNO, cleanup_fn,
-					"Failed to clear the first 512k of %s", dev);
+				tst_resm(TWARN | TERRNO,
+					 "Failed to clear the first 512k of %s",
+					 dev);
 			}
 
 			return dev;
@@ -233,34 +258,58 @@ const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size)
 	}
 
 	if (tst_fill_file(DEV_FILE, 0, 1024, 1024 * acq_dev_size)) {
-		tst_brkm(TBROK | TERRNO, cleanup_fn,
-		         "Failed to create " DEV_FILE);
-
+		tst_resm(TWARN | TERRNO, "Failed to create " DEV_FILE);
+		return NULL;
 	}
 
 	if (find_free_loopdev())
 		return NULL;
 
-	attach_device(cleanup_fn, dev_path, DEV_FILE);
+	if (attach_device(dev_path, DEV_FILE))
+		return NULL;
 
 	device_acquired = 1;
 
 	return dev_path;
 }
 
-void tst_release_device(const char *dev)
+const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size)
+{
+	const char *device;
+
+	if (device_acquired)
+		tst_brkm(TBROK, cleanup_fn, "Device allready acquired");
+
+	if (!tst_tmpdir_created()) {
+		tst_brkm(TBROK, cleanup_fn,
+		         "Cannot acquire device without tmpdir() created");
+	}
+
+	device = tst_acquire_device__(size);
+
+	if (!device)
+		tst_brkm(TBROK, cleanup_fn, "Failed to acquire device");
+
+	return device;
+}
+
+int tst_release_device(const char *dev)
 {
+	int ret;
+
 	if (getenv("LTP_DEV"))
-		return;
+		return 0;
 
 	/*
 	 * Loop device was created -> we need to deatch it.
 	 *
 	 * The file image is deleted in tst_rmdir();
 	 */
-	detach_device(dev);
+	ret = detach_device(dev);
 
 	device_acquired = 0;
+
+	return ret;
 }
 
 int tst_umount(const char *path)
-- 
2.10.2


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

* [LTP] [PATCH 3/6] lib: Add new tst_device for shell
  2017-02-08 11:02 [LTP] [PATCH 1/6] tst_test: Allow priting TINFO without initialized IPC Cyril Hrubis
  2017-02-08 11:02 ` [LTP] [PATCH 2/6] tst_device: Split the tst_acquire_device code again Cyril Hrubis
@ 2017-02-08 11:02 ` Cyril Hrubis
  2017-02-08 11:02 ` [LTP] [PATCH 4/6] test.sh: Remove tst_{acquire, release}_device, tst_mkfs Cyril Hrubis
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2017-02-08 11:02 UTC (permalink / raw)
  To: ltp

The motivation is to have a single place where we handle device
creation/deletion.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/lib/.gitignore   |   1 +
 testcases/lib/Makefile     |   3 +-
 testcases/lib/tst_device.c | 106 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 109 insertions(+), 1 deletion(-)
 create mode 100644 testcases/lib/tst_device.c

diff --git a/testcases/lib/.gitignore b/testcases/lib/.gitignore
index 77acb57..920817c 100644
--- a/testcases/lib/.gitignore
+++ b/testcases/lib/.gitignore
@@ -3,3 +3,4 @@ tst_random
 tst_checkpoint
 tst_rod
 tst_kvcmp
+tst_device
diff --git a/testcases/lib/Makefile b/testcases/lib/Makefile
index 0bb0bce..6282578 100644
--- a/testcases/lib/Makefile
+++ b/testcases/lib/Makefile
@@ -26,6 +26,7 @@ include $(top_srcdir)/include/mk/testcases.mk
 
 INSTALL_TARGETS		:= *.sh
 
-MAKE_TARGETS		:= tst_sleep tst_random tst_checkpoint tst_rod tst_kvcmp
+MAKE_TARGETS		:= tst_sleep tst_random tst_checkpoint tst_rod tst_kvcmp\
+			   tst_device
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/lib/tst_device.c b/testcases/lib/tst_device.c
new file mode 100644
index 0000000..d33cac6
--- /dev/null
+++ b/testcases/lib/tst_device.c
@@ -0,0 +1,106 @@
+/*
+ * 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 would 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, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#define TST_NO_DEFAULT_MAIN
+#include "tst_test.h"
+#include "old/old_device.h"
+
+extern struct tst_test *tst_test;
+
+static struct tst_test test = {
+	.tid = "tst_device"
+};
+
+static void print_help(void)
+{
+	printf("\nUsage: tst_device acquire [size]\n");
+	printf("   or: tst_device release /path/to/device\n\n");
+}
+
+static int acquire_device(int argc, char *argv[])
+{
+	unsigned int size = 0;
+	const char *device;
+
+	if (argc > 3)
+		return 1;
+
+	if (argc == 3) {
+		size = atoi(argv[2]);
+
+		if (!size) {
+			fprintf(stderr, "ERROR: Invalid device size '%s'",
+				argv[2]);
+			return 1;
+		}
+	}
+
+	device = tst_acquire_device__(size);
+
+	if (!device)
+		return 1;
+
+	printf("%s", device);
+
+	return 0;
+}
+
+static int release_device(int argc, char *argv[])
+{
+	if (argc != 3)
+		return 1;
+
+	return tst_release_device(argv[2]);
+}
+
+int main(int argc, char *argv[])
+{
+	/*
+	 * Force messages to be printed from the new library i.e. tst_test.c
+	 *
+	 * The new library prints messages into stderr while the old one prints
+	 * them into stdout. When messages are printed into stderr we can
+	 * safely do:
+	 *
+	 * DEV=$(tst_device acquire)
+	 */
+	tst_test = &test;
+
+	if (argc < 2)
+		goto help;
+
+	if (!strcmp(argv[1], "acquire")) {
+		if (acquire_device(argc, argv))
+			goto help;
+	} else if (!strcmp(argv[1], "release")) {
+		if (release_device(argc, argv))
+			goto help;
+	} else {
+		fprintf(stderr, "ERROR: Invalid COMMAND '%s'\n", argv[1]);
+		goto help;
+	}
+
+	return 0;
+help:
+	print_help();
+	return 1;
+}
-- 
2.10.2


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

* [LTP] [PATCH 4/6] test.sh: Remove tst_{acquire, release}_device, tst_mkfs
  2017-02-08 11:02 [LTP] [PATCH 1/6] tst_test: Allow priting TINFO without initialized IPC Cyril Hrubis
  2017-02-08 11:02 ` [LTP] [PATCH 2/6] tst_device: Split the tst_acquire_device code again Cyril Hrubis
  2017-02-08 11:02 ` [LTP] [PATCH 3/6] lib: Add new tst_device for shell Cyril Hrubis
@ 2017-02-08 11:02 ` Cyril Hrubis
  2017-02-13 16:03   ` Jan Stancek
  2017-02-08 11:02 ` [LTP] [PATCH 5/6] tst_test.sh: Make use of tst_device helper Cyril Hrubis
  2017-02-08 11:02 ` [LTP] [PATCH 6/6] runltp, tst_device: Bump minimal device size to 256MB Cyril Hrubis
  4 siblings, 1 reply; 9+ messages in thread
From: Cyril Hrubis @ 2017-02-08 11:02 UTC (permalink / raw)
  To: ltp

There are not used by any test that uses test.sh library.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/lib/test.sh | 72 ---------------------------------------------------
 1 file changed, 72 deletions(-)

diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
index 48172d3..71dd611 100644
--- a/testcases/lib/test.sh
+++ b/testcases/lib/test.sh
@@ -288,78 +288,6 @@ EXPECT_FAIL()
 	fi
 }
 
-tst_acquire_device()
-{
-	local acq_dev_size=${1:-150}
-
-	if [ -z ${TST_TMPDIR} ]; then
-		tst_brkm "Use 'tst_tmpdir' before 'tst_acquire_device'"
-	fi
-
-	ltp_dev_size=$((`blockdev --getsize64 $LTP_DEV`/1024/1024))
-
-	if [ -n "${LTP_DEV}" ] && [ ${acq_dev_size} -le ${ltp_dev_size} ]; then
-		tst_resm TINFO "Using test device LTP_DEV='${LTP_DEV}'"
-		if [ ! -b ${LTP_DEV} ]; then
-			tst_brkm TBROK "${LTP_DEV} is not a block device"
-		fi
-
-		ROD_SILENT dd if=/dev/zero of="${LTP_DEV}" bs=1024 count=512
-
-		TST_DEVICE=${LTP_DEV}
-		TST_DEVICE_FLAG=0
-		return
-	fi
-
-	ROD_SILENT dd if=/dev/zero of=test_dev.img bs=1024 count=$((1024*$acq_dev_size))
-
-	TST_DEVICE=$(losetup -f)
-	if [ $? -ne 0 ]; then
-		tst_brkm TBROK "Couldn't find free loop device"
-	fi
-
-	tst_resm TINFO "Found free device '${TST_DEVICE}'"
-
-	ROD_SILENT losetup ${TST_DEVICE} test_dev.img
-
-	TST_DEVICE_FLAG=1
-}
-
-tst_release_device()
-{
-	if [ ${TST_DEVICE_FLAG} -eq 0 ]; then
-		return
-	fi
-
-	losetup -a | grep -q ${TST_DEVICE}
-	if [ $? -eq 0 ]; then
-		losetup -d ${TST_DEVICE}
-		if [ $? -ne 0 ];then
-			tst_resm TWARN "'losetup -d ${TST_DEVICE}' failed"
-		fi
-	fi
-}
-
-tst_mkfs()
-{
-	local fs_type=$1
-	local device=$2
-	shift 2
-	local fs_opts="$@"
-
-	if [ -z "$fs_type" ]; then
-		tst_brkm TBROK "No fs_type specified"
-	fi
-
-	if [ -z "$device" ]; then
-		tst_brkm TBROK "No device specified"
-	fi
-
-	tst_resm TINFO "Formatting $device with $fs_type extra opts='$fs_opts'"
-
-	ROD_SILENT mkfs.$fs_type $fs_opts $device
-}
-
 tst_umount()
 {
 	local device="$1"
-- 
2.10.2


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

* [LTP] [PATCH 5/6] tst_test.sh: Make use of tst_device helper
  2017-02-08 11:02 [LTP] [PATCH 1/6] tst_test: Allow priting TINFO without initialized IPC Cyril Hrubis
                   ` (2 preceding siblings ...)
  2017-02-08 11:02 ` [LTP] [PATCH 4/6] test.sh: Remove tst_{acquire, release}_device, tst_mkfs Cyril Hrubis
@ 2017-02-08 11:02 ` Cyril Hrubis
  2017-02-08 11:02 ` [LTP] [PATCH 6/6] runltp, tst_device: Bump minimal device size to 256MB Cyril Hrubis
  4 siblings, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2017-02-08 11:02 UTC (permalink / raw)
  To: ltp

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/lib/tst_test.sh | 31 +++++--------------------------
 1 file changed, 5 insertions(+), 26 deletions(-)

diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index b9ac938..087adda 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -41,12 +41,8 @@ tst_do_exit()
 	fi
 
 	if [ "$TST_NEEDS_DEVICE" = 1 -a "$TST_DEVICE_FLAG" = 1 ]; then
-		losetup -a | grep -q "$TST_DEVICE"
-		if [ $? -eq 0 ]; then
-			losetup -d "$TST_DEVICE"
-			if [ $? -ne 0 ]; then
-				tst_res TWARN "'losetup -d $TST_DEVICE' failed"
-			fi
+		if ! tst_device release "$TST_DEVICE"; then
+			tst_res TWARN "Failed to release device '$TST_DEVICE'"
 		fi
 	fi
 
@@ -309,29 +305,12 @@ tst_run()
 			tst_brk "Use TST_NEEDS_TMPDIR must be set for TST_NEEDS_DEVICE"
 		fi
 
-		if [ -n "${LTP_DEV}" ]; then
-			tst_res TINFO "Using test device LTP_DEV='${LTP_DEV}'"
-			if [ ! -b ${LTP_DEV} ]; then
-				tst_brkm TBROK "${LTP_DEV} is not a block device"
-			fi
-
-			ROD_SILENT dd if=/dev/zero of="${LTP_DEV}" bs=1024 count=512
-
-			TST_DEVICE=${LTP_DEV}
-			TST_DEVICE_FLAG=0
-			return
-		fi
-
-		ROD_SILENT dd if=/dev/zero of=test_dev.img bs=1024 count=153600
+		TST_DEVICE=$(tst_device acquire)
 
-		TST_DEVICE=$(losetup -f)
-		if [ $? -ne 0 ]; then
-			tst_brk TBROK "Couldn't find free loop device"
+		if [ -z "$TST_DEVICE" ]; then
+			tst_brk "Failed to acquire device"
 		fi
 
-		tst_res TINFO "Found free device '${TST_DEVICE}'"
-
-		ROD_SILENT losetup ${TST_DEVICE} test_dev.img
 		TST_DEVICE_FLAG=1
 	fi
 
-- 
2.10.2


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

* [LTP] [PATCH 6/6] runltp, tst_device: Bump minimal device size to 256MB
  2017-02-08 11:02 [LTP] [PATCH 1/6] tst_test: Allow priting TINFO without initialized IPC Cyril Hrubis
                   ` (3 preceding siblings ...)
  2017-02-08 11:02 ` [LTP] [PATCH 5/6] tst_test.sh: Make use of tst_device helper Cyril Hrubis
@ 2017-02-08 11:02 ` Cyril Hrubis
  4 siblings, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2017-02-08 11:02 UTC (permalink / raw)
  To: ltp

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 lib/tst_device.c | 3 ++-
 runltp           | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/tst_device.c b/lib/tst_device.c
index 24e8c6f..4cefd60 100644
--- a/lib/tst_device.c
+++ b/lib/tst_device.c
@@ -41,6 +41,7 @@
 #define LOOP_CONTROL_FILE "/dev/loop-control"
 
 #define DEV_FILE "test_dev.img"
+#define DEV_SIZE_MB 256
 
 static char dev_path[1024];
 static int device_acquired;
@@ -204,7 +205,7 @@ const char *tst_acquire_device__(unsigned int size)
 	unsigned int acq_dev_size;
 	uint64_t ltp_dev_size;
 
-	acq_dev_size = size > 150 ? size : 150;
+	acq_dev_size = size > DEV_SIZE_MB ? size : DEV_SIZE_MB;
 
 	dev = getenv("LTP_DEV");
 
diff --git a/runltp b/runltp
index f347f55..f081805 100755
--- a/runltp
+++ b/runltp
@@ -986,7 +986,7 @@ main()
 create_block()
 {
     #create a block device
-    dd if=/dev/zero of=${TMP}/test.img bs=1024 count=153600 >/dev/null 2>&1
+    dd if=/dev/zero of=${TMP}/test.img bs=1024 count=262144 >/dev/null 2>&1
     if [ $? -ne 0 ]; then
         echo "Failed to create loopback device image, please check disk space and re-run"
         return 1
-- 
2.10.2


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

* [LTP] [PATCH 4/6] test.sh: Remove tst_{acquire, release}_device, tst_mkfs
  2017-02-08 11:02 ` [LTP] [PATCH 4/6] test.sh: Remove tst_{acquire, release}_device, tst_mkfs Cyril Hrubis
@ 2017-02-13 16:03   ` Jan Stancek
  2017-02-13 16:20     ` Cyril Hrubis
  2017-02-13 16:39     ` Cyril Hrubis
  0 siblings, 2 replies; 9+ messages in thread
From: Jan Stancek @ 2017-02-13 16:03 UTC (permalink / raw)
  To: ltp





----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: ltp@lists.linux.it
> Sent: Wednesday, 8 February, 2017 12:02:53 PM
> Subject: [LTP] [PATCH 4/6] test.sh: Remove tst_{acquire, release}_device,	tst_mkfs
> 
> There are not used by any test that uses test.sh library.

Not even this one? ./testcases/kernel/fs/fs_readonly/test_robind.sh
It sources test.sh and calls tst_mkfs.

Other than that, I think we agreed to drop/replace 1/6, and skip
update_results() if ipc has not been set up.

The rest looks good to me.

Regards,
Jan

> 
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
> ---
>  testcases/lib/test.sh | 72
>  ---------------------------------------------------
>  1 file changed, 72 deletions(-)


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

* [LTP] [PATCH 4/6] test.sh: Remove tst_{acquire, release}_device, tst_mkfs
  2017-02-13 16:03   ` Jan Stancek
@ 2017-02-13 16:20     ` Cyril Hrubis
  2017-02-13 16:39     ` Cyril Hrubis
  1 sibling, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2017-02-13 16:20 UTC (permalink / raw)
  To: ltp

Hi!
> > There are not used by any test that uses test.sh library.
> 
> Not even this one? ./testcases/kernel/fs/fs_readonly/test_robind.sh
> It sources test.sh and calls tst_mkfs.

Ah, missed that one. So tst_mkfs() has to stay in test.sh.

> Other than that, I think we agreed to drop/replace 1/6, and skip
> update_results() if ipc has not been set up.

I have that change in my my tree already.

> The rest looks good to me.

Ok.

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [PATCH 4/6] test.sh: Remove tst_{acquire, release}_device, tst_mkfs
  2017-02-13 16:03   ` Jan Stancek
  2017-02-13 16:20     ` Cyril Hrubis
@ 2017-02-13 16:39     ` Cyril Hrubis
  1 sibling, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2017-02-13 16:39 UTC (permalink / raw)
  To: ltp

Hi!
> > There are not used by any test that uses test.sh library.
> 
> Not even this one? ./testcases/kernel/fs/fs_readonly/test_robind.sh
> It sources test.sh and calls tst_mkfs.

I've readded the tst_mkfs() to that patch but forget to update the
commit message, sorry. (that is what you get for pushing patches at the
end of the day)

Anyway, the patchset is pushed, I will continue to work on the safe
macros in cleanup tomorrow.

-- 
Cyril Hrubis
chrubis@suse.cz

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

end of thread, other threads:[~2017-02-13 16:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-08 11:02 [LTP] [PATCH 1/6] tst_test: Allow priting TINFO without initialized IPC Cyril Hrubis
2017-02-08 11:02 ` [LTP] [PATCH 2/6] tst_device: Split the tst_acquire_device code again Cyril Hrubis
2017-02-08 11:02 ` [LTP] [PATCH 3/6] lib: Add new tst_device for shell Cyril Hrubis
2017-02-08 11:02 ` [LTP] [PATCH 4/6] test.sh: Remove tst_{acquire, release}_device, tst_mkfs Cyril Hrubis
2017-02-13 16:03   ` Jan Stancek
2017-02-13 16:20     ` Cyril Hrubis
2017-02-13 16:39     ` Cyril Hrubis
2017-02-08 11:02 ` [LTP] [PATCH 5/6] tst_test.sh: Make use of tst_device helper Cyril Hrubis
2017-02-08 11:02 ` [LTP] [PATCH 6/6] runltp, tst_device: Bump minimal device size to 256MB 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.