[PATCH] tests: add raw/e2i/qcow2 image create/install test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Test raw, qcow2 and e2i image format creation and e2i install. We
iterate over ext2/ext3/ext4 file system type and 1k/2k/4k block sizes
just to make sure. The test is fast enough so it's ok.

Signed-off-by: Lukas Czerner <lczerner@xxxxxxxxxx>
---
 tests/i_images/expect | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/i_images/script |  76 ++++++++++++++++++++++++++++++++
 2 files changed, 193 insertions(+)
 create mode 100644 tests/i_images/expect
 create mode 100644 tests/i_images/script

diff --git a/tests/i_images/expect b/tests/i_images/expect
new file mode 100644
index 0000000..c5097d1
--- /dev/null
+++ b/tests/i_images/expect
@@ -0,0 +1,117 @@
+Create ext2 file system with block size 1024
+Create images
+Verify raw and qcow crc
+Dump metadata
+Check metadata dump - raw
+Check metadata dump - qcow2 to raw
+Check metadata dump - e2i
+Install image
+Verify metadata dump
+Create ext2 file system with block size 2014
+Create images
+Verify raw and qcow crc
+Dump metadata
+Check metadata dump - raw
+Check metadata dump - qcow2 to raw
+Check metadata dump - e2i
+Install image
+Verify metadata dump
+Create ext2 file system with block size 4096
+Create images
+Verify raw and qcow crc
+Dump metadata
+Check metadata dump - raw
+Check metadata dump - qcow2 to raw
+Check metadata dump - e2i
+Install image
+Verify metadata dump
+Create ext3 file system with block size 1024
+Create images
+Verify raw and qcow crc
+Dump metadata
+Check metadata dump - raw
+Check metadata dump - qcow2 to raw
+Check metadata dump - e2i
+41,45d40
+< Journal features:         (none)
+< Journal size:             1024k
+< Journal length:           1024
+< Journal sequence:         0x00000001
+< Journal start:            0
+Install image
+Verify metadata dump
+Create ext3 file system with block size 2014
+Create images
+Verify raw and qcow crc
+Dump metadata
+Check metadata dump - raw
+Check metadata dump - qcow2 to raw
+Check metadata dump - e2i
+41,45d40
+< Journal features:         (none)
+< Journal size:             1024k
+< Journal length:           1024
+< Journal sequence:         0x00000001
+< Journal start:            0
+Install image
+Verify metadata dump
+Create ext3 file system with block size 4096
+Create images
+Verify raw and qcow crc
+Dump metadata
+Check metadata dump - raw
+Check metadata dump - qcow2 to raw
+Check metadata dump - e2i
+40,44d39
+< Journal features:         (none)
+< Journal size:             4096k
+< Journal length:           1024
+< Journal sequence:         0x00000001
+< Journal start:            0
+Install image
+Verify metadata dump
+Create ext4 file system with block size 1024
+Create images
+Verify raw and qcow crc
+Dump metadata
+Check metadata dump - raw
+Check metadata dump - qcow2 to raw
+Check metadata dump - e2i
+43,47d42
+< Journal features:         (none)
+< Journal size:             1024k
+< Journal length:           1024
+< Journal sequence:         0x00000001
+< Journal start:            0
+Install image
+Verify metadata dump
+Create ext4 file system with block size 2014
+Create images
+Verify raw and qcow crc
+Dump metadata
+Check metadata dump - raw
+Check metadata dump - qcow2 to raw
+Check metadata dump - e2i
+43,47d42
+< Journal features:         (none)
+< Journal size:             1024k
+< Journal length:           1024
+< Journal sequence:         0x00000001
+< Journal start:            0
+Install image
+Verify metadata dump
+Create ext4 file system with block size 4096
+Create images
+Verify raw and qcow crc
+Dump metadata
+Check metadata dump - raw
+Check metadata dump - qcow2 to raw
+Check metadata dump - e2i
+42,46d41
+< Journal features:         (none)
+< Journal size:             4096k
+< Journal length:           1024
+< Journal sequence:         0x00000001
+< Journal start:            0
+Install image
+Verify metadata dump
diff --git a/tests/i_images/script b/tests/i_images/script
new file mode 100644
index 0000000..45369ec
--- /dev/null
+++ b/tests/i_images/script
@@ -0,0 +1,76 @@
+test_description="create/install raw/qcow2/metadata images"
+if test -x $E2IMAGE_EXE; then
+
+OUT=$test_name.log
+EXP=$test_dir/expect
+TMP=$(mktemp)
+
+rm -f ${TMP}* $OUT >/dev/null 2>&1
+
+(
+for fstype in ext2 ext3 ext4; do
+	for bs in 1024 2014 4096; do
+		ORIG_IMG=$test_name/orig_image_${bs}
+		rm -f $ORIG_IMG
+
+		echo "Create $fstype file system with block size $bs"
+		truncate -s10M $ORIG_IMG
+		$MKE2FS -q -E lazy_itable_init=1 -t $fstype -F -o Linux -b $bs $ORIG_IMG
+
+		echo "Create images"
+		$E2IMAGE $ORIG_IMG ${TMP}.e2i
+		$E2IMAGE -r $ORIG_IMG ${TMP}.raw
+		$E2IMAGE -Q $ORIG_IMG ${TMP}.qcow2
+		$E2IMAGE -r ${TMP}.qcow2 ${TMP}.qcow2raw
+
+		$CRCSUM ${TMP}.raw  > ${TMP}.crc.raw
+		$CRCSUM ${TMP}.qcow2raw  > ${TMP}.crc.qcow2raw
+
+		# Verify that raw image created from original fs and from qcow2 are
+		# the same
+		echo "Verify raw and qcow crc"
+		diff ${TMP}.crc.raw ${TMP}.crc.qcow2raw
+
+		echo "Dump metadata"
+		$DUMPE2FS $ORIG_IMG > ${TMP}.dump.orig
+		$DUMPE2FS ${TMP}.raw > ${TMP}.dump.raw
+		$DUMPE2FS ${TMP}.qcow2raw > ${TMP}.dump.qcow2raw
+		$DUMPE2FS -i ${TMP}.e2i > ${TMP}.dump.e2i
+
+		# Check the metedata dumps
+		echo "Check metadata dump - raw"
+		diff ${TMP}.dump.orig ${TMP}.dump.raw
+		echo "Check metadata dump - qcow2 to raw"
+		diff ${TMP}.dump.orig ${TMP}.dump.qcow2raw
+		echo "Check metadata dump - e2i"
+		diff ${TMP}.dump.orig ${TMP}.dump.e2i
+
+		echo "Install image"
+		cp $ORIG_IMG ${ORIG_IMG}.copy
+		$E2IMAGE -I ${ORIG_IMG}.copy ${TMP}.e2i
+		$DUMPE2FS ${ORIG_IMG} > ${TMP}.dump.copy
+
+		# Verify crc and meta dump
+		echo "Verify metadata dump"
+		diff ${TMP}.dump.orig ${TMP}.dump.copy
+
+		rm -f ${ORIG_IMG}* ${TMP}.* >/dev/null 2>&1
+	done
+done
+) 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT 2>&1
+
+cmp -s $OUT $EXP
+if [ $? -eq 0 ]; then
+        echo "$test_name: $test_description: ok"
+        touch $test_name.ok
+else
+        diff $DIFF_OPTS $EXP $OUT > $test_name.failed
+        echo "$test_name: $test_description: failed"
+fi
+
+rm -f ${TMP}* >/dev/null 2>&1
+
+else #if test -x $E2IMAGE_EXE; then
+        echo "$test_name: $test_description: skipped"
+fi
+
-- 
2.7.5




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux