111a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash 2*9dd003a9SVladimir Sementsov-Ogievskiy# group: rw auto quick 3f4e732a0SMax Reitz# 4f4e732a0SMax Reitz# Test that qemu-img convert -S 0 fully allocates the target image 5f4e732a0SMax Reitz# 6f4e732a0SMax Reitz# Copyright (C) 2016 Red Hat, Inc. 7f4e732a0SMax Reitz# 8f4e732a0SMax Reitz# This program is free software; you can redistribute it and/or modify 9f4e732a0SMax Reitz# it under the terms of the GNU General Public License as published by 10f4e732a0SMax Reitz# the Free Software Foundation; either version 2 of the License, or 11f4e732a0SMax Reitz# (at your option) any later version. 12f4e732a0SMax Reitz# 13f4e732a0SMax Reitz# This program is distributed in the hope that it will be useful, 14f4e732a0SMax Reitz# but WITHOUT ANY WARRANTY; without even the implied warranty of 15f4e732a0SMax Reitz# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16f4e732a0SMax Reitz# GNU General Public License for more details. 17f4e732a0SMax Reitz# 18f4e732a0SMax Reitz# You should have received a copy of the GNU General Public License 19f4e732a0SMax Reitz# along with this program. If not, see <http://www.gnu.org/licenses/>. 20f4e732a0SMax Reitz# 21f4e732a0SMax Reitz 22f4e732a0SMax Reitz# creator 23f4e732a0SMax Reitzowner=mreitz@redhat.com 24f4e732a0SMax Reitz 25f4e732a0SMax Reitzseq="$(basename $0)" 26f4e732a0SMax Reitzecho "QA output created by $seq" 27f4e732a0SMax Reitz 28f4e732a0SMax Reitzstatus=1 # failure is the default! 29f4e732a0SMax Reitz 30f4e732a0SMax Reitz_cleanup() 31f4e732a0SMax Reitz{ 32f4e732a0SMax Reitz _cleanup_test_img 33f4e732a0SMax Reitz} 34f4e732a0SMax Reitztrap "_cleanup; exit \$status" 0 1 2 3 15 35f4e732a0SMax Reitz 36f4e732a0SMax Reitz# get standard environment, filters and checks 37f4e732a0SMax Reitz. ./common.rc 38f4e732a0SMax Reitz. ./common.filter 39f4e732a0SMax Reitz 401fd06db0SMax Reitz_supported_fmt raw qcow2 41f4e732a0SMax Reitz_supported_proto file 42f4e732a0SMax Reitz_supported_os Linux 43f4e732a0SMax Reitz 44f4e732a0SMax Reitz 45f4e732a0SMax Reitzimg_size=1048576 46f4e732a0SMax Reitz 47f4e732a0SMax Reitz 48f4e732a0SMax Reitzecho 491fd06db0SMax Reitzecho '=== Mapping sparse conversion ===' 50f4e732a0SMax Reitzecho 51f4e732a0SMax Reitz 52f4e732a0SMax Reitz$QEMU_IMG_PROG convert -O "$IMGFMT" -S 512 \ 53f4e732a0SMax Reitz "json:{ 'driver': 'null-co', 'size': $img_size, 'read-zeroes': true }" \ 54f4e732a0SMax Reitz "$TEST_IMG" 55f4e732a0SMax Reitz 561fd06db0SMax Reitz$QEMU_IMG map "$TEST_IMG" | _filter_qemu_img_map 57f4e732a0SMax Reitz 58f4e732a0SMax Reitz 59f4e732a0SMax Reitzecho 601fd06db0SMax Reitzecho '=== Mapping non-sparse conversion ===' 61f4e732a0SMax Reitzecho 62f4e732a0SMax Reitz 63f4e732a0SMax Reitz$QEMU_IMG convert -O "$IMGFMT" -S 0 \ 64f4e732a0SMax Reitz "json:{ 'driver': 'null-co', 'size': $img_size, 'read-zeroes': true }" \ 65f4e732a0SMax Reitz "$TEST_IMG" 66f4e732a0SMax Reitz 671fd06db0SMax Reitz$QEMU_IMG map "$TEST_IMG" | _filter_qemu_img_map 68f4e732a0SMax Reitz 69f4e732a0SMax Reitz 70f4e732a0SMax Reitz# success, all done 71f4e732a0SMax Reitzecho "*** done" 72f4e732a0SMax Reitzrm -f $seq.full 73f4e732a0SMax Reitzstatus=0 74