aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFederico Simoncelli <fsimonce@redhat.com>2013-01-28 06:59:46 -0500
committerKevin Wolf <kwolf@redhat.com>2013-02-22 21:21:08 +0100
commitc6bb9ad198c2caa9c7c8ba360a07630b5c10e4a8 (patch)
treefb7d050ec41a145e93d9a677c4136e880879fc59 /tests
parent5cbb08283789caf7dbfd0890dcff47124ad766c2 (diff)
qemu-img: find the image end offset during check
This patch adds the support for reporting the image end offset (in bytes). This is particularly useful after a conversion (or a rebase) where the destination is a block device in order to find the first unused byte at the end of the image. Signed-off-by: Federico Simoncelli <fsimonce@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/qemu-iotests/0266
-rwxr-xr-xtests/qemu-iotests/0363
-rwxr-xr-xtests/qemu-iotests/0392
-rw-r--r--tests/qemu-iotests/044.out1
-rw-r--r--tests/qemu-iotests/common.rc7
5 files changed, 11 insertions, 8 deletions
diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026
index 1602ccd2a5..107a3ff2f6 100755
--- a/tests/qemu-iotests/026
+++ b/tests/qemu-iotests/026
@@ -102,7 +102,7 @@ if [ "$event" == "l2_load" ]; then
$QEMU_IO -c "read $vmstate 0 128k " $BLKDBG_TEST_IMG | _filter_qemu_io
fi
-$QEMU_IMG check $TEST_IMG 2>&1 | grep -v "refcount=1 reference=0"
+_check_test_img 2>&1 | grep -v "refcount=1 reference=0"
done
done
@@ -147,7 +147,7 @@ echo
echo "Event: $event; errno: $errno; imm: $imm; once: $once; write $vmstate"
$QEMU_IO -c "write $vmstate 0 64M" $BLKDBG_TEST_IMG | _filter_qemu_io
-$QEMU_IMG check $TEST_IMG 2>&1 | grep -v "refcount=1 reference=0"
+_check_test_img 2>&1 | grep -v "refcount=1 reference=0"
done
done
@@ -186,7 +186,7 @@ echo
echo "Event: $event; errno: $errno; imm: $imm; once: $once"
$QEMU_IO -c "write -b 0 64k" $BLKDBG_TEST_IMG | _filter_qemu_io
-$QEMU_IMG check $TEST_IMG 2>&1 | grep -v "refcount=1 reference=0"
+_check_test_img 2>&1 | grep -v "refcount=1 reference=0"
done
done
diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
index 329533e9ea..4dbfc5724c 100755
--- a/tests/qemu-iotests/036
+++ b/tests/qemu-iotests/036
@@ -59,7 +59,8 @@ _make_test_img 64M
echo
echo === Repair image ===
echo
-$QEMU_IMG check -r all $TEST_IMG
+_check_test_img -r all
+
./qcow2.py $TEST_IMG dump-header
# success, all done
diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039
index c5ae806ecb..ae3517575c 100755
--- a/tests/qemu-iotests/039
+++ b/tests/qemu-iotests/039
@@ -86,7 +86,7 @@ $QEMU_IO -r -c "read -P 0x5a 0 512" $TEST_IMG | _filter_qemu_io
echo
echo "== Repairing the image file must succeed =="
-$QEMU_IMG check -r all $TEST_IMG
+_check_test_img -r all
# The dirty bit must not be set
./qcow2.py $TEST_IMG dump-header | grep incompatible_features
diff --git a/tests/qemu-iotests/044.out b/tests/qemu-iotests/044.out
index 7a4007137d..9c4867329f 100644
--- a/tests/qemu-iotests/044.out
+++ b/tests/qemu-iotests/044.out
@@ -1,4 +1,5 @@
No errors were found on the image.
+Image end offset: 4296447488
.
----------------------------------------------------------------------
Ran 1 tests
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index aef5f52b4f..5ba960b09f 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -161,9 +161,10 @@ _cleanup_test_img()
_check_test_img()
{
- $QEMU_IMG check -f $IMGFMT $TEST_IMG 2>&1 | \
- grep -v "fragmented$" | \
- sed -e 's/qemu-img\: This image format does not support checks/No errors were found on the image./'
+ $QEMU_IMG check "$@" -f $IMGFMT $TEST_IMG 2>&1 | \
+ sed -e "/fragmented$/d" \
+ -e 's/qemu-img: This image format does not support checks/No errors were found on the image./' \
+ -e '/Image end offset: [0-9]\+/d'
}
_img_info()