12247798dSMax Reitz#!/bin/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 Reitzhere="$PWD" 292247798dSMax Reitzstatus=1 # failure is the default! 302247798dSMax Reitz 312247798dSMax Reitz_cleanup() 322247798dSMax Reitz{ 332247798dSMax Reitz _cleanup_test_img 342247798dSMax Reitz} 352247798dSMax Reitztrap "_cleanup; exit \$status" 0 1 2 3 15 362247798dSMax Reitz 372247798dSMax Reitz# get standard environment, filters and checks 382247798dSMax Reitz. ./common.rc 392247798dSMax Reitz. ./common.filter 402247798dSMax Reitz 41*dee6ddd8SMax Reitz# Some of these test cases use bochs, but others do use raw, so this 42*dee6ddd8SMax Reitz# is only half a lie. 43*dee6ddd8SMax Reitz_supported_fmt raw 44*dee6ddd8SMax Reitz_supported_proto file 452247798dSMax Reitz_supported_os Linux 462247798dSMax Reitz 472247798dSMax Reitzecho 482247798dSMax Reitzecho '=== Unsupported image creation in qemu-img create ===' 492247798dSMax Reitzecho 502247798dSMax Reitz 51*dee6ddd8SMax Reitz$QEMU_IMG create -f bochs nbd://example.com 2>&1 64M 522247798dSMax Reitz 532247798dSMax Reitzecho 542247798dSMax Reitzecho '=== Unsupported image creation in qemu-img convert ===' 552247798dSMax Reitzecho 562247798dSMax Reitz 572247798dSMax Reitz# We could use any input image format here, but this is a bochs test, so just 582247798dSMax Reitz# use the bochs image 592247798dSMax Reitz_use_sample_img empty.bochs.bz2 60*dee6ddd8SMax Reitz$QEMU_IMG convert -f bochs -O bochs "$TEST_IMG" nbd://example.com 612247798dSMax Reitz 622247798dSMax Reitzecho 632247798dSMax Reitzecho '=== Unsupported format in qemu-img amend ===' 642247798dSMax Reitzecho 652247798dSMax Reitz 66*dee6ddd8SMax ReitzTEST_IMG="$TEST_DIR/t.$IMGFMT" 67*dee6ddd8SMax Reitz_make_test_img 1M 68*dee6ddd8SMax Reitz$QEMU_IMG amend -f $IMGFMT -o size=2M "$TEST_IMG" 2>&1 | _filter_imgfmt 692247798dSMax Reitz 702247798dSMax Reitz# success, all done 712247798dSMax Reitzecho 722247798dSMax Reitzecho '*** done' 732247798dSMax Reitzrm -f $seq.full 742247798dSMax Reitzstatus=0 75