v2v: ova: Further fix test cases.

Updates commit 7461a8fab1.
Fixes and partly reverts commit 8f91d3a9b0.
This commit is contained in:
Richard W.M. Jones
2017-02-10 12:54:56 +00:00
parent 2c340682b5
commit 0a8f95a222
6 changed files with 16 additions and 29 deletions

View File

@@ -54,22 +54,3 @@ do_sha256 ()
;;
esac
}
# Returns 0 if QEMU version is greater or equal to the arguments
qemu_is_version() {
if [ $# -ne 2 ] ; then
echo "Usage: $0 <major_version> <minor_version>" >&2
return 3
fi
[[ "$(qemu-img --version)" =~ 'qemu-img version '([0-9]+)\.([0-9]+) ]] || return 2
QMAJ=${BASH_REMATCH[1]}
QMIN=${BASH_REMATCH[2]}
if [ \( $QMAJ -gt $1 \) -o \( $QMAJ -eq $1 -a $QMIN -ge $2 \) ] ; then
return 0
fi
return 1
}

View File

@@ -59,7 +59,7 @@ $VG virt-v2v --debug-gc --quiet \
--print-source > $d/source
# Check the parsed source is what we expect.
if qemu_is_version 2 8 ; then
if grep -sq json: $d/source ; then
# Normalize the output.
# Remove directory prefix.
# Exact offset will vary because of tar.

View File

@@ -10,7 +10,7 @@ hypervisor type: vmware
video:
sound:
disks:
json:{ "file": { "driver": "raw", "offset": 9216, "size": 10240, "file": { "filename": "test-tar.ova" } } } (vmdk) [scsi]
json:{ "file": { "driver": "raw", "offset": x, "size": 10240, "file": { "filename": "test-tar.ova" } } } (vmdk) [scsi]
removable media:
CD-ROM [ide] in slot 0
NICs:

View File

@@ -58,9 +58,12 @@ $VG virt-v2v --debug-gc --quiet \
--print-source > $d/source
# Check the parsed source is what we expect.
if qemu_is_version 2 8 ; then
# normalize the output
sed -i -e "s,\"$d/,\"," $d/source
if grep -sq json: $d/source ; then
# Normalize the output.
# Remove directory prefix.
# Exact offset will vary because of tar.
sed -i -e "s,\"$d/,\"," \
-e "s|\"offset\": [0-9]*,|\"offset\": x,|" $d/source
diff -u test-v2v-i-ova-tar.expected2 $d/source
else
# normalize the output

View File

@@ -10,8 +10,8 @@ hypervisor type: vmware
video:
sound:
disks:
json:{ "file": { "driver": "raw", "offset": 9728, "size": 10240, "file": { "filename": "test.ova" } } } (vmdk) [scsi]
json:{ "file": { "driver": "raw", "offset": 21504, "size": 102400, "file": { "filename": "test.ova" } } } (vmdk) [scsi]
json:{ "file": { "driver": "raw", "offset": x, "size": 10240, "file": { "filename": "test.ova" } } } (vmdk) [scsi]
json:{ "file": { "driver": "raw", "offset": x, "size": 102400, "file": { "filename": "test.ova" } } } (vmdk) [scsi]
removable media:
CD-ROM [ide] in slot 0
NICs:

View File

@@ -63,9 +63,12 @@ $VG virt-v2v --debug-gc --quiet \
--print-source > $d/source
# Check the parsed source is what we expect.
if qemu_is_version 2 8 ; then
# normalize the output
sed -i -e "s,\"$d/,\"," $d/source
if grep -sq json: $d/source ; then
# Normalize the output.
# Remove directory prefix.
# Exact offset will vary because of tar.
sed -i -e "s,\"$d/,\"," \
-e "s|\"offset\": [0-9]*,|\"offset\": x,|" $d/source
diff -u test-v2v-i-ova-two-disks.expected2 $d/source
else
# normalize the output