xref: /openbmc/qemu/tests/qemu-iotests/069 (revision 42a5009d)
111a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash
29dd003a9SVladimir Sementsov-Ogievskiy# group: rw auto quick
3321fd7d2SMax Reitz#
4321fd7d2SMax Reitz# Test case for deleting a backing file
5321fd7d2SMax Reitz#
6321fd7d2SMax Reitz# Copyright (C) 2013 Red Hat, Inc.
7321fd7d2SMax Reitz#
8321fd7d2SMax Reitz# This program is free software; you can redistribute it and/or modify
9321fd7d2SMax Reitz# it under the terms of the GNU General Public License as published by
10321fd7d2SMax Reitz# the Free Software Foundation; either version 2 of the License, or
11321fd7d2SMax Reitz# (at your option) any later version.
12321fd7d2SMax Reitz#
13321fd7d2SMax Reitz# This program is distributed in the hope that it will be useful,
14321fd7d2SMax Reitz# but WITHOUT ANY WARRANTY; without even the implied warranty of
15321fd7d2SMax Reitz# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16321fd7d2SMax Reitz# GNU General Public License for more details.
17321fd7d2SMax Reitz#
18321fd7d2SMax Reitz# You should have received a copy of the GNU General Public License
19321fd7d2SMax Reitz# along with this program.  If not, see <http://www.gnu.org/licenses/>.
20321fd7d2SMax Reitz#
21321fd7d2SMax Reitz
22321fd7d2SMax Reitz# creator
23*42a5009dSJohn Snowowner=hreitz@redhat.com
24321fd7d2SMax Reitz
25321fd7d2SMax Reitzseq="$(basename $0)"
26321fd7d2SMax Reitzecho "QA output created by $seq"
27321fd7d2SMax Reitz
28321fd7d2SMax Reitzstatus=1	# failure is the default!
29321fd7d2SMax Reitz
30321fd7d2SMax Reitz_cleanup()
31321fd7d2SMax Reitz{
32321fd7d2SMax Reitz	_cleanup_test_img
33321fd7d2SMax Reitz}
34321fd7d2SMax Reitztrap "_cleanup; exit \$status" 0 1 2 3 15
35321fd7d2SMax Reitz
36321fd7d2SMax Reitz# get standard environment, filters and checks
37321fd7d2SMax Reitz. ./common.rc
38321fd7d2SMax Reitz. ./common.filter
39321fd7d2SMax Reitz
40550830f9SStefan Hajnoczi_supported_fmt qed qcow qcow2 vmdk
411f7bf7d0SPeter Lieven_supported_proto file
42d2329f27SFam Zheng_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat"
43321fd7d2SMax Reitz
44321fd7d2SMax ReitzIMG_SIZE=128K
45321fd7d2SMax Reitz
46321fd7d2SMax Reitzecho
47321fd7d2SMax Reitzecho "=== Creating an image with a backing file and deleting that file ==="
48321fd7d2SMax Reitzecho
49321fd7d2SMax ReitzTEST_IMG="$TEST_IMG.base" _make_test_img $IMG_SIZE
50b66ff2c2SEric Blake_make_test_img -b "$TEST_IMG.base" -F $IMGFMT $IMG_SIZE
51f91ecbd7SMax Reitz_rm_test_img "$TEST_IMG.base"
52321fd7d2SMax Reitz# Just open the image and close it right again (this should print an error message)
53321fd7d2SMax Reitz$QEMU_IO -c quit "$TEST_IMG" 2>&1 | _filter_testdir | _filter_imgfmt
54321fd7d2SMax Reitz
55321fd7d2SMax Reitz# success, all done
56321fd7d2SMax Reitzecho "*** done"
57321fd7d2SMax Reitzrm -f $seq.full
58321fd7d2SMax Reitzstatus=0
59