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