]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
tests: New i_e2image test to validate image creation/conversion
authorLukas Czerner <lczerner@redhat.com>
Wed, 18 May 2011 11:36:55 +0000 (13:36 +0200)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 18 May 2011 16:19:41 +0000 (12:19 -0400)
This commit adds new regression test called i_e2image which should
validate expected behaviour of e2image raw and qcow2 image creation
and qcow2 -> raw image conversion. You can run it with "make check" as
the rest of regression tests.

Testing is performed on three filesystem images with different block
sizes (1024, 2048, 4096). It creates raw and qcow2 images from the
original and then convert qcow2 image back to raw image. The results are
checksummed and compared with pre-prepared results. All md5sums should
stay the same and raw image created from original and qcow2 image should
be the same as well (just for the record).

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
tests/i_e2image/i_e2image.md5 [new file with mode: 0644]
tests/i_e2image/image1024.orig.bz2 [new file with mode: 0644]
tests/i_e2image/image2048.orig.bz2 [new file with mode: 0644]
tests/i_e2image/image4096.orig.bz2 [new file with mode: 0644]
tests/i_e2image/script [new file with mode: 0644]
tests/test_config

diff --git a/tests/i_e2image/i_e2image.md5 b/tests/i_e2image/i_e2image.md5
new file mode 100644 (file)
index 0000000..f96e721
--- /dev/null
@@ -0,0 +1,15 @@
+i_e2image/image1024.orig
+d34914e0da07bdae80ab02288118fae2  image1024.orig
+bbef4e50d7237546c7d9c521d3df5b68  _image.raw
+1d4eb39452bed097dcd2c5bcd57180e6  _image.qcow2
+bbef4e50d7237546c7d9c521d3df5b68  _image.qcow2.raw
+i_e2image/image2048.orig
+aa9f702de181188f2a6d2c5158686c09  image2048.orig
+e6f8410d0690ef551bee0c2c0c642d8c  _image.raw
+dbbd9aa97c6c946b9122586bbd2a325a  _image.qcow2
+e6f8410d0690ef551bee0c2c0c642d8c  _image.qcow2.raw
+i_e2image/image4096.orig
+1d3e7f15b2ce9ca07aa23c32951c5176  image4096.orig
+734119dd8f240a33704139f8cdd8127c  _image.raw
+85fdbf5a8451b24b36ab82a02196deb9  _image.qcow2
+734119dd8f240a33704139f8cdd8127c  _image.qcow2.raw
diff --git a/tests/i_e2image/image1024.orig.bz2 b/tests/i_e2image/image1024.orig.bz2
new file mode 100644 (file)
index 0000000..ac90f86
Binary files /dev/null and b/tests/i_e2image/image1024.orig.bz2 differ
diff --git a/tests/i_e2image/image2048.orig.bz2 b/tests/i_e2image/image2048.orig.bz2
new file mode 100644 (file)
index 0000000..18d07a8
Binary files /dev/null and b/tests/i_e2image/image2048.orig.bz2 differ
diff --git a/tests/i_e2image/image4096.orig.bz2 b/tests/i_e2image/image4096.orig.bz2
new file mode 100644 (file)
index 0000000..e17b5a3
Binary files /dev/null and b/tests/i_e2image/image4096.orig.bz2 differ
diff --git a/tests/i_e2image/script b/tests/i_e2image/script
new file mode 100644 (file)
index 0000000..408eabe
--- /dev/null
@@ -0,0 +1,57 @@
+printf "Create/convert raw and qcow2 disk images: "
+if test -x $E2IMAGE; then
+
+ORIG_IMAGES="image1024.orig image2048.orig image4096.orig"
+
+RAW_IMG=_image.raw
+QCOW2_IMG=_image.qcow2
+QCOW2_TO_RAW=_image.qcow2.raw
+OUT=$test_name.log
+MD5=$SRCDIR/$test_name/$test_name.md5
+MD5_TMP=$test_name.md5tmp
+
+rm -f $test_name/_image.* $MD5_TMP $OUT >/dev/null 2>&1
+
+(
+for i in $ORIG_IMAGES; do
+       ORIG_IMG=$test_name/$i
+       echo $ORIG_IMG >> $MD5_TMP
+
+       bunzip2 < $SRCDIR/$ORIG_IMG.bz2 > $i
+       md5sum $i >> $MD5_TMP
+
+       echo "e2image -r $ORIG_IMG $RAW_IMG"
+       $E2IMAGE      -r $i $RAW_IMG
+       md5sum $RAW_IMG >> $MD5_TMP
+
+       echo "e2image -Q $ORIG_IMG $QCOW2_IMG"
+       $E2IMAGE      -Q $i $QCOW2_IMG
+       md5sum $QCOW2_IMG >> $MD5_TMP
+
+       echo "e2image -r $QCOW2_IMG $QCOW2_TO_RAW"
+       $E2IMAGE      -r $i $QCOW2_TO_RAW
+       md5sum $QCOW2_TO_RAW >> $MD5_TMP
+
+       rm -f $i
+done
+) >> $OUT 2>&1
+
+echo "md5sums:" >> $OUT
+cat $MD5_TMP >> $OUT
+echo "" >> $OUT
+
+diff $MD5 $MD5_TMP >> $OUT 2>&1
+
+if [ $? -eq 0 ]; then
+       echo "ok"
+       touch $test_name.ok
+       rm -f $test_name.failed
+else
+       rm -f $test_name.ok
+       ln -f $test_name.log $test_name.failed
+       echo "failed"
+fi
+
+rm -f _image.* $MD5_TMP >/dev/null 2>&1
+
+fi
index 45130bad8d3b75b3c622fcf5f352faf5aec401b4..3c757e339ec1fb21dbba602d5ab5b9133298e980 100644 (file)
@@ -9,6 +9,7 @@ DUMPE2FS="$USE_VALGRIND ../misc/dumpe2fs"
 TUNE2FS="$USE_VALGRIND ../misc/tune2fs"
 CHATTR="$USE_VALGRIND../misc/chattr"
 LSATTR="$USE_VALGRIND ../misc/lsattr"
+E2IMAGE="$USE_VALGRIND ../misc/e2image"
 DEBUGFS="$USE_VALGRIND ../debugfs/debugfs"
 TEST_BITS="../debugfs/debugfs"
 RESIZE2FS_EXE="../resize/resize2fs"