| 1 |
test_description="create/convert raw/qcow2 images" |
| 2 |
if test -x $E2IMAGE_EXE; then |
| 3 |
|
| 4 |
ORIG_IMAGES="image1024.orig image2048.orig image4096.orig" |
| 5 |
|
| 6 |
RAW_IMG=_image.raw |
| 7 |
QCOW2_IMG=_image.qcow2 |
| 8 |
QCOW2_TO_RAW=_image.qcow2.raw |
| 9 |
OUT=$test_name.log |
| 10 |
CRC=$SRCDIR/$test_name/$test_name.crc |
| 11 |
CRC_TMP=$test_name.crc.tmp |
| 12 |
|
| 13 |
rm -f $CRC_TMP $OUT >/dev/null 2>&1 |
| 14 |
|
| 15 |
( |
| 16 |
for i in $ORIG_IMAGES; do |
| 17 |
ORIG_IMG=$test_name/$i |
| 18 |
echo $ORIG_IMG >> $CRC_TMP |
| 19 |
|
| 20 |
IMAGE=$(mktemp ${TMPDIR:-/tmp}/$i.XXXXXX) |
| 21 |
RAW_IMG="${IMAGE}.raw" |
| 22 |
QCOW2_IMG="${IMAGE}.qcow2" |
| 23 |
QCOW2_TO_RAW="${IMAGE}.qcow2.raw" |
| 24 |
|
| 25 |
bunzip2 < $SRCDIR/$ORIG_IMG.bz2 > $IMAGE |
| 26 |
echo "image $($CRCSUM $IMAGE)" >> $CRC_TMP |
| 27 |
|
| 28 |
rm -f $RAW_IMG |
| 29 |
echo "e2image -r $ORIG_IMG $RAW_IMG" |
| 30 |
$E2IMAGE -r $IMAGE $RAW_IMG |
| 31 |
echo "raw_image $($CRCSUM $RAW_IMG)" >> $CRC_TMP |
| 32 |
|
| 33 |
echo "e2image -Q $ORIG_IMG $QCOW2_IMG" |
| 34 |
$E2IMAGE -Q $IMAGE $QCOW2_IMG |
| 35 |
echo "qcow_image $($CRCSUM $QCOW2_IMG)" >> $CRC_TMP |
| 36 |
|
| 37 |
rm -f $QCOW2_TO_RAW |
| 38 |
echo "e2image -r $QCOW2_IMG $QCOW2_TO_RAW" |
| 39 |
$E2IMAGE -r $QCOW2_IMG $QCOW2_TO_RAW |
| 40 |
echo "qcow_to_raw $($CRCSUM $QCOW2_TO_RAW)" >> $CRC_TMP |
| 41 |
|
| 42 |
rm -f $IMAGE $RAW_IMG $QCOW2_IMG $QCOW2_TO_RAW |
| 43 |
done |
| 44 |
) >> $OUT 2>&1 |
| 45 |
|
| 46 |
echo "checksum:" >> $OUT |
| 47 |
cat $CRC_TMP >> $OUT |
| 48 |
echo "" >> $OUT |
| 49 |
|
| 50 |
diff $CRC $CRC_TMP >> $OUT 2>&1 |
| 51 |
|
| 52 |
if [ $? -eq 0 ]; then |
| 53 |
echo "$test_name: $test_description: ok" |
| 54 |
touch $test_name.ok |
| 55 |
else |
| 56 |
ln -f $test_name.log $test_name.failed |
| 57 |
echo "$test_name: $test_description: failed" |
| 58 |
fi |
| 59 |
|
| 60 |
rm -f $CRC_TMP >/dev/null 2>&1 |
| 61 |
|
| 62 |
else #if test -x $E2IMAGE_EXE; then |
| 63 |
echo "$test_name: $test_description: skipped" |
| 64 |
fi |