• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1test_description="create/convert raw/qcow2 images"
2if test -x $E2IMAGE_EXE; then
3
4ORIG_IMAGES="image1024.orig image2048.orig image4096.orig"
5
6RAW_IMG=_image.raw
7QCOW2_IMG=_image.qcow2
8QCOW2_TO_RAW=_image.qcow2.raw
9OUT=$test_name.log
10CRC=$SRCDIR/$test_name/$test_name.crc
11CRC_TMP=$test_name.crc.tmp
12
13rm -f $CRC_TMP $OUT >/dev/null 2>&1
14
15(
16for 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
43done
44) >> $OUT 2>&1
45
46echo "checksum:" >> $OUT
47cat $CRC_TMP >> $OUT
48echo "" >> $OUT
49
50diff $CRC $CRC_TMP >> $OUT 2>&1
51
52if [ $? -eq 0 ]; then
53	echo "$test_name: $test_description: ok"
54	touch $test_name.ok
55else
56	ln -f $test_name.log $test_name.failed
57	echo "$test_name: $test_description: failed"
58fi
59
60rm -f $CRC_TMP >/dev/null 2>&1
61
62else #if test -x $E2IMAGE_EXE; then
63	echo "$test_name: $test_description: skipped"
64fi
65