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