1*11a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash 22247798dSMax Reitz# 32247798dSMax Reitz# Test case for accessing creation options on image formats and 42247798dSMax Reitz# protocols not supporting image creation 52247798dSMax Reitz# 62247798dSMax Reitz# Copyright (C) 2014 Red Hat, Inc. 72247798dSMax Reitz# 82247798dSMax Reitz# This program is free software; you can redistribute it and/or modify 92247798dSMax Reitz# it under the terms of the GNU General Public License as published by 102247798dSMax Reitz# the Free Software Foundation; either version 2 of the License, or 112247798dSMax Reitz# (at your option) any later version. 122247798dSMax Reitz# 132247798dSMax Reitz# This program is distributed in the hope that it will be useful, 142247798dSMax Reitz# but WITHOUT ANY WARRANTY; without even the implied warranty of 152247798dSMax Reitz# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 162247798dSMax Reitz# GNU General Public License for more details. 172247798dSMax Reitz# 182247798dSMax Reitz# You should have received a copy of the GNU General Public License 192247798dSMax Reitz# along with this program. If not, see <http://www.gnu.org/licenses/>. 202247798dSMax Reitz# 212247798dSMax Reitz 222247798dSMax Reitz# creator 232247798dSMax Reitzowner=mreitz@redhat.com 242247798dSMax Reitz 252247798dSMax Reitzseq="$(basename $0)" 262247798dSMax Reitzecho "QA output created by $seq" 272247798dSMax Reitz 282247798dSMax Reitzstatus=1 # failure is the default! 292247798dSMax Reitz 302247798dSMax Reitz_cleanup() 312247798dSMax Reitz{ 322247798dSMax Reitz _cleanup_test_img 332247798dSMax Reitz} 342247798dSMax Reitztrap "_cleanup; exit \$status" 0 1 2 3 15 352247798dSMax Reitz 362247798dSMax Reitz# get standard environment, filters and checks 372247798dSMax Reitz. ./common.rc 382247798dSMax Reitz. ./common.filter 392247798dSMax Reitz 40dee6ddd8SMax Reitz# Some of these test cases use bochs, but others do use raw, so this 41dee6ddd8SMax Reitz# is only half a lie. 42dee6ddd8SMax Reitz_supported_fmt raw 43dee6ddd8SMax Reitz_supported_proto file 442247798dSMax Reitz_supported_os Linux 452247798dSMax Reitz 462247798dSMax Reitzecho 472247798dSMax Reitzecho '=== Unsupported image creation in qemu-img create ===' 482247798dSMax Reitzecho 492247798dSMax Reitz 50dee6ddd8SMax Reitz$QEMU_IMG create -f bochs nbd://example.com 2>&1 64M 512247798dSMax Reitz 522247798dSMax Reitzecho 532247798dSMax Reitzecho '=== Unsupported image creation in qemu-img convert ===' 542247798dSMax Reitzecho 552247798dSMax Reitz 562247798dSMax Reitz# We could use any input image format here, but this is a bochs test, so just 572247798dSMax Reitz# use the bochs image 582247798dSMax Reitz_use_sample_img empty.bochs.bz2 59dee6ddd8SMax Reitz$QEMU_IMG convert -f bochs -O bochs "$TEST_IMG" nbd://example.com 602247798dSMax Reitz 612247798dSMax Reitzecho 622247798dSMax Reitzecho '=== Unsupported format in qemu-img amend ===' 632247798dSMax Reitzecho 642247798dSMax Reitz 65dee6ddd8SMax ReitzTEST_IMG="$TEST_DIR/t.$IMGFMT" 66dee6ddd8SMax Reitz_make_test_img 1M 67dee6ddd8SMax Reitz$QEMU_IMG amend -f $IMGFMT -o size=2M "$TEST_IMG" 2>&1 | _filter_imgfmt 682247798dSMax Reitz 692247798dSMax Reitz# success, all done 702247798dSMax Reitzecho 712247798dSMax Reitzecho '*** done' 722247798dSMax Reitzrm -f $seq.full 732247798dSMax Reitzstatus=0 74