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