111a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash 2b81b74bfSEric Blake# 3b81b74bfSEric Blake# qemu-img measure sub-command tests on huge qcow2 files 4b81b74bfSEric Blake# 5b81b74bfSEric Blake# Copyright (C) 2017 Red Hat, Inc. 6b81b74bfSEric Blake# 7b81b74bfSEric Blake# This program is free software; you can redistribute it and/or modify 8b81b74bfSEric Blake# it under the terms of the GNU General Public License as published by 9b81b74bfSEric Blake# the Free Software Foundation; either version 2 of the License, or 10b81b74bfSEric Blake# (at your option) any later version. 11b81b74bfSEric Blake# 12b81b74bfSEric Blake# This program is distributed in the hope that it will be useful, 13b81b74bfSEric Blake# but WITHOUT ANY WARRANTY; without even the implied warranty of 14b81b74bfSEric Blake# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15b81b74bfSEric Blake# GNU General Public License for more details. 16b81b74bfSEric Blake# 17b81b74bfSEric Blake# You should have received a copy of the GNU General Public License 18b81b74bfSEric Blake# along with this program. If not, see <http://www.gnu.org/licenses/>. 19b81b74bfSEric Blake# 20b81b74bfSEric Blake 21b81b74bfSEric Blake# creator 22b81b74bfSEric Blakeowner=eblake@redhat.com 23b81b74bfSEric Blake 24b81b74bfSEric Blakeseq=`basename $0` 25b81b74bfSEric Blakeecho "QA output created by $seq" 26b81b74bfSEric Blake 27b81b74bfSEric Blakestatus=1 # failure is the default! 28b81b74bfSEric Blake 29b81b74bfSEric Blake_cleanup() 30b81b74bfSEric Blake{ 31b81b74bfSEric Blake _cleanup_test_img 32b81b74bfSEric Blake rm -f "$TEST_IMG.converted" 33b81b74bfSEric Blake} 34b81b74bfSEric Blaketrap "_cleanup; exit \$status" 0 1 2 3 15 35b81b74bfSEric Blake 36b81b74bfSEric Blake# get standard environment, filters and checks 37b81b74bfSEric Blake. ./common.rc 38b81b74bfSEric Blake. ./common.filter 39b81b74bfSEric Blake. ./common.pattern 40b81b74bfSEric Blake 41b81b74bfSEric Blake# See 178 for more extensive tests across more formats 42b81b74bfSEric Blake_supported_fmt qcow2 43b81b74bfSEric Blake_supported_proto file 44b81b74bfSEric Blake 45b81b74bfSEric Blakeecho "== Huge file ==" 46b81b74bfSEric Blakeecho 47b81b74bfSEric Blake 48*407fb56aSMax Reitz_make_test_img -o 'cluster_size=2M' 2T 49b81b74bfSEric Blake 50b81b74bfSEric Blake$QEMU_IMG measure -O raw -f qcow2 "$TEST_IMG" 51b81b74bfSEric Blake$QEMU_IMG measure -O qcow2 -o cluster_size=64k -f qcow2 "$TEST_IMG" 52b81b74bfSEric Blake$QEMU_IMG measure -O qcow2 -o cluster_size=2M -f qcow2 "$TEST_IMG" 53b81b74bfSEric Blake 54b81b74bfSEric Blake# success, all done 55b81b74bfSEric Blakeecho "*** done" 56b81b74bfSEric Blakerm -f $seq.full 57b81b74bfSEric Blakestatus=0 58