xref: /openbmc/qemu/tests/qemu-iotests/029 (revision 8455e4ee666d7bdc35cf877bec1c43bd9c52e407)
1*8455e4eeSKevin Wolf#!/bin/bash
2*8455e4eeSKevin Wolf#
3*8455e4eeSKevin Wolf# Test loading internal snapshots where the L1 table of the snapshot
4*8455e4eeSKevin Wolf# is smaller than the current L1 table.
5*8455e4eeSKevin Wolf#
6*8455e4eeSKevin Wolf# Copyright (C) 2011 Red Hat, Inc.
7*8455e4eeSKevin Wolf#
8*8455e4eeSKevin Wolf# This program is free software; you can redistribute it and/or modify
9*8455e4eeSKevin Wolf# it under the terms of the GNU General Public License as published by
10*8455e4eeSKevin Wolf# the Free Software Foundation; either version 2 of the License, or
11*8455e4eeSKevin Wolf# (at your option) any later version.
12*8455e4eeSKevin Wolf#
13*8455e4eeSKevin Wolf# This program is distributed in the hope that it will be useful,
14*8455e4eeSKevin Wolf# but WITHOUT ANY WARRANTY; without even the implied warranty of
15*8455e4eeSKevin Wolf# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16*8455e4eeSKevin Wolf# GNU General Public License for more details.
17*8455e4eeSKevin Wolf#
18*8455e4eeSKevin Wolf# You should have received a copy of the GNU General Public License
19*8455e4eeSKevin Wolf# along with this program.  If not, see <http://www.gnu.org/licenses/>.
20*8455e4eeSKevin Wolf#
21*8455e4eeSKevin Wolf
22*8455e4eeSKevin Wolf# creator
23*8455e4eeSKevin Wolfowner=kwolf@redhat.com
24*8455e4eeSKevin Wolf
25*8455e4eeSKevin Wolfseq=`basename $0`
26*8455e4eeSKevin Wolfecho "QA output created by $seq"
27*8455e4eeSKevin Wolf
28*8455e4eeSKevin Wolfhere=`pwd`
29*8455e4eeSKevin Wolftmp=/tmp/$$
30*8455e4eeSKevin Wolfstatus=1	# failure is the default!
31*8455e4eeSKevin Wolf
32*8455e4eeSKevin Wolf_cleanup()
33*8455e4eeSKevin Wolf{
34*8455e4eeSKevin Wolf	_cleanup_test_img
35*8455e4eeSKevin Wolf}
36*8455e4eeSKevin Wolftrap "_cleanup; exit \$status" 0 1 2 3 15
37*8455e4eeSKevin Wolf
38*8455e4eeSKevin Wolf# get standard environment, filters and checks
39*8455e4eeSKevin Wolf. ./common.rc
40*8455e4eeSKevin Wolf. ./common.filter
41*8455e4eeSKevin Wolf. ./common.pattern
42*8455e4eeSKevin Wolf
43*8455e4eeSKevin Wolf# Any format supporting intenal snapshots
44*8455e4eeSKevin Wolf_supported_fmt qcow2
45*8455e4eeSKevin Wolf_supported_proto generic
46*8455e4eeSKevin Wolf_supported_os Linux
47*8455e4eeSKevin Wolf
48*8455e4eeSKevin WolfCLUSTER_SIZE=65536
49*8455e4eeSKevin Wolf_make_test_img 64M
50*8455e4eeSKevin Wolf$QEMU_IMG snapshot -c foo $TEST_IMG
51*8455e4eeSKevin Wolf$QEMU_IO -c 'write -b 0 4k' $TEST_IMG | _filter_qemu_io
52*8455e4eeSKevin Wolf$QEMU_IMG snapshot -a foo $TEST_IMG
53*8455e4eeSKevin Wolf_check_test_img
54*8455e4eeSKevin Wolf
55*8455e4eeSKevin WolfCLUSTER_SIZE=1024
56*8455e4eeSKevin Wolf_make_test_img 16M
57*8455e4eeSKevin Wolf$QEMU_IMG snapshot -c foo $TEST_IMG
58*8455e4eeSKevin Wolf$QEMU_IO -c 'write -b 0 4M' $TEST_IMG | _filter_qemu_io
59*8455e4eeSKevin Wolf$QEMU_IMG snapshot -a foo $TEST_IMG
60*8455e4eeSKevin Wolf_check_test_img
61*8455e4eeSKevin Wolf
62*8455e4eeSKevin Wolf# success, all done
63*8455e4eeSKevin Wolfecho "*** done"
64*8455e4eeSKevin Wolfrm -f $seq.full
65*8455e4eeSKevin Wolfstatus=0
66