958e1b
From a1c05e91f427ee06521bdda8013091753736781f Mon Sep 17 00:00:00 2001
958e1b
From: Jeffrey Cody <jcody@redhat.com>
958e1b
Date: Tue, 16 Sep 2014 20:11:54 +0200
958e1b
Subject: [PATCH 16/20] block: iotest - update 084 to test static VDI image creation
958e1b
958e1b
Message-id: <179b35695a0f8dc312f7963cb818c630bcea84c7.1410897407.git.jcody@redhat.com>
958e1b
Patchwork-id: 61220
958e1b
O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 15/15] block: iotest - update 084 to test static VDI image creation
958e1b
Bugzilla: 1098086
958e1b
RH-Acked-by: Fam Zheng <famz@redhat.com>
958e1b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
958e1b
RH-Acked-by: Max Reitz <mreitz@redhat.com>
958e1b
958e1b
This updates the VDI corruption test to also test static VDI image
958e1b
creation, as well as the default dynamic image creation.
958e1b
958e1b
Reviewed-by: Max Reitz <mreitz@redhat.com>
958e1b
Signed-off-by: Jeff Cody <jcody@redhat.com>
958e1b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
958e1b
(cherry picked from commit 23d20b5b4fb7bde102e6779b7a13b88375e4db66)
958e1b
958e1b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
---
958e1b
 tests/qemu-iotests/084     |   16 ++++++++++++++--
958e1b
 tests/qemu-iotests/084.out |   14 ++++++++++++++
958e1b
 2 files changed, 28 insertions(+), 2 deletions(-)
958e1b
958e1b
diff --git a/tests/qemu-iotests/084 b/tests/qemu-iotests/084
958e1b
index 10a5a65..66ebcc3 100755
958e1b
--- a/tests/qemu-iotests/084
958e1b
+++ b/tests/qemu-iotests/084
958e1b
@@ -1,6 +1,7 @@
958e1b
 #!/bin/bash
958e1b
 #
958e1b
-# Test case for VDI header corruption; image too large, and too many blocks
958e1b
+# Test case for VDI header corruption; image too large, and too many blocks.
958e1b
+# Also simple test for creating dynamic and static VDI images.
958e1b
 #
958e1b
 # Copyright (C) 2013 Red Hat, Inc.
958e1b
 #
958e1b
@@ -43,14 +44,25 @@ _supported_fmt vdi
958e1b
 _supported_proto generic
958e1b
 _supported_os Linux
958e1b
 
958e1b
+size=64M
958e1b
 ds_offset=368  # disk image size field offset
958e1b
 bs_offset=376  # block size field offset
958e1b
 bii_offset=384 # block in image field offset
958e1b
 
958e1b
 echo
958e1b
+echo "=== Statically allocated image creation ==="
958e1b
+echo
958e1b
+_make_test_img $size -o static
958e1b
+_img_info
958e1b
+stat -c"disk image file size in bytes: %s" "${TEST_IMG}"
958e1b
+_cleanup_test_img
958e1b
+
958e1b
+echo
958e1b
 echo "=== Testing image size bounds ==="
958e1b
 echo
958e1b
-_make_test_img 64M
958e1b
+_make_test_img $size
958e1b
+_img_info
958e1b
+stat -c"disk image file size in bytes: %s" "${TEST_IMG}"
958e1b
 
958e1b
 # check for image size too large
958e1b
 # poke max image size, and appropriate blocks_in_image value
958e1b
diff --git a/tests/qemu-iotests/084.out b/tests/qemu-iotests/084.out
958e1b
index 99c8e74..943888a 100644
958e1b
--- a/tests/qemu-iotests/084.out
958e1b
+++ b/tests/qemu-iotests/084.out
958e1b
@@ -1,8 +1,22 @@
958e1b
 QA output created by 084
958e1b
 
958e1b
+=== Statically allocated image creation ===
958e1b
+
958e1b
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 
958e1b
+image: TEST_DIR/t.IMGFMT
958e1b
+file format: IMGFMT
958e1b
+virtual size: 64M (67108864 bytes)
958e1b
+cluster_size: 1048576
958e1b
+disk image file size in bytes: 67109888
958e1b
+
958e1b
 === Testing image size bounds ===
958e1b
 
958e1b
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 
958e1b
+image: TEST_DIR/t.IMGFMT
958e1b
+file format: IMGFMT
958e1b
+virtual size: 64M (67108864 bytes)
958e1b
+cluster_size: 1048576
958e1b
+disk image file size in bytes: 1024
958e1b
 Test 1: Maximum size (1024 TB):
958e1b
 image: TEST_DIR/t.IMGFMT
958e1b
 file format: IMGFMT
958e1b
-- 
958e1b
1.7.1
958e1b