summaryrefslogtreecommitdiff
path: root/tests/common.convert
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2017-08-22 18:32:57 +0200
committerDavid Sterba <dsterba@suse.com>2017-09-08 16:15:05 +0200
commite75f466ddd8138093b5355af9fda24ca204bce58 (patch)
treeda24f71cfff5d4eeefee0f70c43f6d217819e5b7 /tests/common.convert
parent99340c2ef762f3da92e4bb4ce3b2f6d5fc6ef9d0 (diff)
btrfs-progs: tests: add support for converting reiserfs
Many of the test cases for convert apply regardless of what the source file system is and using ext4 is sufficient. I've included several test cases that are reiserfs-specific. Signed-off-by: Jeff Mahoney <jeffm@suse.com> [ patch split from the previous one, minor cleanups in common.convert ] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests/common.convert')
-rw-r--r--tests/common.convert19
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/common.convert b/tests/common.convert
index 2c19a4be..1d98cda1 100644
--- a/tests/common.convert
+++ b/tests/common.convert
@@ -50,7 +50,7 @@ convert_test_preamble() {
msg="$2"
shift 3
echo " [TEST/conv] $msg, btrfs" "${features:-defaults}"
- echo "creating ext image with: $@" >> "$RESULTS"
+ echo "creating test image with: $@" >> "$RESULTS"
}
# prepare TEST_DEV before conversion, create filesystem and mount it, image
@@ -59,6 +59,8 @@ convert_test_preamble() {
# $2+: free form, command to create the filesystem, with appended -F
convert_test_prep_fs() {
local fstype
+ local force
+ local mountopts
fstype="$1"
shift
@@ -67,10 +69,21 @@ convert_test_prep_fs() {
run_check truncate -s 0 "$TEST_DEV"
# 256MB is the smallest acceptable btrfs image.
run_check truncate -s 512M "$TEST_DEV"
- run_check "$@" -F "$TEST_DEV"
+ force=
+ mountopts=
+ case "$fstype" in
+ ext[234])
+ force=-F ;;
+ reiserfs)
+ force=-ff
+ mountopts="-o acl,user_xattr,attrs" ;;
+ *)
+ _fail "unknown filesystem to convert: $fstype"
+ esac
+ run_check "$@" $force "$TEST_DEV"
# create a file to check btrfs-convert can convert regular file correct
- run_check_mount_convert_dev "$fstype"
+ run_check_mount_convert_dev "$fstype" $mountopts
# create a file inside the fs before convert, to make sure there is
# data covering btrfs backup superblock range (64M)