* [PATCH v2 0/2] btrfs-progs: tests: Introduce run_check_mount_test_dev wrapper for mount loop device in old system
@ 2015-09-01 10:03 Zhao Lei
2015-09-01 10:03 ` [PATCH v2 1/2] btrfs-progs: tests: Fix mount fail of 013-extent-tree-rebuild Zhao Lei
2015-09-01 10:03 ` [PATCH v2 2/2] btrfs-progs: tests: Use mount_test_dev for misc-tests/007-subvolume-sync Zhao Lei
0 siblings, 2 replies; 4+ messages in thread
From: Zhao Lei @ 2015-09-01 10:03 UTC (permalink / raw)
To: linux-btrfs; +Cc: Zhao Lei
mount command in old system can not add -o loop option automatically
for loop device, and make following test failed:
# ./fsck-tests.sh
...
[TEST] 013-extent-tree-rebuild
failed: mount /data/btrfsprogs/tests/test.img /data/btrfsprogs/tests/mnt
test failed for case 013-extent-tree-rebuild
This patchset add run_check_mount_test_dev for mount both block and loop
device.
Changelog v1->v2:
1: Use string for mount option instead of string array.
2: Include "run_check $SUDO_HELPER" into wrapper function.
Both suggested by: David Sterba <dsterba@suse.cz>
Zhao Lei (2):
btrfs-progs: tests: Fix mount fail of 013-extent-tree-rebuild
btrfs-progs: tests: Use mount_test_dev for
misc-tests/007-subvolume-sync
tests/common | 26 ++++++++++++++++++++++++
tests/fsck-tests/013-extent-tree-rebuild/test.sh | 4 ++--
tests/misc-tests/007-subvolume-sync/test.sh | 4 ++--
3 files changed, 30 insertions(+), 4 deletions(-)
--
1.8.5.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] btrfs-progs: tests: Fix mount fail of 013-extent-tree-rebuild
2015-09-01 10:03 [PATCH v2 0/2] btrfs-progs: tests: Introduce run_check_mount_test_dev wrapper for mount loop device in old system Zhao Lei
@ 2015-09-01 10:03 ` Zhao Lei
2015-09-01 12:55 ` David Sterba
2015-09-01 10:03 ` [PATCH v2 2/2] btrfs-progs: tests: Use mount_test_dev for misc-tests/007-subvolume-sync Zhao Lei
1 sibling, 1 reply; 4+ messages in thread
From: Zhao Lei @ 2015-09-01 10:03 UTC (permalink / raw)
To: linux-btrfs; +Cc: Zhao Lei
mount command in old system can not add "-o loop" option automatically
for loop device, and make following test failed:
# ./fsck-tests.sh
...
[TEST] 013-extent-tree-rebuild
failed: mount /data/btrfsprogs/tests/test.img /data/btrfsprogs/tests/mnt
test failed for case 013-extent-tree-rebuild
Considering that $TEST_DEV can be block or loop device, we need determine
our mount option in a condition for both case.
This patch create a wrapper function for above request, to solve current
problem in 013-extent-tree-rebuild, and support similar request in future.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
tests/common | 26 ++++++++++++++++++++++++
tests/fsck-tests/013-extent-tree-rebuild/test.sh | 4 ++--
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/tests/common b/tests/common
index c597915..8205b33 100644
--- a/tests/common
+++ b/tests/common
@@ -171,6 +171,32 @@ prepare_test_dev()
truncate -s "$size" "$TEST_DEV" || _not_run "create file for loop device failed"
}
+run_check_mount_test_dev()
+{
+ setup_root_helper
+
+ local loop_opt
+ if [[ -b "$TEST_DEV" ]]; then
+ loop_opt=""
+ elif [[ -f "$TEST_DEV" ]]; then
+ loop_opt="-o loop"
+ else
+ _fail "Invalid \$TEST_DEV: $TEST_DEV"
+ fi
+
+ [[ -d "$TEST_MNT" ]] || {
+ _fail "Invalid \$TEST_MNT: $TEST_MNT"
+ }
+
+ run_check $SUDO_HELPER mount $loop_opt "$TEST_DEV" "$TEST_MNT"
+}
+
+run_check_umount_test_dev()
+{
+ setup_root_helper
+ run_check $SUDO_HELPER umount "$TEST_DEV"
+}
+
init_env()
{
TEST_MNT="${TEST_MNT:-$TOP/tests/mnt}"
diff --git a/tests/fsck-tests/013-extent-tree-rebuild/test.sh b/tests/fsck-tests/013-extent-tree-rebuild/test.sh
index b7909d2..7419d6e 100755
--- a/tests/fsck-tests/013-extent-tree-rebuild/test.sh
+++ b/tests/fsck-tests/013-extent-tree-rebuild/test.sh
@@ -12,14 +12,14 @@ test_extent_tree_rebuild()
{
run_check $SUDO_HELPER $TOP/mkfs.btrfs -f $TEST_DEV
- run_check $SUDO_HELPER mount $TEST_DEV $TEST_MNT
+ run_check_mount_test_dev
run_check $SUDO_HELPER cp -aR /lib/modules/`uname -r`/ $TEST_MNT
for i in `seq 1 100`;do
run_check $SUDO_HELPER $TOP/btrfs sub snapshot $TEST_MNT \
$TEST_MNT/snapaaaaaaa_$i
done
- run_check $SUDO_HELPER umount $TEST_DEV
+ run_check_umount_test_dev
# get extent root bytenr
extent_root_bytenr=`$SUDO_HELPER $TOP/btrfs-debug-tree -r $TEST_DEV | \
--
1.8.5.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] btrfs-progs: tests: Use mount_test_dev for misc-tests/007-subvolume-sync
2015-09-01 10:03 [PATCH v2 0/2] btrfs-progs: tests: Introduce run_check_mount_test_dev wrapper for mount loop device in old system Zhao Lei
2015-09-01 10:03 ` [PATCH v2 1/2] btrfs-progs: tests: Fix mount fail of 013-extent-tree-rebuild Zhao Lei
@ 2015-09-01 10:03 ` Zhao Lei
1 sibling, 0 replies; 4+ messages in thread
From: Zhao Lei @ 2015-09-01 10:03 UTC (permalink / raw)
To: linux-btrfs; +Cc: Zhao Lei
So this test can support both block device and loop device simply.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
tests/misc-tests/007-subvolume-sync/test.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/misc-tests/007-subvolume-sync/test.sh b/tests/misc-tests/007-subvolume-sync/test.sh
index d4019f4..a745fb5 100755
--- a/tests/misc-tests/007-subvolume-sync/test.sh
+++ b/tests/misc-tests/007-subvolume-sync/test.sh
@@ -13,7 +13,7 @@ setup_root_helper
prepare_test_dev
run_check $SUDO_HELPER $TOP/mkfs.btrfs -f "$TEST_DEV"
-run_check $SUDO_HELPER mount "$TEST_DEV" "$TEST_MNT"
+run_check_mount_test_dev
# to check following thing in both 1 and multiple subvolume case:
# 1: is subvolume sync loop indefinetelly
@@ -29,4 +29,4 @@ run_check $SUDO_HELPER $TOP/btrfs subvolume create "$TEST_MNT"/mysubvol
run_check $SUDO_HELPER $TOP/btrfs subvolume delete "$TEST_MNT"/mysubvol
run_check $SUDO_HELPER $TOP/btrfs subvolume sync "$TEST_MNT"
-run_check $SUDO_HELPER umount $TEST_MNT
+run_check_umount_test_dev
--
1.8.5.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/2] btrfs-progs: tests: Fix mount fail of 013-extent-tree-rebuild
2015-09-01 10:03 ` [PATCH v2 1/2] btrfs-progs: tests: Fix mount fail of 013-extent-tree-rebuild Zhao Lei
@ 2015-09-01 12:55 ` David Sterba
0 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2015-09-01 12:55 UTC (permalink / raw)
To: Zhao Lei; +Cc: linux-btrfs
On Tue, Sep 01, 2015 at 06:03:27PM +0800, Zhao Lei wrote:
> mount command in old system can not add "-o loop" option automatically
> for loop device, and make following test failed:
> # ./fsck-tests.sh
> ...
> [TEST] 013-extent-tree-rebuild
> failed: mount /data/btrfsprogs/tests/test.img /data/btrfsprogs/tests/mnt
> test failed for case 013-extent-tree-rebuild
>
> Considering that $TEST_DEV can be block or loop device, we need determine
> our mount option in a condition for both case.
>
> This patch create a wrapper function for above request, to solve current
> problem in 013-extent-tree-rebuild, and support similar request in future.
>
> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Applied, thanks.
FYI, I've separated this patch into two, one adding the helpers and the
other one using them. Changelogs contents was mostly reused.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-09-01 12:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-01 10:03 [PATCH v2 0/2] btrfs-progs: tests: Introduce run_check_mount_test_dev wrapper for mount loop device in old system Zhao Lei
2015-09-01 10:03 ` [PATCH v2 1/2] btrfs-progs: tests: Fix mount fail of 013-extent-tree-rebuild Zhao Lei
2015-09-01 12:55 ` David Sterba
2015-09-01 10:03 ` [PATCH v2 2/2] btrfs-progs: tests: Use mount_test_dev for misc-tests/007-subvolume-sync Zhao Lei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).