summaryrefslogtreecommitdiff
path: root/tests/convert-tests
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2016-08-11 12:45:00 +0100
committerDimitri John Ledkov <xnox@ubuntu.com>2016-08-11 12:45:00 +0100
commitffd998be34a1a3d208106d051e85058ff9ac9667 (patch)
tree3f93a4a7362dcbdbadf5086e9404dc58ea22200a /tests/convert-tests
parent3d69435ee3292b4b1db2d61c4784789d75883821 (diff)
Imported Upstream version 4.7
Diffstat (limited to 'tests/convert-tests')
-rwxr-xr-xtests/convert-tests/006-large-hole-extent/test.sh23
-rwxr-xr-xtests/convert-tests/007-unsupported-block-sizes/test.sh21
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/convert-tests/006-large-hole-extent/test.sh b/tests/convert-tests/006-large-hole-extent/test.sh
new file mode 100755
index 00000000..d3bc093c
--- /dev/null
+++ b/tests/convert-tests/006-large-hole-extent/test.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+# Create a base image with large hole extent, then convert to btrfs,
+# check the converted image.
+# Check if btrfs-convert can handle such large hole.
+# Fast pinpoint regression test. No options combination nor checksum
+# verification
+
+source $TOP/tests/common
+source $TOP/tests/common.convert
+
+setup_root_helper
+prepare_test_dev 512M
+check_prereq btrfs-convert
+
+default_mke2fs="mke2fs -t ext4 -b 4096"
+convert_test_preamble '' 'large hole extent test' 16k "$default_mke2fs"
+convert_test_prep_fs $default_mke2fs
+
+run_check $SUDO_HELPER dd if=/dev/zero of=$TEST_MNT/file bs=1M \
+ count=1 seek=1024 > /dev/null 2>&1
+
+run_check_umount_test_dev
+convert_test_do_convert
diff --git a/tests/convert-tests/007-unsupported-block-sizes/test.sh b/tests/convert-tests/007-unsupported-block-sizes/test.sh
new file mode 100755
index 00000000..9ba17751
--- /dev/null
+++ b/tests/convert-tests/007-unsupported-block-sizes/test.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+# Check if block sizes smaller than 4k expectedly fail to convert
+
+source $TOP/tests/common
+source $TOP/tests/common.convert
+
+setup_root_helper
+prepare_test_dev 512M
+check_prereq btrfs-convert
+
+for bs in 1024 2048; do
+ default_mke2fs="mke2fs -t ext4 -b $bs"
+ convert_test_preamble '' "unsupported block size $bs" 16k "$default_mke2fs"
+ convert_test_prep_fs $default_mke2fs
+
+ run_check $SUDO_HELPER dd if=/dev/zero of=$TEST_MNT/file bs=1M \
+ count=1 seek=1024 > /dev/null 2>&1
+
+ run_check_umount_test_dev
+ run_mustfail "$bs block converted" $TOP/btrfs-convert $TEST_DEV
+done