lib/test.sh: improvement on the check if mkfs.btrfs supports -f option
PATCH 1/3 lib/test.sh: improvement on the check if mkfs.btrfs supports -f option
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 <[email protected]>
--- testcases/lib/test.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
testcases/lib/test.sh +4 -1
@@ -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"
Signature · 1 line
2.5.0
PATCH 2/3 lib/test.sh: special case jfs in tst_mkfs
jfs needs "-f" option too.
Signed-off-by Eryu Guan <[email protected]>
--- testcases/lib/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/lib/test.sh +1 -1
@@ -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
Signature · 1 line
2.5.0
PATCH 3/3 test_robind: use tst_mkfs helper to mkfs
In reply to Eryu GuanSo xfs and btrfs are handled correctly.
Signed-off-by Eryu Guan <[email protected]>
--- testcases/kernel/fs/fs_readonly/test_robind.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
testcases/kernel/fs/fs_readonly/test_robind.sh +3 -6
@@ -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
Signature · 1 line
2.5.0
PATCH 1/3 lib/test.sh: improvement on the check if mkfs.btrfs supports -f option
In reply to Eryu GuanHi!
All pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]