xref: /openbmc/qemu/tests/qemu-iotests/014 (revision 8fc1024ceec96d2ec2d2a0296220075e06a6c756)
16bf19c94SChristoph Hellwig#!/bin/sh
26bf19c94SChristoph Hellwig#
36bf19c94SChristoph Hellwig# qcow2 pattern test, complex patterns including compression and snapshots
4*8fc1024cSKevin Wolf# Using patterns for 4k cluster size.
56bf19c94SChristoph Hellwig#
66bf19c94SChristoph Hellwig#
76bf19c94SChristoph Hellwig# Copyright (C) 2009 Red Hat, Inc.
86bf19c94SChristoph Hellwig#
96bf19c94SChristoph Hellwig# This program is free software; you can redistribute it and/or modify
106bf19c94SChristoph Hellwig# it under the terms of the GNU General Public License as published by
116bf19c94SChristoph Hellwig# the Free Software Foundation; either version 2 of the License, or
126bf19c94SChristoph Hellwig# (at your option) any later version.
136bf19c94SChristoph Hellwig#
146bf19c94SChristoph Hellwig# This program is distributed in the hope that it will be useful,
156bf19c94SChristoph Hellwig# but WITHOUT ANY WARRANTY; without even the implied warranty of
166bf19c94SChristoph Hellwig# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
176bf19c94SChristoph Hellwig# GNU General Public License for more details.
186bf19c94SChristoph Hellwig#
196bf19c94SChristoph Hellwig# You should have received a copy of the GNU General Public License
20e8c212d6SChristoph Hellwig# along with this program.  If not, see <http://www.gnu.org/licenses/>.
216bf19c94SChristoph Hellwig#
226bf19c94SChristoph Hellwig
236bf19c94SChristoph Hellwig# creator
246bf19c94SChristoph Hellwigowner=kwolf@redhat.com
256bf19c94SChristoph Hellwig
266bf19c94SChristoph Hellwigseq=`basename $0`
276bf19c94SChristoph Hellwigecho "QA output created by $seq"
286bf19c94SChristoph Hellwig
296bf19c94SChristoph Hellwighere=`pwd`
306bf19c94SChristoph Hellwigtmp=/tmp/$$
316bf19c94SChristoph Hellwigstatus=1	# failure is the default!
326bf19c94SChristoph Hellwig
336bf19c94SChristoph Hellwig_cleanup()
346bf19c94SChristoph Hellwig{
356bf19c94SChristoph Hellwig	_cleanup_test_img
366bf19c94SChristoph Hellwig}
376bf19c94SChristoph Hellwigtrap "_cleanup; exit \$status" 0 1 2 3 15
386bf19c94SChristoph Hellwig
396bf19c94SChristoph Hellwig# get standard environment, filters and checks
406bf19c94SChristoph Hellwig. ./common.rc
416bf19c94SChristoph Hellwig. ./common.filter
426bf19c94SChristoph Hellwig. ./common.pattern
436bf19c94SChristoph Hellwig
44e76a8e89SChristoph Hellwig# much of this could be generic for any format supporting snapshots
456bf19c94SChristoph Hellwig_supported_fmt qcow2
466bf19c94SChristoph Hellwig_supported_os Linux
476bf19c94SChristoph Hellwig
486bf19c94SChristoph HellwigTEST_OFFSETS="0 4294967296"
496bf19c94SChristoph HellwigTEST_OPS="writev read write readv"
50*8fc1024cSKevin WolfCLUSTER_SIZE=4096
516bf19c94SChristoph Hellwig
526bf19c94SChristoph Hellwig_make_test_img 6G
536bf19c94SChristoph Hellwig
546bf19c94SChristoph Hellwigecho "Testing empty image:"
556bf19c94SChristoph Hellwigfor offset in $TEST_OFFSETS; do
566bf19c94SChristoph Hellwig    echo test2: With offset $offset
57*8fc1024cSKevin Wolf    io_test2 $offset $CLUSTER_SIZE 256
586bf19c94SChristoph Hellwig    _check_test_img
596bf19c94SChristoph Hellwigdone
606bf19c94SChristoph Hellwig
616bf19c94SChristoph Hellwig# With snapshots
626bf19c94SChristoph Hellwigfor i in `seq 1 3`; do
636bf19c94SChristoph Hellwig    $QEMU_IMG snapshot -c test$i $TEST_IMG
646bf19c94SChristoph Hellwig    for offset in $TEST_OFFSETS; do
656bf19c94SChristoph Hellwig        echo With snapshot test$i, offset $offset
666bf19c94SChristoph Hellwig        for op in $TEST_OPS; do
67*8fc1024cSKevin Wolf            io_test $op $offset $CLUSTER_SIZE 8
686bf19c94SChristoph Hellwig        done
696bf19c94SChristoph Hellwig        _check_test_img
706bf19c94SChristoph Hellwig    done
716bf19c94SChristoph Hellwigdone
726bf19c94SChristoph Hellwig
736bf19c94SChristoph Hellwig# success, all done
746bf19c94SChristoph Hellwigecho "*** done"
756bf19c94SChristoph Hellwigrm -f $seq.full
766bf19c94SChristoph Hellwigstatus=0
77