1*11a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash 2e9029212SKevin Wolf# 3e9029212SKevin Wolf# Test bdrv_load/save_vmstate using the usual patterns 4e9029212SKevin Wolf# 5e9029212SKevin Wolf# Copyright (C) 2009 Red Hat, Inc. 6e9029212SKevin Wolf# 7e9029212SKevin Wolf# This program is free software; you can redistribute it and/or modify 8e9029212SKevin Wolf# it under the terms of the GNU General Public License as published by 9e9029212SKevin Wolf# the Free Software Foundation; either version 2 of the License, or 10e9029212SKevin Wolf# (at your option) any later version. 11e9029212SKevin Wolf# 12e9029212SKevin Wolf# This program is distributed in the hope that it will be useful, 13e9029212SKevin Wolf# but WITHOUT ANY WARRANTY; without even the implied warranty of 14e9029212SKevin Wolf# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15e9029212SKevin Wolf# GNU General Public License for more details. 16e9029212SKevin Wolf# 17e9029212SKevin Wolf# You should have received a copy of the GNU General Public License 18e9029212SKevin Wolf# along with this program; if not, write to the Free Software 19e9029212SKevin Wolf# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20e9029212SKevin Wolf# USA 21e9029212SKevin Wolf# 22e9029212SKevin Wolf 23e9029212SKevin Wolf# creator 24e9029212SKevin Wolfowner=kwolf@redhat.com 25e9029212SKevin Wolf 26e9029212SKevin Wolfseq=`basename $0` 27e9029212SKevin Wolfecho "QA output created by $seq" 28e9029212SKevin Wolf 29e9029212SKevin Wolfstatus=1 # failure is the default! 30e9029212SKevin Wolf 31e9029212SKevin Wolf_cleanup() 32e9029212SKevin Wolf{ 33e9029212SKevin Wolf _cleanup_test_img 34e9029212SKevin Wolf} 35e9029212SKevin Wolftrap "_cleanup; exit \$status" 0 1 2 3 15 36e9029212SKevin Wolf 37e9029212SKevin Wolf# get standard environment, filters and checks 38e9029212SKevin Wolf. ./common.rc 39e9029212SKevin Wolf. ./common.filter 40e9029212SKevin Wolf. ./common.pattern 41e9029212SKevin Wolf 42e9029212SKevin Wolf# Any format that supports snapshots 43e9029212SKevin Wolf_supported_fmt qcow2 449cdfa1b3SMORITA Kazutaka_supported_proto generic 45e9029212SKevin Wolf_supported_os Linux 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