111a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash 29dd003a9SVladimir Sementsov-Ogievskiy# group: rw quick 32247798dSMax Reitz# 42247798dSMax Reitz# Test case for accessing creation options on image formats and 52247798dSMax Reitz# protocols not supporting image creation 62247798dSMax Reitz# 72247798dSMax Reitz# Copyright (C) 2014 Red Hat, Inc. 82247798dSMax Reitz# 92247798dSMax Reitz# This program is free software; you can redistribute it and/or modify 102247798dSMax Reitz# it under the terms of the GNU General Public License as published by 112247798dSMax Reitz# the Free Software Foundation; either version 2 of the License, or 122247798dSMax Reitz# (at your option) any later version. 132247798dSMax Reitz# 142247798dSMax Reitz# This program is distributed in the hope that it will be useful, 152247798dSMax Reitz# but WITHOUT ANY WARRANTY; without even the implied warranty of 162247798dSMax Reitz# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 172247798dSMax Reitz# GNU General Public License for more details. 182247798dSMax Reitz# 192247798dSMax Reitz# You should have received a copy of the GNU General Public License 202247798dSMax Reitz# along with this program. If not, see <http://www.gnu.org/licenses/>. 212247798dSMax Reitz# 222247798dSMax Reitz 232247798dSMax Reitz# creator 24*42a5009dSJohn Snowowner=hreitz@redhat.com 252247798dSMax Reitz 262247798dSMax Reitzseq="$(basename $0)" 272247798dSMax Reitzecho "QA output created by $seq" 282247798dSMax Reitz 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 415fc2b4f2SVladimir Sementsov-Ogievskiy# Some of these test cases use bochs, but others do use raw 425fc2b4f2SVladimir Sementsov-Ogievskiy_require_drivers bochs 43dee6ddd8SMax Reitz_supported_fmt raw 44dee6ddd8SMax 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 51dee6ddd8SMax 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 60dee6ddd8SMax 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 66dee6ddd8SMax ReitzTEST_IMG="$TEST_DIR/t.$IMGFMT" 67dee6ddd8SMax Reitz_make_test_img 1M 68dee6ddd8SMax 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