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