From 74d288e05c2d0cb97186f51049813b3e5b5bb0cd Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 18 Oct 2017 13:15:59 +0100 Subject: New upstream release. --- tests/common.convert | 49 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 5 deletions(-) (limited to 'tests/common.convert') diff --git a/tests/common.convert b/tests/common.convert index 2c19a4be..1be804cf 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) @@ -205,9 +218,21 @@ convert_test_post_checks_all() { } # do rollback and fsck +# $1: filesystem name or alias (ext2 includes ext3 and ext4), convert_test_post_rollback() { + local types + run_check "$TOP/btrfs-convert" --rollback "$TEST_DEV" - run_check fsck -n -t ext2,ext3,ext4 "$TEST_DEV" + if [ -z "$1" ]; then + _fail "missing filesystem type to check" + fi + case "$1" in + ext[234]) types=ext2,ext3,ext4 ;; + reiserfs) types=reiserfs ;; + *) _fail "unknown filesystem type to check: $1" ;; + esac + + run_check fsck -n -t "$types" "$TEST_DEV" } # simple wrapper for a convert test @@ -248,5 +273,19 @@ convert_test() { rm -- "$EXT_PERMTMP" rm -- "$EXT_ACLTMP" - convert_test_post_rollback + convert_test_post_rollback "$fstype" +} + +load_module_reiserfs() +{ + $SUDO_HELPER modprobe reiserfs +} + +check_kernel_support_reiserfs() +{ + if ! grep -iq 'reiserfs' /proc/filesystems; then + echo "WARNING: reiserfs filesystem not listed in /proc/filesystems, some tests might be skipped" + return 1 + fi + return 0 } -- cgit v1.2.3