xref: /openbmc/qemu/tests/qemu-iotests/022 (revision e90292125c14144c6aa1d73a3d1957e65629801d)
1*e9029212SKevin Wolf#!/bin/sh
2*e9029212SKevin Wolf#
3*e9029212SKevin Wolf# Test bdrv_load/save_vmstate using the usual patterns
4*e9029212SKevin Wolf#
5*e9029212SKevin Wolf# Copyright (C) 2009 Red Hat, Inc.
6*e9029212SKevin Wolf#
7*e9029212SKevin Wolf# This program is free software; you can redistribute it and/or modify
8*e9029212SKevin Wolf# it under the terms of the GNU General Public License as published by
9*e9029212SKevin Wolf# the Free Software Foundation; either version 2 of the License, or
10*e9029212SKevin Wolf# (at your option) any later version.
11*e9029212SKevin Wolf#
12*e9029212SKevin Wolf# This program is distributed in the hope that it will be useful,
13*e9029212SKevin Wolf# but WITHOUT ANY WARRANTY; without even the implied warranty of
14*e9029212SKevin Wolf# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*e9029212SKevin Wolf# GNU General Public License for more details.
16*e9029212SKevin Wolf#
17*e9029212SKevin Wolf# You should have received a copy of the GNU General Public License
18*e9029212SKevin Wolf# along with this program; if not, write to the Free Software
19*e9029212SKevin Wolf# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
20*e9029212SKevin Wolf# USA
21*e9029212SKevin Wolf#
22*e9029212SKevin Wolf
23*e9029212SKevin Wolf# creator
24*e9029212SKevin Wolfowner=kwolf@redhat.com
25*e9029212SKevin Wolf
26*e9029212SKevin Wolfseq=`basename $0`
27*e9029212SKevin Wolfecho "QA output created by $seq"
28*e9029212SKevin Wolf
29*e9029212SKevin Wolfhere=`pwd`
30*e9029212SKevin Wolftmp=/tmp/$$
31*e9029212SKevin Wolfstatus=1	# failure is the default!
32*e9029212SKevin Wolf
33*e9029212SKevin Wolf_cleanup()
34*e9029212SKevin Wolf{
35*e9029212SKevin Wolf	_cleanup_test_img
36*e9029212SKevin Wolf}
37*e9029212SKevin Wolftrap "_cleanup; exit \$status" 0 1 2 3 15
38*e9029212SKevin Wolf
39*e9029212SKevin Wolf# get standard environment, filters and checks
40*e9029212SKevin Wolf. ./common.rc
41*e9029212SKevin Wolf. ./common.filter
42*e9029212SKevin Wolf. ./common.pattern
43*e9029212SKevin Wolf
44*e9029212SKevin Wolf# Any format that supports snapshots
45*e9029212SKevin Wolf_supported_fmt qcow2
46*e9029212SKevin Wolf_supported_os Linux
47*e9029212SKevin Wolf
48*e9029212SKevin WolfTEST_OFFSETS="10485760 4294967296"
49*e9029212SKevin Wolf
50*e9029212SKevin Wolf_make_test_img 6G
51*e9029212SKevin Wolf
52*e9029212SKevin Wolfecho "Testing empty image"
53*e9029212SKevin Wolfecho
54*e9029212SKevin Wolf
55*e9029212SKevin Wolffor offset in $TEST_OFFSETS; do
56*e9029212SKevin Wolf    echo "At offset $offset:"
57*e9029212SKevin Wolf    io_test "write -b" $offset
58*e9029212SKevin Wolf    io_test "read -b" $offset
59*e9029212SKevin Wolf    _check_test_img
60*e9029212SKevin Wolfdone
61*e9029212SKevin Wolf
62*e9029212SKevin Wolf# success, all done
63*e9029212SKevin Wolfecho "*** done"
64*e9029212SKevin Wolfrm -f $seq.full
65*e9029212SKevin Wolfstatus=0
66