diff mbox series

[3/3] btrfs-progs: misc-tests: add test to ensure the restored image can be mounted

Message ID 20210326125047.123694-4-wqu@suse.com (mailing list archive)
State New
Headers show
Series btrfs-progs: image: make restored image file to be properly enlarged | expand

Commit Message

Qu Wenruo March 26, 2021, 12:50 p.m. UTC
This new test case is to make sure the restored image file has been
properly enlarged so that newer kernel won't complain.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 .../047-image-restore-mount/test.sh           | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100755 tests/misc-tests/047-image-restore-mount/test.sh

Comments

David Sterba April 16, 2021, 5:46 p.m. UTC | #1
On Fri, Mar 26, 2021 at 08:50:47PM +0800, Qu Wenruo wrote:
> This new test case is to make sure the restored image file has been
> properly enlarged so that newer kernel won't complain.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
>  .../047-image-restore-mount/test.sh           | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>  create mode 100755 tests/misc-tests/047-image-restore-mount/test.sh
> 
> diff --git a/tests/misc-tests/047-image-restore-mount/test.sh b/tests/misc-tests/047-image-restore-mount/test.sh
> new file mode 100755
> index 000000000000..7f12afa2bab6
> --- /dev/null
> +++ b/tests/misc-tests/047-image-restore-mount/test.sh
> @@ -0,0 +1,19 @@
> +#!/bin/bash
> +# Verify that the restored image of an empty btrfs can still be mounted
                                                ^^^^^

I've seen that in patches and comments, the use of word 'btrfs' instead
of 'filesystem' sounds a bit inappropriate to me, so I change it
whenever I see it. It's perhaps matter of taste and style, one can write
it also as 'btrfs filesystem' but that may belong to some more polished
documentation, so you can go with just 'filesystem'.
Qu Wenruo April 17, 2021, 12:18 a.m. UTC | #2
On 2021/4/17 上午1:46, David Sterba wrote:
> On Fri, Mar 26, 2021 at 08:50:47PM +0800, Qu Wenruo wrote:
>> This new test case is to make sure the restored image file has been
>> properly enlarged so that newer kernel won't complain.
>>
>> Signed-off-by: Qu Wenruo <wqu@suse.com>
>> ---
>>   .../047-image-restore-mount/test.sh           | 19 +++++++++++++++++++
>>   1 file changed, 19 insertions(+)
>>   create mode 100755 tests/misc-tests/047-image-restore-mount/test.sh
>>
>> diff --git a/tests/misc-tests/047-image-restore-mount/test.sh b/tests/misc-tests/047-image-restore-mount/test.sh
>> new file mode 100755
>> index 000000000000..7f12afa2bab6
>> --- /dev/null
>> +++ b/tests/misc-tests/047-image-restore-mount/test.sh
>> @@ -0,0 +1,19 @@
>> +#!/bin/bash
>> +# Verify that the restored image of an empty btrfs can still be mounted
>                                                  ^^^^^
>
> I've seen that in patches and comments, the use of word 'btrfs' instead
> of 'filesystem' sounds a bit inappropriate to me, so I change it
> whenever I see it. It's perhaps matter of taste and style, one can write
> it also as 'btrfs filesystem' but that may belong to some more polished
> documentation, so you can go with just 'filesystem'.
>
Thanks for pointing this out.

I'll use 'filesystem' from now on.

Thanks,
Qu
diff mbox series

Patch

diff --git a/tests/misc-tests/047-image-restore-mount/test.sh b/tests/misc-tests/047-image-restore-mount/test.sh
new file mode 100755
index 000000000000..7f12afa2bab6
--- /dev/null
+++ b/tests/misc-tests/047-image-restore-mount/test.sh
@@ -0,0 +1,19 @@ 
+#!/bin/bash
+# Verify that the restored image of an empty btrfs can still be mounted
+
+source "$TEST_TOP/common"
+
+check_prereq btrfs-image
+check_prereq mkfs.btrfs
+check_prereq btrfs
+
+tmp=$(mktemp -d --tmpdir btrfs-progs-image.XXXXXXXX)
+prepare_test_dev
+
+run_check_mkfs_test_dev
+run_check "$TOP/btrfs-image" "$TEST_DEV" "$tmp/dump"
+run_check "$TOP/btrfs-image" -r "$tmp/dump" "$tmp/restored"
+
+run_check $SUDO_HELPER mount -t btrfs -o loop "$tmp/restored" "$TEST_MNT"
+umount "$TEST_MNT" &> /dev/null
+rm -rf -- "$tmp"