aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLukas Czerner <lczerner@redhat.com>2011-05-18 13:36:55 +0200
committerTheodore Ts'o <tytso@mit.edu>2011-05-18 12:19:41 -0400
commit9e713505ab4216c1391a14aa86a7f49a6026aa46 (patch)
tree895734651b904fd3e9afa5f39aad0d91b61569d1 /tests
parent92dcfb7692da5c3ed61899c49c0915f889815c45 (diff)
downloade2fsprogs-9e713505ab4216c1391a14aa86a7f49a6026aa46.tar.gz
e2fsprogs-9e713505ab4216c1391a14aa86a7f49a6026aa46.tar.xz
e2fsprogs-9e713505ab4216c1391a14aa86a7f49a6026aa46.zip
tests: New i_e2image test to validate image creation/conversion
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/i_e2image/i_e2image.md515
-rw-r--r--tests/i_e2image/image1024.orig.bz2bin0 -> 322312 bytes
-rw-r--r--tests/i_e2image/image2048.orig.bz2bin0 -> 321388 bytes
-rw-r--r--tests/i_e2image/image4096.orig.bz2bin0 -> 312342 bytes
-rw-r--r--tests/i_e2image/script57
-rw-r--r--tests/test_config1
6 files changed, 73 insertions, 0 deletions
diff --git a/tests/i_e2image/i_e2image.md5 b/tests/i_e2image/i_e2image.md5
new file mode 100644
index 00000000..f96e7214
--- /dev/null
+++ b/tests/i_e2image/i_e2image.md5
@@ -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
index 00000000..ac90f861
--- /dev/null
+++ b/tests/i_e2image/image1024.orig.bz2
Binary files differ
diff --git a/tests/i_e2image/image2048.orig.bz2 b/tests/i_e2image/image2048.orig.bz2
new file mode 100644
index 00000000..18d07a8a
--- /dev/null
+++ b/tests/i_e2image/image2048.orig.bz2
Binary files differ
diff --git a/tests/i_e2image/image4096.orig.bz2 b/tests/i_e2image/image4096.orig.bz2
new file mode 100644
index 00000000..e17b5a35
--- /dev/null
+++ b/tests/i_e2image/image4096.orig.bz2
Binary files differ
diff --git a/tests/i_e2image/script b/tests/i_e2image/script
new file mode 100644
index 00000000..408eabec
--- /dev/null
+++ b/tests/i_e2image/script
@@ -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
diff --git a/tests/test_config b/tests/test_config
index 45130bad..3c757e33 100644
--- a/tests/test_config
+++ b/tests/test_config
@@ -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"