xref: /openbmc/qemu/tests/qemu-iotests/069 (revision 321fd7d2b88defe11528e4d5a9f686c89ebee1ee)
1*321fd7d2SMax Reitz#!/bin/bash
2*321fd7d2SMax Reitz#
3*321fd7d2SMax Reitz# Test case for deleting a backing file
4*321fd7d2SMax Reitz#
5*321fd7d2SMax Reitz# Copyright (C) 2013 Red Hat, Inc.
6*321fd7d2SMax Reitz#
7*321fd7d2SMax Reitz# This program is free software; you can redistribute it and/or modify
8*321fd7d2SMax Reitz# it under the terms of the GNU General Public License as published by
9*321fd7d2SMax Reitz# the Free Software Foundation; either version 2 of the License, or
10*321fd7d2SMax Reitz# (at your option) any later version.
11*321fd7d2SMax Reitz#
12*321fd7d2SMax Reitz# This program is distributed in the hope that it will be useful,
13*321fd7d2SMax Reitz# but WITHOUT ANY WARRANTY; without even the implied warranty of
14*321fd7d2SMax Reitz# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*321fd7d2SMax Reitz# GNU General Public License for more details.
16*321fd7d2SMax Reitz#
17*321fd7d2SMax Reitz# You should have received a copy of the GNU General Public License
18*321fd7d2SMax Reitz# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19*321fd7d2SMax Reitz#
20*321fd7d2SMax Reitz
21*321fd7d2SMax Reitz# creator
22*321fd7d2SMax Reitzowner=mreitz@redhat.com
23*321fd7d2SMax Reitz
24*321fd7d2SMax Reitzseq="$(basename $0)"
25*321fd7d2SMax Reitzecho "QA output created by $seq"
26*321fd7d2SMax Reitz
27*321fd7d2SMax Reitzhere="$PWD"
28*321fd7d2SMax Reitztmp=/tmp/$$
29*321fd7d2SMax Reitzstatus=1	# failure is the default!
30*321fd7d2SMax Reitz
31*321fd7d2SMax Reitz_cleanup()
32*321fd7d2SMax Reitz{
33*321fd7d2SMax Reitz	_cleanup_test_img
34*321fd7d2SMax Reitz}
35*321fd7d2SMax Reitztrap "_cleanup; exit \$status" 0 1 2 3 15
36*321fd7d2SMax Reitz
37*321fd7d2SMax Reitz# get standard environment, filters and checks
38*321fd7d2SMax Reitz. ./common.rc
39*321fd7d2SMax Reitz. ./common.filter
40*321fd7d2SMax Reitz
41*321fd7d2SMax Reitz_supported_fmt cow qed qcow qcow2 vmdk
42*321fd7d2SMax Reitz_supported_proto generic
43*321fd7d2SMax Reitz_supported_os Linux
44*321fd7d2SMax Reitz
45*321fd7d2SMax ReitzIMG_SIZE=128K
46*321fd7d2SMax Reitz
47*321fd7d2SMax Reitzecho
48*321fd7d2SMax Reitzecho "=== Creating an image with a backing file and deleting that file ==="
49*321fd7d2SMax Reitzecho
50*321fd7d2SMax ReitzTEST_IMG="$TEST_IMG.base" _make_test_img $IMG_SIZE
51*321fd7d2SMax Reitz_make_test_img -b "$TEST_IMG.base" $IMG_SIZE
52*321fd7d2SMax Reitzrm -f "$TEST_IMG.base"
53*321fd7d2SMax Reitz# Just open the image and close it right again (this should print an error message)
54*321fd7d2SMax Reitz$QEMU_IO -c quit "$TEST_IMG" 2>&1 | _filter_testdir | _filter_imgfmt
55*321fd7d2SMax Reitz
56*321fd7d2SMax Reitz# success, all done
57*321fd7d2SMax Reitzecho "*** done"
58*321fd7d2SMax Reitzrm -f $seq.full
59*321fd7d2SMax Reitzstatus=0
60