Skip to contentSkip to conversation

test_robind.sh: set default FSTYPES to LTP_BIG_DEV_FS_TYPE

PATCH New Eryu Guan 3 participants 7 messages Oct 31, 2015 – Nov 9, 2015

lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

PATCH 1/2 test_robind.sh: set default FSTYPES to LTP_BIG_DEV_FS_TYPE

In test_robind.sh LTP_BIG_DEV is used, so use LTP_BIG_DEV_FS_TYPE as default fs type accordingly. If LTP_BIG_DEV_FS_TYPE is not set, fall back to ext3.

---
 testcases/kernel/fs/fs_readonly/test_robind.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
testcases/kernel/fs/fs_readonly/test_robind.sh +3 -2
index 0513275..5674ca4 100755
@@ -123,9 +123,10 @@ setup()
 		mkdir -p $dir
 	done
 
-	# populating the default FS as ext3, if FS is not given
+	# populating the default FS as $LTP_BIG_DEV_FS_TYPE
+	# (or ext3 if it's not set), if FS is not given
 	if [ -z "$*" ]; then
-		FSTYPES="ext3"
+		FSTYPES=${LTP_BIG_DEV_FS_TYPE:-ext3}
 	else
 		FSTYPES="$*"
 	fi
Signature · 1 line
2.4.3
author
#1 lore raw

PATCH 2/2 test_robind.sh: add xfs and btrfs support

Add btrfs support and fix opts for xfs, which needs "-f" too.

---
 testcases/kernel/fs/fs_readonly/test_robind.sh | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
testcases/kernel/fs/fs_readonly/test_robind.sh +10 -3
index 5674ca4..371d5fa 100755
@@ -197,10 +197,17 @@ for fstype in $FSTYPES; do
 	opts="-F"
 	if [ "$fstype" = "reiserfs" ]; then
 		opts="-f --journal-size 513 -q"
-	elif [ "$fstype" = "jfs" ]; then
+	elif [ "$fstype" = "jfs" -o "$fstype" = "xfs" ]; then
 		opts="-f"
-	elif [ "$fstype" = "xfs" ]; then
-		opts=""
+	elif [ "$fstype" = "btrfs" ]; then
+		# check if mkfs.btrfs supports -f option
+		# detect "-f --force" or "-f|--force" because btrfs-progs
+		# changes usage text in commit 3f312d500b73
+		if mkfs.btrfs 2>&1 | grep -q '\-f[ |]'; then
+			opts="-f"
+		else
+			opts=""
+		fi
 	fi
 
 	if [ "$fstype" != "ramfs" ]; then
Signature · 1 line
2.4.3
#2 lore raw

PATCH 2/2 test_robind.sh: add xfs and btrfs support

Hi!

Quoted 20 lines

Add btrfs support and fix opts for xfs, which needs "-f" too.

---
 testcases/kernel/fs/fs_readonly/test_robind.sh | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
testcases/kernel/fs/fs_readonly/test_robind.sh +1 -3
index 5674ca4..371d5fa 100755
@@ -197,10 +197,17 @@ for fstype in $FSTYPES; do
 	opts="-F"
 	if [ "$fstype" = "reiserfs" ]; then
 		opts="-f --journal-size 513 -q"
-	elif [ "$fstype" = "jfs" ]; then
+	elif [ "$fstype" = "jfs" -o "$fstype" = "xfs" ]; then
 		opts="-f"
-	elif [ "$fstype" = "xfs" ]; then
-		opts=""

testcases/kernel/fs/fs_readonly/test_robind.sh for fstype in $FSTYPES; do · line 211

Quoted 10 lines
testcases/kernel/fs/fs_readonly/test_robind.sh +9 -0
+	elif [ "$fstype" = "btrfs" ]; then
+		# check if mkfs.btrfs supports -f option
+		# detect "-f --force" or "-f|--force" because btrfs-progs
+		# changes usage text in commit 3f312d500b73
+		if mkfs.btrfs 2>&1 | grep -q '\-f[ |]'; then
+			opts="-f"
+		else
+			opts=""
+		fi
 	fi

We have this special cases in tst_mkfs function in test.sh, you should really use that instead of copying the code around.

Lookin at the code in test.sh we should add special case for jfs there and call tst_mkfs here instead of mkfs.$fstype.

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#3 lore raw

PATCH 2/2 test_robind.sh: add xfs and btrfs support

Quoted 26 lines · Cyril Hrubis

Hi!

Quoted 25 lines

Add btrfs support and fix opts for xfs, which needs "-f" too.

---
 testcases/kernel/fs/fs_readonly/test_robind.sh | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
testcases/kernel/fs/fs_readonly/test_robind.sh +6 -3
index 5674ca4..371d5fa 100755
@@ -197,10 +197,17 @@ for fstype in $FSTYPES; do
 	opts="-F"
 	if [ "$fstype" = "reiserfs" ]; then
 		opts="-f --journal-size 513 -q"
-	elif [ "$fstype" = "jfs" ]; then
+	elif [ "$fstype" = "jfs" -o "$fstype" = "xfs" ]; then
 		opts="-f"
-	elif [ "$fstype" = "xfs" ]; then
-		opts=""
+	elif [ "$fstype" = "btrfs" ]; then
+		# check if mkfs.btrfs supports -f option
+		# detect "-f --force" or "-f|--force" because btrfs-progs
+		# changes usage text in commit 3f312d500b73
+		if mkfs.btrfs 2>&1 | grep -q '\-f[ |]'; then
Quoted 8 lines

testcases/kernel/fs/fs_readonly/test_robind.sh for fstype in $FSTYPES; do · line 211

Quoted 5 lines
testcases/kernel/fs/fs_readonly/test_robind.sh +4 -0
+			opts="-f"
+		else
+			opts=""
+		fi
 	fi

We have this special cases in tst_mkfs function in test.sh, you should really use that instead of copying the code around.

Thanks for the reminder, I was not aware of tst_mkfs helper.

Quoted 3 lines

Lookin at the code in test.sh we should add special case for jfs there and call tst_mkfs here instead of mkfs.$fstype.

Will update the helper and use it.

Thanks!

Eryu

#5 lore raw

PATCH 1/2 test_robind.sh: set default FSTYPES to LTP_BIG_DEV_FS_TYPE

In reply to Eryu Guan
Quoted 14 lines

In test_robind.sh LTP_BIG_DEV is used, so use LTP_BIG_DEV_FS_TYPE as default fs type accordingly. If LTP_BIG_DEV_FS_TYPE is not set, fall back to ext3.

---
  testcases/kernel/fs/fs_readonly/test_robind.sh | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
testcases/kernel/fs/fs_readonly/test_robind.sh +0 -0
index 0513275..5674ca4 100755

testcases/kernel/fs/fs_readonly/test_robind.sh setup() · line 129

Quoted 9 lines
testcases/kernel/fs/fs_readonly/test_robind.sh +3 -2
@@ -123,9 +123,10 @@ setup()
  		mkdir -p $dir
  	done
 
-	# populating the default FS as ext3, if FS is not given
+	# populating the default FS as $LTP_BIG_DEV_FS_TYPE
+	# (or ext3 if it's not set), if FS is not given
  	if [ -z "$*" ]; then
-		FSTYPES="ext3"
+		FSTYPES=${LTP_BIG_DEV_FS_TYPE:-ext3}

Hi!
Except LTP_BIG_DEV is not set, is there any chance that
LTP_BIG_DEV_FS_TYP will be NULL? If LTP_BIG_DEV is not set, this test case will exit with a tst_brkm, and if LTP_BIG_DEV is set, LTP_BIG_DEV_FS_TYPE always gets a value in runltp script, here is the snippet:

if [ -z "$BIG_DEVICE" ]; then
echo "no big block device was specified on commandline." echo "Tests which require a big block device are disabled." echo "You can specify it with option -z"
else
export LTP_BIG_DEV=$BIG_DEVICE
if [ -z "$BIG_DEVICE_FS_TYPE" ]; then
export LTP_BIG_DEV_FS_TYPE="ext2"
else
export LTP_BIG_DEV_FS_TYPE=$BIG_DEVICE_FS_TYPE
fi
fi

IMHO, FSTYPES should be ${LTP_BIG_DEV_FS_TYP} rather than ${LTP_BIG_DEV_FS_TYPE:-ext3}.

testcases/kernel/fs/fs_readonly/test_robind.sh setup() · line 132

Quoted 4 lines
testcases/kernel/fs/fs_readonly/test_robind.sh +0 -0
  	else
  		FSTYPES="$*"
  	fi

Thanks

Signature · 2 lines
Rock Lee
[email protected]
author
#6 lore raw

PATCH 1/2 test_robind.sh: set default FSTYPES to LTP_BIG_DEV_FS_TYPE

Quoted 17 lines · Lei Li
Quoted 17 lines

In test_robind.sh LTP_BIG_DEV is used, so use LTP_BIG_DEV_FS_TYPE as default fs type accordingly. If LTP_BIG_DEV_FS_TYPE is not set, fall back to ext3.

---
 testcases/kernel/fs/fs_readonly/test_robind.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
testcases/kernel/fs/fs_readonly/test_robind.sh +0 -0
index 0513275..5674ca4 100755
@@ -123,9 +123,10 @@ setup()
 		mkdir -p $dir
 	done
 
Quoted 11 lines

testcases/kernel/fs/fs_readonly/test_robind.sh setup() · line 129

Quoted 6 lines
testcases/kernel/fs/fs_readonly/test_robind.sh +3 -2
-	# populating the default FS as ext3, if FS is not given
+	# populating the default FS as $LTP_BIG_DEV_FS_TYPE
+	# (or ext3 if it's not set), if FS is not given
 	if [ -z "$*" ]; then
-		FSTYPES="ext3"
+		FSTYPES=${LTP_BIG_DEV_FS_TYPE:-ext3}

Hi!
Except LTP_BIG_DEV is not set, is there any chance that LTP_BIG_DEV_FS_TYP
will be NULL? If LTP_BIG_DEV is not set, this test case will exit with a tst_brkm, and if LTP_BIG_DEV is set, LTP_BIG_DEV_FS_TYPE always gets a value in runltp script, here is the snippet:

When we "export LTP_BIG_DEV=xxx" but don't export LTP_BIG_DEV_FS_TYPE

Quoted 5 lines

if [ -z "$BIG_DEVICE" ]; then
echo "no big block device was specified on commandline." echo "Tests which require a big block device are disabled." echo "You can specify it with option -z"

runltp checks "$BIG_DEVICE" here, but test_robind.sh checks "$LTP_BIG_DEV" and tst_brkm if it's empty. So we can export LTP_BIG_DEV directly to bypass the BIG_DEVICE check in runltp and get no LTP_BIG_DEV_FS_TYPE set.

Thanks,
Eryu

Quoted 20 lines
    else
        export LTP_BIG_DEV=$BIG_DEVICE
        if [ -z "$BIG_DEVICE_FS_TYPE" ]; then
            export LTP_BIG_DEV_FS_TYPE="ext2"
        else
            export LTP_BIG_DEV_FS_TYPE=$BIG_DEVICE_FS_TYPE
        fi
    fi

IMHO, FSTYPES should be ${LTP_BIG_DEV_FS_TYP} rather than ${LTP_BIG_DEV_FS_TYPE:-ext3}.

testcases/kernel/fs/fs_readonly/test_robind.sh setup() · line 132

Quoted 4 lines
testcases/kernel/fs/fs_readonly/test_robind.sh +0 -0
 	else
 		FSTYPES="$*"
 	fi

Thanks

Signature · 2 lines
Rock Lee
[email protected]