From: Theodore Ts'o Date: Sun, 24 Jun 2018 22:30:50 +0000 (-0400) Subject: tests: fix i_qcow test to properly test e2image's qcow-to-raw functionality X-Git-Tag: v1.44.3-rc1~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0790bf05a255d9cfdeaf0637e2a1a6072134b4a7;p=thirdparty%2Fe2fsprogs.git tests: fix i_qcow test to properly test e2image's qcow-to-raw functionality The test script was not properly checking e2image's ability to convert a qcow2 image back to a raw image. Fix this, and also change it to use /tmp for the temporary files to speed things up systems with a ramdisk for /tmp. Signed-off-by: Theodore Ts'o --- diff --git a/tests/i_qcow/i_qcow.crc b/tests/i_qcow/i_qcow.crc index 00e5e6fbd..8591ae4ea 100644 --- a/tests/i_qcow/i_qcow.crc +++ b/tests/i_qcow/i_qcow.crc @@ -1,15 +1,15 @@ i_qcow/image1024.orig -2161078647 image1024.orig -467277198 _image.raw -2164212449 _image.qcow2 -467277198 _image.qcow2.raw +image 2161078647 +raw_image 467277198 +qcow_image 2164212449 +qcow_to_raw 467277198 i_qcow/image2048.orig -672740642 image2048.orig -3688408350 _image.raw -3821412753 _image.qcow2 -3688408350 _image.qcow2.raw +image 672740642 +raw_image 3688408350 +qcow_image 3821412753 +qcow_to_raw 3688408350 i_qcow/image4096.orig -4077552412 image4096.orig -4159471388 _image.raw -636354894 _image.qcow2 -4159471388 _image.qcow2.raw +image 4077552412 +raw_image 4159471388 +qcow_image 636354894 +qcow_to_raw 4159471388 diff --git a/tests/i_qcow/script b/tests/i_qcow/script index c5b06666c..6bf995edf 100644 --- a/tests/i_qcow/script +++ b/tests/i_qcow/script @@ -10,31 +10,36 @@ OUT=$test_name.log CRC=$SRCDIR/$test_name/$test_name.crc CRC_TMP=$test_name.crc.tmp -rm -f $test_name/_image.* $CRC_TMP $OUT >/dev/null 2>&1 +rm -f $CRC_TMP $OUT >/dev/null 2>&1 ( for i in $ORIG_IMAGES; do ORIG_IMG=$test_name/$i echo $ORIG_IMG >> $CRC_TMP - bunzip2 < $SRCDIR/$ORIG_IMG.bz2 > $i - echo "$($CRCSUM $i) $i" >> $CRC_TMP + IMAGE=$(mktemp ${TMPDIR:-/tmp}/$i.XXXXXX) + RAW_IMG="${IMAGE}.raw" + QCOW2_IMG="${IMAGE}.qcow2" + QCOW2_TO_RAW="${IMAGE}.qcow2.raw" + + bunzip2 < $SRCDIR/$ORIG_IMG.bz2 > $IMAGE + echo "image $($CRCSUM $IMAGE)" >> $CRC_TMP rm -f $RAW_IMG echo "e2image -r $ORIG_IMG $RAW_IMG" - $E2IMAGE -r $i $RAW_IMG - echo "$($CRCSUM $RAW_IMG) $RAW_IMG" >> $CRC_TMP + $E2IMAGE -r $IMAGE $RAW_IMG + echo "raw_image $($CRCSUM $RAW_IMG)" >> $CRC_TMP echo "e2image -Q $ORIG_IMG $QCOW2_IMG" - $E2IMAGE -Q $i $QCOW2_IMG - echo "$($CRCSUM $QCOW2_IMG) $QCOW2_IMG" >> $CRC_TMP + $E2IMAGE -Q $IMAGE $QCOW2_IMG + echo "qcow_image $($CRCSUM $QCOW2_IMG)" >> $CRC_TMP rm -f $QCOW2_TO_RAW echo "e2image -r $QCOW2_IMG $QCOW2_TO_RAW" - $E2IMAGE -r $i $QCOW2_TO_RAW - echo "$($CRCSUM $QCOW2_TO_RAW) $QCOW2_TO_RAW" >> $CRC_TMP + $E2IMAGE -r $QCOW2_IMG $QCOW2_TO_RAW + echo "qcow_to_raw $($CRCSUM $QCOW2_TO_RAW)" >> $CRC_TMP - rm -f $i + rm -f $IMAGE $RAW_IMG $QCOW2_IMG $QCOW2_TO_RAW done ) >> $OUT 2>&1 @@ -52,7 +57,7 @@ else echo "$test_name: $test_description: failed" fi -rm -f _image.* $CRC_TMP >/dev/null 2>&1 +rm -f $CRC_TMP >/dev/null 2>&1 else #if test -x $E2IMAGE_EXE; then echo "$test_name: $test_description: skipped"