All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/3] lib/test.sh: improvement on the check if mkfs.btrfs supports -f option
@ 2015-11-05 14:34 Eryu Guan
  2015-11-05 14:35 ` [LTP] [PATCH 2/3] lib/test.sh: special case jfs in tst_mkfs Eryu Guan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eryu Guan @ 2015-11-05 14:34 UTC (permalink / raw)
  To: ltp

There are two issues here:

a) '\\-f' won't match string "-f", but "\\-f" or '\-f' does
b) searching for string "-f" is not accurate, because it matches both
   "-f" and "--features"

And the help text has been changed in btrfs-progs commit 3f312d500b73.
So use '\-f[ |]' to match both old and new btrfs-progs.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 testcases/lib/test.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
index 1753664..6de39b9 100644
--- a/testcases/lib/test.sh
+++ b/testcases/lib/test.sh
@@ -277,7 +277,10 @@ tst_mkfs()
 	fi
 
 	if [ $fs_type = "btrfs" ]; then
-		mkfs.btrfs 2>&1 | grep -q '\\-f' >/dev/null
+		# 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"
-- 
2.5.0


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

* [LTP] [PATCH 2/3] lib/test.sh: special case jfs in tst_mkfs
  2015-11-05 14:34 [LTP] [PATCH 1/3] lib/test.sh: improvement on the check if mkfs.btrfs supports -f option Eryu Guan
@ 2015-11-05 14:35 ` Eryu Guan
  2015-11-05 14:35 ` [LTP] [PATCH 3/3] test_robind: use tst_mkfs helper to mkfs Eryu Guan
  2015-11-05 14:53 ` [LTP] [PATCH 1/3] lib/test.sh: improvement on the check if mkfs.btrfs supports -f option Cyril Hrubis
  2 siblings, 0 replies; 4+ messages in thread
From: Eryu Guan @ 2015-11-05 14:35 UTC (permalink / raw)
  To: ltp

jfs needs "-f" option too.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 testcases/lib/test.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
index 6de39b9..31c99ee 100644
--- a/testcases/lib/test.sh
+++ b/testcases/lib/test.sh
@@ -271,7 +271,7 @@ tst_mkfs()
 	local device=$2
 	local fs_opts=""
 
-	if [ $fs_type = "xfs" ]; then
+	if [ $fs_type = "xfs" -o $fs_type = "jfs" ]; then
 		tst_resm TINFO "Appending '-f' flag to mkfs.$fs_type"
 		fs_opts="-f"
 	fi
-- 
2.5.0


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

* [LTP] [PATCH 3/3] test_robind: use tst_mkfs helper to mkfs
  2015-11-05 14:34 [LTP] [PATCH 1/3] lib/test.sh: improvement on the check if mkfs.btrfs supports -f option Eryu Guan
  2015-11-05 14:35 ` [LTP] [PATCH 2/3] lib/test.sh: special case jfs in tst_mkfs Eryu Guan
@ 2015-11-05 14:35 ` Eryu Guan
  2015-11-05 14:53 ` [LTP] [PATCH 1/3] lib/test.sh: improvement on the check if mkfs.btrfs supports -f option Cyril Hrubis
  2 siblings, 0 replies; 4+ messages in thread
From: Eryu Guan @ 2015-11-05 14:35 UTC (permalink / raw)
  To: ltp

So xfs and btrfs are handled correctly.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 testcases/kernel/fs/fs_readonly/test_robind.sh | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/testcases/kernel/fs/fs_readonly/test_robind.sh b/testcases/kernel/fs/fs_readonly/test_robind.sh
index 5674ca4..dfe6f7e 100755
--- a/testcases/kernel/fs/fs_readonly/test_robind.sh
+++ b/testcases/kernel/fs/fs_readonly/test_robind.sh
@@ -194,17 +194,14 @@ setup $*
 
 # Executes the tests for differnt FS's
 for fstype in $FSTYPES; do
-	opts="-F"
 	if [ "$fstype" = "reiserfs" ]; then
 		opts="-f --journal-size 513 -q"
-	elif [ "$fstype" = "jfs" ]; then
-		opts="-f"
-	elif [ "$fstype" = "xfs" ]; then
-		opts=""
+	elif echo "$fstype" | grep -q "ext"; then
+		opts="-F"
 	fi
 
 	if [ "$fstype" != "ramfs" ]; then
-		mkfs.$fstype $opts $device > /dev/null
+		tst_mkfs $fstype $device $opts
 	fi
 
 	mount -t $fstype $device  dir1
-- 
2.5.0


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

* [LTP] [PATCH 1/3] lib/test.sh: improvement on the check if mkfs.btrfs supports -f option
  2015-11-05 14:34 [LTP] [PATCH 1/3] lib/test.sh: improvement on the check if mkfs.btrfs supports -f option Eryu Guan
  2015-11-05 14:35 ` [LTP] [PATCH 2/3] lib/test.sh: special case jfs in tst_mkfs Eryu Guan
  2015-11-05 14:35 ` [LTP] [PATCH 3/3] test_robind: use tst_mkfs helper to mkfs Eryu Guan
@ 2015-11-05 14:53 ` Cyril Hrubis
  2 siblings, 0 replies; 4+ messages in thread
From: Cyril Hrubis @ 2015-11-05 14:53 UTC (permalink / raw)
  To: ltp

Hi!
All pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

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

end of thread, other threads:[~2015-11-05 14:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-05 14:34 [LTP] [PATCH 1/3] lib/test.sh: improvement on the check if mkfs.btrfs supports -f option Eryu Guan
2015-11-05 14:35 ` [LTP] [PATCH 2/3] lib/test.sh: special case jfs in tst_mkfs Eryu Guan
2015-11-05 14:35 ` [LTP] [PATCH 3/3] test_robind: use tst_mkfs helper to mkfs Eryu Guan
2015-11-05 14:53 ` [LTP] [PATCH 1/3] lib/test.sh: improvement on the check if mkfs.btrfs supports -f option 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.