* [LTP] [PATCH 1/2] tst_mkfs: drop -f from mkfs
@ 2016-03-14 16:24 Stanislav Kholmanskikh
2016-03-14 16:24 ` [LTP] [PATCH 2/2] tst_mkfs: check the arguments for passed device and fs_type Stanislav Kholmanskikh
0 siblings, 1 reply; 4+ messages in thread
From: Stanislav Kholmanskikh @ 2016-03-14 16:24 UTC (permalink / raw)
To: ltp
We no longer need to pass the force flag to mkfs due to
commit f79021c5d168 ("tst_acquire_device: clear first sectors of LTP_DEV").
Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
This patch is a follow up to:
http://lists.linux.it/pipermail/ltp/2016-February/001044.html
lib/tst_mkfs.c | 21 ---------------------
testcases/lib/test.sh | 21 ++-------------------
2 files changed, 2 insertions(+), 40 deletions(-)
diff --git a/lib/tst_mkfs.c b/lib/tst_mkfs.c
index 5f959a4..5cd8565 100644
--- a/lib/tst_mkfs.c
+++ b/lib/tst_mkfs.c
@@ -31,27 +31,6 @@ void tst_mkfs(void (cleanup_fn)(void), const char *dev,
if (!fs_type)
tst_brkm(TBROK, cleanup_fn, "No fs_type specified");
- /*
- * mkfs.xfs and mkfs.btrfs aborts if it finds a filesystem
- * superblock on the device, which is the case here as we
- * reuse one device for all tests.
- */
- if (!strcmp(fs_type, "xfs")) {
- tst_resm(TINFO, "Appending '-f' flag to mkfs.%s", fs_type);
- argv[pos++] = "-f";
- }
-
- if (!strcmp(fs_type, "btrfs")) {
- /*
- * The -f option was added to btrfs-progs v3.12
- */
- if (!tst_system("mkfs.btrfs 2>&1 | grep -q '\\-f[ |]'")) {
- tst_resm(TINFO, "Appending '-f' flag to mkfs.%s",
- fs_type);
- argv[pos++] = "-f";
- }
- }
-
if (fs_opts) {
for (i = 0; fs_opts[i]; i++) {
argv[pos++] = fs_opts[i];
diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
index 9b652c0..1d603b6 100644
--- a/testcases/lib/test.sh
+++ b/testcases/lib/test.sh
@@ -300,26 +300,9 @@ tst_mkfs()
{
local fs_type=$1
local device=$2
- local fs_opts=""
-
- if [ $fs_type = "xfs" -o $fs_type = "jfs" ]; then
- tst_resm TINFO "Appending '-f' flag to mkfs.$fs_type"
- fs_opts="-f"
- fi
-
- if [ $fs_type = "btrfs" ]; then
- # check if mkfs.btrfs supports -f option
- # detect "-f --force" or "-f|--force" because btrfs-progs
- # changes usage text in commit 3f312d500b73
- mkfs.btrfs 2>&1 | grep -q '\-f[ |]' >/dev/null
- if [ $? -eq 0 ]; then
- tst_resm TINFO "Appending '-f' flag to mkfs.$fs_type"
- fs_opts="-f"
- fi
- fi
-
shift 2
- fs_opts="$fs_opts $@"
+ local fs_opts="$@"
+
tst_resm TINFO "Formatting $device with $fs_type extra opts='$fs_opts'"
ROD_SILENT mkfs.$fs_type $fs_opts $device
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [LTP] [PATCH 2/2] tst_mkfs: check the arguments for passed device and fs_type
2016-03-14 16:24 [LTP] [PATCH 1/2] tst_mkfs: drop -f from mkfs Stanislav Kholmanskikh
@ 2016-03-14 16:24 ` Stanislav Kholmanskikh
2016-03-14 17:36 ` Cyril Hrubis
0 siblings, 1 reply; 4+ messages in thread
From: Stanislav Kholmanskikh @ 2016-03-14 16:24 UTC (permalink / raw)
To: ltp
Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
lib/tst_mkfs.c | 3 +++
testcases/lib/test.sh | 8 ++++++++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/lib/tst_mkfs.c b/lib/tst_mkfs.c
index 5cd8565..7a0992c 100644
--- a/lib/tst_mkfs.c
+++ b/lib/tst_mkfs.c
@@ -28,6 +28,9 @@ void tst_mkfs(void (cleanup_fn)(void), const char *dev,
const char *argv[OPTS_MAX] = {"mkfs", "-t", fs_type};
char fs_opts_str[1024] = "";
+ if (!dev)
+ tst_brkm(TBROK, cleanup_fn, "No device specified");
+
if (!fs_type)
tst_brkm(TBROK, cleanup_fn, "No fs_type specified");
diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
index 1d603b6..458bbca 100644
--- a/testcases/lib/test.sh
+++ b/testcases/lib/test.sh
@@ -303,6 +303,14 @@ tst_mkfs()
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
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [LTP] [PATCH 2/2] tst_mkfs: check the arguments for passed device and fs_type
2016-03-14 16:24 ` [LTP] [PATCH 2/2] tst_mkfs: check the arguments for passed device and fs_type Stanislav Kholmanskikh
@ 2016-03-14 17:36 ` Cyril Hrubis
2016-03-15 7:53 ` Stanislav Kholmanskikh
0 siblings, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2016-03-14 17:36 UTC (permalink / raw)
To: ltp
Hi!
Both patches acked.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LTP] [PATCH 2/2] tst_mkfs: check the arguments for passed device and fs_type
2016-03-14 17:36 ` Cyril Hrubis
@ 2016-03-15 7:53 ` Stanislav Kholmanskikh
0 siblings, 0 replies; 4+ messages in thread
From: Stanislav Kholmanskikh @ 2016-03-15 7:53 UTC (permalink / raw)
To: ltp
On 03/14/2016 08:36 PM, Cyril Hrubis wrote:
> Hi!
> Both patches acked.
>
Thank you. Pushed.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-15 7:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-14 16:24 [LTP] [PATCH 1/2] tst_mkfs: drop -f from mkfs Stanislav Kholmanskikh
2016-03-14 16:24 ` [LTP] [PATCH 2/2] tst_mkfs: check the arguments for passed device and fs_type Stanislav Kholmanskikh
2016-03-14 17:36 ` Cyril Hrubis
2016-03-15 7:53 ` Stanislav Kholmanskikh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox