summaryrefslogtreecommitdiff
path: root/tests/convert-tests
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2016-07-26 13:24:39 +0100
committerDimitri John Ledkov <xnox@ubuntu.com>2016-07-26 13:24:39 +0100
commit3d69435ee3292b4b1db2d61c4784789d75883821 (patch)
tree2c0edc9d9501374799875af36259089feb99d48c /tests/convert-tests
Imported Upstream version 4.6.1
Diffstat (limited to 'tests/convert-tests')
-rwxr-xr-xtests/convert-tests/001-ext2-basic/test.sh16
-rwxr-xr-xtests/convert-tests/002-ext3-basic/test.sh16
-rwxr-xr-xtests/convert-tests/003-ext4-basic/test.sh16
-rw-r--r--tests/convert-tests/004-ext2-backup-superblock-ranges/drdhdhdrd.e2image.raw.xzbin0 -> 84564 bytes
-rw-r--r--tests/convert-tests/004-ext2-backup-superblock-ranges/drdhdhrh.e2image.raw.xzbin0 -> 84568 bytes
-rw-r--r--tests/convert-tests/004-ext2-backup-superblock-ranges/hrhdhdrd.e2image.raw.xzbin0 -> 84556 bytes
-rw-r--r--tests/convert-tests/004-ext2-backup-superblock-ranges/hrhdhrh.e2image.raw.xzbin0 -> 84568 bytes
-rwxr-xr-xtests/convert-tests/004-ext2-backup-superblock-ranges/test.sh43
-rwxr-xr-xtests/convert-tests/005-delete-all-rollback/test.sh61
9 files changed, 152 insertions, 0 deletions
diff --git a/tests/convert-tests/001-ext2-basic/test.sh b/tests/convert-tests/001-ext2-basic/test.sh
new file mode 100755
index 00000000..8f4f935d
--- /dev/null
+++ b/tests/convert-tests/001-ext2-basic/test.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+source $TOP/tests/common
+source $TOP/tests/common.convert
+
+setup_root_helper
+prepare_test_dev 512M
+check_prereq btrfs-convert
+
+for feature in '' 'extref' 'skinny-metadata' 'no-holes'; do
+ convert_test "$feature" "ext2 4k nodesize" 4096 mke2fs -b 4096
+ convert_test "$feature" "ext2 8k nodesize" 8192 mke2fs -b 4096
+ convert_test "$feature" "ext2 16k nodesize" 16384 mke2fs -b 4096
+ convert_test "$feature" "ext2 32k nodesize" 32768 mke2fs -b 4096
+ convert_test "$feature" "ext2 64k nodesize" 65536 mke2fs -b 4096
+done
diff --git a/tests/convert-tests/002-ext3-basic/test.sh b/tests/convert-tests/002-ext3-basic/test.sh
new file mode 100755
index 00000000..aeb111eb
--- /dev/null
+++ b/tests/convert-tests/002-ext3-basic/test.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+source $TOP/tests/common
+source $TOP/tests/common.convert
+
+setup_root_helper
+prepare_test_dev 512M
+check_prereq btrfs-convert
+
+for feature in '' 'extref' 'skinny-metadata' 'no-holes'; do
+ convert_test "$feature" "ext3 4k nodesize" 4096 mke2fs -j -b 4096
+ convert_test "$feature" "ext3 8k nodesize" 8192 mke2fs -j -b 4096
+ convert_test "$feature" "ext3 16k nodesize" 16384 mke2fs -j -b 4096
+ convert_test "$feature" "ext3 32k nodesize" 32768 mke2fs -j -b 4096
+ convert_test "$feature" "ext3 64k nodesize" 65536 mke2fs -j -b 4096
+done
diff --git a/tests/convert-tests/003-ext4-basic/test.sh b/tests/convert-tests/003-ext4-basic/test.sh
new file mode 100755
index 00000000..531c81bd
--- /dev/null
+++ b/tests/convert-tests/003-ext4-basic/test.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+source $TOP/tests/common
+source $TOP/tests/common.convert
+
+setup_root_helper
+prepare_test_dev 512M
+check_prereq btrfs-convert
+
+for feature in '' 'extref' 'skinny-metadata' 'no-holes'; do
+ convert_test "$feature" "ext4 4k nodesize" 4096 mke2fs -t ext4 -b 4096
+ convert_test "$feature" "ext4 8k nodesize" 8192 mke2fs -t ext4 -b 4096
+ convert_test "$feature" "ext4 16k nodesize" 16384 mke2fs -t ext4 -b 4096
+ convert_test "$feature" "ext4 32k nodesize" 32768 mke2fs -t ext4 -b 4096
+ convert_test "$feature" "ext4 64k nodesize" 65536 mke2fs -t ext4 -b 4096
+done
diff --git a/tests/convert-tests/004-ext2-backup-superblock-ranges/drdhdhdrd.e2image.raw.xz b/tests/convert-tests/004-ext2-backup-superblock-ranges/drdhdhdrd.e2image.raw.xz
new file mode 100644
index 00000000..73e2309c
--- /dev/null
+++ b/tests/convert-tests/004-ext2-backup-superblock-ranges/drdhdhdrd.e2image.raw.xz
Binary files differ
diff --git a/tests/convert-tests/004-ext2-backup-superblock-ranges/drdhdhrh.e2image.raw.xz b/tests/convert-tests/004-ext2-backup-superblock-ranges/drdhdhrh.e2image.raw.xz
new file mode 100644
index 00000000..0d5442ff
--- /dev/null
+++ b/tests/convert-tests/004-ext2-backup-superblock-ranges/drdhdhrh.e2image.raw.xz
Binary files differ
diff --git a/tests/convert-tests/004-ext2-backup-superblock-ranges/hrhdhdrd.e2image.raw.xz b/tests/convert-tests/004-ext2-backup-superblock-ranges/hrhdhdrd.e2image.raw.xz
new file mode 100644
index 00000000..a1a30429
--- /dev/null
+++ b/tests/convert-tests/004-ext2-backup-superblock-ranges/hrhdhdrd.e2image.raw.xz
Binary files differ
diff --git a/tests/convert-tests/004-ext2-backup-superblock-ranges/hrhdhrh.e2image.raw.xz b/tests/convert-tests/004-ext2-backup-superblock-ranges/hrhdhrh.e2image.raw.xz
new file mode 100644
index 00000000..ac0dbc60
--- /dev/null
+++ b/tests/convert-tests/004-ext2-backup-superblock-ranges/hrhdhrh.e2image.raw.xz
Binary files differ
diff --git a/tests/convert-tests/004-ext2-backup-superblock-ranges/test.sh b/tests/convert-tests/004-ext2-backup-superblock-ranges/test.sh
new file mode 100755
index 00000000..d85e4de4
--- /dev/null
+++ b/tests/convert-tests/004-ext2-backup-superblock-ranges/test.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+# Specially created e2image dump to test backup superblock migration for
+# new convert.
+# These images will cause the following problems if convert doesn't handle
+# backup superblock migration well:
+# 1) Assert while building free space tree
+# 2) Error copying inodes
+# 3) Discontinuous file extents after convert
+# 4) Overlap file extents
+# 5) Unable to rollback
+
+source $TOP/tests/common
+
+check_prereq btrfs-convert
+check_prereq btrfs
+check_prereq btrfs-show-super
+check_global_prereq e2fsck
+check_global_prereq xzcat
+
+setup_root_helper
+prepare_test_dev 512M
+
+# override common function
+function check_image() {
+ TEST_DEV="$1"
+ run_check e2fsck -n -f $TEST_DEV
+ run_check $TOP/btrfs-convert $TEST_DEV
+ run_check $TOP/btrfs check $TEST_DEV
+ run_check $TOP/btrfs-show-super $TEST_DEV
+
+ run_check_mount_test_dev
+ run_check $SUDO_HELPER e2fsck -n -f $TEST_MNT/ext2_saved/image
+ run_check $SUDO_HELPER umount $TEST_MNT
+
+ run_check $TOP/btrfs check $TEST_DEV
+ run_check $TOP/btrfs-convert -r $TEST_DEV
+ run_check e2fsck -n -f $TEST_DEV
+
+ rm -f $TEST_DEV
+}
+
+check_all_images
diff --git a/tests/convert-tests/005-delete-all-rollback/test.sh b/tests/convert-tests/005-delete-all-rollback/test.sh
new file mode 100755
index 00000000..d498e5f8
--- /dev/null
+++ b/tests/convert-tests/005-delete-all-rollback/test.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# create a base image, convert to btrfs, remove all files, rollback the ext4 image
+# note: ext4 only
+
+source $TOP/tests/common
+source $TOP/tests/common.convert
+
+setup_root_helper
+prepare_test_dev 512M
+check_prereq btrfs-convert
+
+# simple wrapper for a convert test
+# $1: btrfs features, argument to -O
+# $2: message
+# $3: nodesize value
+# $4 + rest: command to create the ext2 image
+do_test() {
+ local features
+ local msg
+ local nodesize
+ local CHECKSUMTMP
+ local here
+
+ features="$1"
+ msg="$2"
+ nodesize="$3"
+ shift 3
+ convert_test_preamble "$features" "$msg" "$nodesize" "$@"
+ convert_test_prep_fs "$@"
+ populate_fs
+ CHECKSUMTMP=$(mktemp --tmpdir btrfs-progs-convert.XXXXXXXXXX)
+ convert_test_gen_checksums "$CHECKSUMTMP"
+
+ run_check_umount_test_dev
+
+ convert_test_do_convert "$features" "$nodesize"
+ convert_test_post_check "$CHECKSUMTMP"
+
+ run_check_mount_test_dev
+ here=$(pwd)
+ cd "$TEST_MNT" || _fail "cannot cd to TEST_MNT"
+ # ext2_saved/image must not be deleted
+ run_mayfail $SUDO_HELPER find "$TEST_MNT"/ -mindepth 1 -path '*ext2_saved' -prune -o -exec rm -vrf "{}" \;
+ cd "$here"
+ run_check $TOP/btrfs filesystem sync "$TEST_MNT"
+ run_check_umount_test_dev
+ convert_test_post_rollback
+ convert_test_post_check "$CHECKSUMTMP"
+
+ # mount again and verify checksums
+ convert_test_post_check "$CHECKSUMTMP"
+ rm "$CHECKSUMTMP"
+}
+
+for feature in '' 'extref' 'skinny-metadata' 'no-holes'; do
+ do_test "$feature" "ext4 4k nodesize" 4096 mke2fs -t ext4 -b 4096
+ do_test "$feature" "ext4 8k nodesize" 8192 mke2fs -t ext4 -b 4096
+ do_test "$feature" "ext4 16k nodesize" 16384 mke2fs -t ext4 -b 4096
+ do_test "$feature" "ext4 32k nodesize" 32768 mke2fs -t ext4 -b 4096
+ do_test "$feature" "ext4 64k nodesize" 65536 mke2fs -t ext4 -b 4096
+done