xref: /openbmc/qemu/tests/qemu-iotests/107 (revision 9ea92c21)
11b2dd0beSMax Reitz#!/bin/bash
21b2dd0beSMax Reitz#
31b2dd0beSMax Reitz# Tests updates of the qcow2 L1 table
41b2dd0beSMax Reitz#
51b2dd0beSMax Reitz# Copyright (C) 2014 Red Hat, Inc.
61b2dd0beSMax Reitz#
71b2dd0beSMax Reitz# This program is free software; you can redistribute it and/or modify
81b2dd0beSMax Reitz# it under the terms of the GNU General Public License as published by
91b2dd0beSMax Reitz# the Free Software Foundation; either version 2 of the License, or
101b2dd0beSMax Reitz# (at your option) any later version.
111b2dd0beSMax Reitz#
121b2dd0beSMax Reitz# This program is distributed in the hope that it will be useful,
131b2dd0beSMax Reitz# but WITHOUT ANY WARRANTY; without even the implied warranty of
141b2dd0beSMax Reitz# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
151b2dd0beSMax Reitz# GNU General Public License for more details.
161b2dd0beSMax Reitz#
171b2dd0beSMax Reitz# You should have received a copy of the GNU General Public License
181b2dd0beSMax Reitz# along with this program.  If not, see <http://www.gnu.org/licenses/>.
191b2dd0beSMax Reitz#
201b2dd0beSMax Reitz
211b2dd0beSMax Reitz# creator
221b2dd0beSMax Reitzowner=mreitz@redhat.com
231b2dd0beSMax Reitz
241b2dd0beSMax Reitzseq="$(basename $0)"
251b2dd0beSMax Reitzecho "QA output created by $seq"
261b2dd0beSMax Reitz
271b2dd0beSMax Reitzhere="$PWD"
281b2dd0beSMax Reitztmp=/tmp/$$
291b2dd0beSMax Reitzstatus=1	# failure is the default!
301b2dd0beSMax Reitz
311b2dd0beSMax Reitz_cleanup()
321b2dd0beSMax Reitz{
331b2dd0beSMax Reitz	_cleanup_test_img
341b2dd0beSMax Reitz}
351b2dd0beSMax Reitztrap "_cleanup; exit \$status" 0 1 2 3 15
361b2dd0beSMax Reitz
371b2dd0beSMax Reitz# get standard environment, filters and checks
381b2dd0beSMax Reitz. ./common.rc
391b2dd0beSMax Reitz. ./common.filter
401b2dd0beSMax Reitz
411b2dd0beSMax Reitz_supported_fmt qcow2
42*9ea92c21SPeter Lieven_supported_proto file nfs
431b2dd0beSMax Reitz_supported_os Linux
441b2dd0beSMax Reitz
451b2dd0beSMax Reitz
461b2dd0beSMax ReitzIMG_SIZE=64K
471b2dd0beSMax Reitz
481b2dd0beSMax Reitzecho
491b2dd0beSMax Reitzecho '=== Updates should not write random data ==='
501b2dd0beSMax Reitzecho
511b2dd0beSMax Reitz
521b2dd0beSMax Reitz_make_test_img $IMG_SIZE
531b2dd0beSMax Reitz$QEMU_IO -c 'write 0 64k' "$TEST_IMG" | _filter_qemu_io
541b2dd0beSMax Reitz$QEMU_IO -c "open -o driver=raw $TEST_IMG" -c 'read -p -P 0 196616 65528' \
551b2dd0beSMax Reitz    | _filter_qemu_io
561b2dd0beSMax Reitz
571b2dd0beSMax Reitz# success, all done
581b2dd0beSMax Reitzecho "*** done"
591b2dd0beSMax Reitzrm -f $seq.full
601b2dd0beSMax Reitzstatus=0
611b2dd0beSMax Reitz
62