xref: /openbmc/qemu/tests/qemu-iotests/107 (revision 1b2dd0be)
1*1b2dd0beSMax Reitz#!/bin/bash
2*1b2dd0beSMax Reitz#
3*1b2dd0beSMax Reitz# Tests updates of the qcow2 L1 table
4*1b2dd0beSMax Reitz#
5*1b2dd0beSMax Reitz# Copyright (C) 2014 Red Hat, Inc.
6*1b2dd0beSMax Reitz#
7*1b2dd0beSMax Reitz# This program is free software; you can redistribute it and/or modify
8*1b2dd0beSMax Reitz# it under the terms of the GNU General Public License as published by
9*1b2dd0beSMax Reitz# the Free Software Foundation; either version 2 of the License, or
10*1b2dd0beSMax Reitz# (at your option) any later version.
11*1b2dd0beSMax Reitz#
12*1b2dd0beSMax Reitz# This program is distributed in the hope that it will be useful,
13*1b2dd0beSMax Reitz# but WITHOUT ANY WARRANTY; without even the implied warranty of
14*1b2dd0beSMax Reitz# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*1b2dd0beSMax Reitz# GNU General Public License for more details.
16*1b2dd0beSMax Reitz#
17*1b2dd0beSMax Reitz# You should have received a copy of the GNU General Public License
18*1b2dd0beSMax Reitz# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19*1b2dd0beSMax Reitz#
20*1b2dd0beSMax Reitz
21*1b2dd0beSMax Reitz# creator
22*1b2dd0beSMax Reitzowner=mreitz@redhat.com
23*1b2dd0beSMax Reitz
24*1b2dd0beSMax Reitzseq="$(basename $0)"
25*1b2dd0beSMax Reitzecho "QA output created by $seq"
26*1b2dd0beSMax Reitz
27*1b2dd0beSMax Reitzhere="$PWD"
28*1b2dd0beSMax Reitztmp=/tmp/$$
29*1b2dd0beSMax Reitzstatus=1	# failure is the default!
30*1b2dd0beSMax Reitz
31*1b2dd0beSMax Reitz_cleanup()
32*1b2dd0beSMax Reitz{
33*1b2dd0beSMax Reitz	_cleanup_test_img
34*1b2dd0beSMax Reitz}
35*1b2dd0beSMax Reitztrap "_cleanup; exit \$status" 0 1 2 3 15
36*1b2dd0beSMax Reitz
37*1b2dd0beSMax Reitz# get standard environment, filters and checks
38*1b2dd0beSMax Reitz. ./common.rc
39*1b2dd0beSMax Reitz. ./common.filter
40*1b2dd0beSMax Reitz
41*1b2dd0beSMax Reitz_supported_fmt qcow2
42*1b2dd0beSMax Reitz_supported_proto file
43*1b2dd0beSMax Reitz_supported_os Linux
44*1b2dd0beSMax Reitz
45*1b2dd0beSMax Reitz
46*1b2dd0beSMax ReitzIMG_SIZE=64K
47*1b2dd0beSMax Reitz
48*1b2dd0beSMax Reitzecho
49*1b2dd0beSMax Reitzecho '=== Updates should not write random data ==='
50*1b2dd0beSMax Reitzecho
51*1b2dd0beSMax Reitz
52*1b2dd0beSMax Reitz_make_test_img $IMG_SIZE
53*1b2dd0beSMax Reitz$QEMU_IO -c 'write 0 64k' "$TEST_IMG" | _filter_qemu_io
54*1b2dd0beSMax Reitz$QEMU_IO -c "open -o driver=raw $TEST_IMG" -c 'read -p -P 0 196616 65528' \
55*1b2dd0beSMax Reitz    | _filter_qemu_io
56*1b2dd0beSMax Reitz
57*1b2dd0beSMax Reitz# success, all done
58*1b2dd0beSMax Reitzecho "*** done"
59*1b2dd0beSMax Reitzrm -f $seq.full
60*1b2dd0beSMax Reitzstatus=0
61*1b2dd0beSMax Reitz
62