1b93d6d24SKevin Wolf#!/bin/bash 2b93d6d24SKevin Wolf# 3b93d6d24SKevin Wolf# Regression test for commit b7ab0fea (which was a corruption fix, 4b93d6d24SKevin Wolf# despite the commit message claiming otherwise) 5b93d6d24SKevin Wolf# 6b93d6d24SKevin Wolf# Copyright (C) 2013 Red Hat, Inc. 7b93d6d24SKevin Wolf# 8b93d6d24SKevin Wolf# This program is free software; you can redistribute it and/or modify 9b93d6d24SKevin Wolf# it under the terms of the GNU General Public License as published by 10b93d6d24SKevin Wolf# the Free Software Foundation; either version 2 of the License, or 11b93d6d24SKevin Wolf# (at your option) any later version. 12b93d6d24SKevin Wolf# 13b93d6d24SKevin Wolf# This program is distributed in the hope that it will be useful, 14b93d6d24SKevin Wolf# but WITHOUT ANY WARRANTY; without even the implied warranty of 15b93d6d24SKevin Wolf# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16b93d6d24SKevin Wolf# GNU General Public License for more details. 17b93d6d24SKevin Wolf# 18b93d6d24SKevin Wolf# You should have received a copy of the GNU General Public License 19b93d6d24SKevin Wolf# along with this program. If not, see <http://www.gnu.org/licenses/>. 20b93d6d24SKevin Wolf# 21b93d6d24SKevin Wolf 22b93d6d24SKevin Wolf# creator 23b93d6d24SKevin Wolfowner=kwolf@redhat.com 24b93d6d24SKevin Wolf 25b93d6d24SKevin Wolfseq=`basename $0` 26b93d6d24SKevin Wolfecho "QA output created by $seq" 27b93d6d24SKevin Wolf 28b93d6d24SKevin Wolfhere=`pwd` 29b93d6d24SKevin Wolftmp=/tmp/$$ 30b93d6d24SKevin Wolfstatus=1 # failure is the default! 31b93d6d24SKevin Wolf 32b93d6d24SKevin Wolf_cleanup() 33b93d6d24SKevin Wolf{ 34b93d6d24SKevin Wolf _cleanup_test_img 35b93d6d24SKevin Wolf} 36b93d6d24SKevin Wolftrap "_cleanup; exit \$status" 0 1 2 3 15 37b93d6d24SKevin Wolf 38b93d6d24SKevin Wolf# get standard environment, filters and checks 39b93d6d24SKevin Wolf. ./common.rc 40b93d6d24SKevin Wolf. ./common.filter 41b93d6d24SKevin Wolf 42b93d6d24SKevin Wolf_supported_fmt qcow2 43b93d6d24SKevin Wolf_supported_proto generic 44b93d6d24SKevin Wolf_supported_os Linux 45b93d6d24SKevin Wolf 46b93d6d24SKevin Wolfsize=128M 47b93d6d24SKevin Wolf 48b93d6d24SKevin Wolf_make_test_img $size 49b93d6d24SKevin Wolf 50b93d6d24SKevin Wolffunction qemu_io_cmds() 51b93d6d24SKevin Wolf{ 52b93d6d24SKevin Wolfcat <<EOF 53b93d6d24SKevin Wolfwrite -P 0x66 0 320k 54b93d6d24SKevin Wolfwrite 320k 128k 55b93d6d24SKevin Wolfwrite -P 0x55 1M 128k 56b93d6d24SKevin Wolfwrite -P 0x88 448k 128k 57b93d6d24SKevin Wolfdiscard 320k 128k 58b93d6d24SKevin Wolfaio_flush 59b93d6d24SKevin Wolf 60b93d6d24SKevin Wolfwrite -P 0x77 0 480k 61b93d6d24SKevin Wolfaio_flush 62b93d6d24SKevin Wolf 63b93d6d24SKevin Wolfread -P 0x77 0 480k 64b93d6d24SKevin Wolfread -P 0x88 480k 96k 65b93d6d24SKevin Wolfread -P 0x55 1M 128k 66b93d6d24SKevin WolfEOF 67b93d6d24SKevin Wolf} 68b93d6d24SKevin Wolf 69*fef9c191SJeff Codyqemu_io_cmds | $QEMU_IO "$TEST_IMG" | _filter_qemu_io 70b93d6d24SKevin Wolf_check_test_img 71b93d6d24SKevin Wolf 72b93d6d24SKevin Wolf# success, all done 73b93d6d24SKevin Wolfecho "*** done" 74b93d6d24SKevin Wolfrm -f $seq.full 75b93d6d24SKevin Wolfstatus=0 76