xref: /openbmc/qemu/tests/qemu-iotests/022 (revision 0c201cc1)
111a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash
29dd003a9SVladimir 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
19*0c201cc1SKhadija Kamran# along with this program. If not, see <https://www.gnu.org/licenses/>.
20e9029212SKevin Wolf#
21e9029212SKevin Wolf
22e9029212SKevin Wolf# creator
23e9029212SKevin Wolfowner=kwolf@redhat.com
24e9029212SKevin Wolf
25e9029212SKevin Wolfseq=`basename $0`
26e9029212SKevin Wolfecho "QA output created by $seq"
27e9029212SKevin Wolf
28e9029212SKevin Wolfstatus=1	# failure is the default!
29e9029212SKevin Wolf
30e9029212SKevin Wolf_cleanup()
31e9029212SKevin Wolf{
32e9029212SKevin Wolf	_cleanup_test_img
33e9029212SKevin Wolf}
34e9029212SKevin Wolftrap "_cleanup; exit \$status" 0 1 2 3 15
35e9029212SKevin Wolf
36e9029212SKevin Wolf# get standard environment, filters and checks
37e9029212SKevin Wolf. ./common.rc
38e9029212SKevin Wolf. ./common.filter
39e9029212SKevin Wolf. ./common.pattern
40e9029212SKevin Wolf
41e9029212SKevin Wolf# Any format that supports snapshots
42e9029212SKevin Wolf_supported_fmt qcow2
439cdfa1b3SMORITA Kazutaka_supported_proto generic
44e9029212SKevin Wolf
45e9029212SKevin WolfTEST_OFFSETS="10485760 4294967296"
468fc1024cSKevin WolfCLUSTER_SIZE="4096"
47e9029212SKevin Wolf
48e9029212SKevin Wolf_make_test_img 6G
49e9029212SKevin Wolf
50e9029212SKevin Wolfecho "Testing empty image"
51e9029212SKevin Wolfecho
52e9029212SKevin Wolf
53e9029212SKevin Wolffor offset in $TEST_OFFSETS; do
54e9029212SKevin Wolf    echo "At offset $offset:"
558fc1024cSKevin Wolf    io_test "write -b" $offset $CLUSTER_SIZE 8
568fc1024cSKevin Wolf    io_test "read -b" $offset $CLUSTER_SIZE 8
57e9029212SKevin Wolf    _check_test_img
58e9029212SKevin Wolfdone
59e9029212SKevin Wolf
60e9029212SKevin Wolf# success, all done
61e9029212SKevin Wolfecho "*** done"
62e9029212SKevin Wolfrm -f $seq.full
63e9029212SKevin Wolfstatus=0
64