xref: /openbmc/qemu/tests/qemu-iotests/092 (revision 7159a45b2bf2dcb9f49f1e27d1d3d135a0247a2f)
1*7159a45bSKevin Wolf#!/bin/bash
2*7159a45bSKevin Wolf#
3*7159a45bSKevin Wolf# qcow1 format input validation tests
4*7159a45bSKevin Wolf#
5*7159a45bSKevin Wolf# Copyright (C) 2014 Red Hat, Inc.
6*7159a45bSKevin Wolf#
7*7159a45bSKevin Wolf# This program is free software; you can redistribute it and/or modify
8*7159a45bSKevin Wolf# it under the terms of the GNU General Public License as published by
9*7159a45bSKevin Wolf# the Free Software Foundation; either version 2 of the License, or
10*7159a45bSKevin Wolf# (at your option) any later version.
11*7159a45bSKevin Wolf#
12*7159a45bSKevin Wolf# This program is distributed in the hope that it will be useful,
13*7159a45bSKevin Wolf# but WITHOUT ANY WARRANTY; without even the implied warranty of
14*7159a45bSKevin Wolf# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*7159a45bSKevin Wolf# GNU General Public License for more details.
16*7159a45bSKevin Wolf#
17*7159a45bSKevin Wolf# You should have received a copy of the GNU General Public License
18*7159a45bSKevin Wolf# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19*7159a45bSKevin Wolf#
20*7159a45bSKevin Wolf
21*7159a45bSKevin Wolf# creator
22*7159a45bSKevin Wolfowner=kwolf@redhat.com
23*7159a45bSKevin Wolf
24*7159a45bSKevin Wolfseq=`basename $0`
25*7159a45bSKevin Wolfecho "QA output created by $seq"
26*7159a45bSKevin Wolf
27*7159a45bSKevin Wolfhere=`pwd`
28*7159a45bSKevin Wolftmp=/tmp/$$
29*7159a45bSKevin Wolfstatus=1	# failure is the default!
30*7159a45bSKevin Wolf
31*7159a45bSKevin Wolf_cleanup()
32*7159a45bSKevin Wolf{
33*7159a45bSKevin Wolf    rm -f $TEST_IMG.snap
34*7159a45bSKevin Wolf    _cleanup_test_img
35*7159a45bSKevin Wolf}
36*7159a45bSKevin Wolftrap "_cleanup; exit \$status" 0 1 2 3 15
37*7159a45bSKevin Wolf
38*7159a45bSKevin Wolf# get standard environment, filters and checks
39*7159a45bSKevin Wolf. ./common.rc
40*7159a45bSKevin Wolf. ./common.filter
41*7159a45bSKevin Wolf
42*7159a45bSKevin Wolf_supported_fmt qcow
43*7159a45bSKevin Wolf_supported_proto generic
44*7159a45bSKevin Wolf_supported_os Linux
45*7159a45bSKevin Wolf
46*7159a45bSKevin Wolfoffset_cluster_bits=32
47*7159a45bSKevin Wolf
48*7159a45bSKevin Wolfecho
49*7159a45bSKevin Wolfecho "== Invalid cluster size =="
50*7159a45bSKevin Wolf_make_test_img 64M
51*7159a45bSKevin Wolfpoke_file "$TEST_IMG" "$offset_cluster_bits" "\xff"
52*7159a45bSKevin Wolf{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir
53*7159a45bSKevin Wolfpoke_file "$TEST_IMG" "$offset_cluster_bits" "\x1f"
54*7159a45bSKevin Wolf{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir
55*7159a45bSKevin Wolfpoke_file "$TEST_IMG" "$offset_cluster_bits" "\x08"
56*7159a45bSKevin Wolf{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir
57*7159a45bSKevin Wolfpoke_file "$TEST_IMG" "$offset_cluster_bits" "\x11"
58*7159a45bSKevin Wolf{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir
59*7159a45bSKevin Wolf
60*7159a45bSKevin Wolf# success, all done
61*7159a45bSKevin Wolfecho "*** done"
62*7159a45bSKevin Wolfrm -f $seq.full
63*7159a45bSKevin Wolfstatus=0
64