1908eaf68SStefan Hajnoczi#!/bin/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 Wolfhere=`pwd` 30e9029212SKevin Wolftmp=/tmp/$$ 31e9029212SKevin Wolfstatus=1 # failure is the default! 32e9029212SKevin Wolf 33e9029212SKevin Wolf_cleanup() 34e9029212SKevin Wolf{ 35e9029212SKevin Wolf _cleanup_test_img 36e9029212SKevin Wolf} 37e9029212SKevin Wolftrap "_cleanup; exit \$status" 0 1 2 3 15 38e9029212SKevin Wolf 39e9029212SKevin Wolf# get standard environment, filters and checks 40e9029212SKevin Wolf. ./common.rc 41e9029212SKevin Wolf. ./common.filter 42e9029212SKevin Wolf. ./common.pattern 43e9029212SKevin Wolf 44e9029212SKevin Wolf# Any format that supports snapshots 45e9029212SKevin Wolf_supported_fmt qcow2 46*9cdfa1b3SMORITA Kazutaka_supported_proto generic 47e9029212SKevin Wolf_supported_os Linux 48e9029212SKevin Wolf 49e9029212SKevin WolfTEST_OFFSETS="10485760 4294967296" 508fc1024cSKevin WolfCLUSTER_SIZE="4096" 51e9029212SKevin Wolf 52e9029212SKevin Wolf_make_test_img 6G 53e9029212SKevin Wolf 54e9029212SKevin Wolfecho "Testing empty image" 55e9029212SKevin Wolfecho 56e9029212SKevin Wolf 57e9029212SKevin Wolffor offset in $TEST_OFFSETS; do 58e9029212SKevin Wolf echo "At offset $offset:" 598fc1024cSKevin Wolf io_test "write -b" $offset $CLUSTER_SIZE 8 608fc1024cSKevin Wolf io_test "read -b" $offset $CLUSTER_SIZE 8 61e9029212SKevin Wolf _check_test_img 62e9029212SKevin Wolfdone 63e9029212SKevin Wolf 64e9029212SKevin Wolf# success, all done 65e9029212SKevin Wolfecho "*** done" 66e9029212SKevin Wolfrm -f $seq.full 67e9029212SKevin Wolfstatus=0 68