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