xref: /qemu/tests/qemu-iotests/113 (revision 2247798d13e5295a097da0a42f9d0d70d88690a4)
1*2247798dSMax Reitz#!/bin/bash
2*2247798dSMax Reitz#
3*2247798dSMax Reitz# Test case for accessing creation options on image formats and
4*2247798dSMax Reitz# protocols not supporting image creation
5*2247798dSMax Reitz#
6*2247798dSMax Reitz# Copyright (C) 2014 Red Hat, Inc.
7*2247798dSMax Reitz#
8*2247798dSMax Reitz# This program is free software; you can redistribute it and/or modify
9*2247798dSMax Reitz# it under the terms of the GNU General Public License as published by
10*2247798dSMax Reitz# the Free Software Foundation; either version 2 of the License, or
11*2247798dSMax Reitz# (at your option) any later version.
12*2247798dSMax Reitz#
13*2247798dSMax Reitz# This program is distributed in the hope that it will be useful,
14*2247798dSMax Reitz# but WITHOUT ANY WARRANTY; without even the implied warranty of
15*2247798dSMax Reitz# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16*2247798dSMax Reitz# GNU General Public License for more details.
17*2247798dSMax Reitz#
18*2247798dSMax Reitz# You should have received a copy of the GNU General Public License
19*2247798dSMax Reitz# along with this program.  If not, see <http://www.gnu.org/licenses/>.
20*2247798dSMax Reitz#
21*2247798dSMax Reitz
22*2247798dSMax Reitz# creator
23*2247798dSMax Reitzowner=mreitz@redhat.com
24*2247798dSMax Reitz
25*2247798dSMax Reitzseq="$(basename $0)"
26*2247798dSMax Reitzecho "QA output created by $seq"
27*2247798dSMax Reitz
28*2247798dSMax Reitzhere="$PWD"
29*2247798dSMax Reitztmp=/tmp/$$
30*2247798dSMax Reitzstatus=1	# failure is the default!
31*2247798dSMax Reitz
32*2247798dSMax Reitz_cleanup()
33*2247798dSMax Reitz{
34*2247798dSMax Reitz	_cleanup_test_img
35*2247798dSMax Reitz}
36*2247798dSMax Reitztrap "_cleanup; exit \$status" 0 1 2 3 15
37*2247798dSMax Reitz
38*2247798dSMax Reitz# get standard environment, filters and checks
39*2247798dSMax Reitz. ./common.rc
40*2247798dSMax Reitz. ./common.filter
41*2247798dSMax Reitz
42*2247798dSMax Reitz# We can only test one format here because we need its sample file
43*2247798dSMax Reitz_supported_fmt bochs
44*2247798dSMax Reitz_supported_proto nbd
45*2247798dSMax Reitz_supported_os Linux
46*2247798dSMax Reitz
47*2247798dSMax Reitzecho
48*2247798dSMax Reitzecho '=== Unsupported image creation in qemu-img create ==='
49*2247798dSMax Reitzecho
50*2247798dSMax Reitz
51*2247798dSMax Reitz$QEMU_IMG create -f $IMGFMT nbd://example.com 2>&1 64M | _filter_imgfmt
52*2247798dSMax Reitz
53*2247798dSMax Reitzecho
54*2247798dSMax Reitzecho '=== Unsupported image creation in qemu-img convert ==='
55*2247798dSMax Reitzecho
56*2247798dSMax Reitz
57*2247798dSMax Reitz# We could use any input image format here, but this is a bochs test, so just
58*2247798dSMax Reitz# use the bochs image
59*2247798dSMax Reitz_use_sample_img empty.bochs.bz2
60*2247798dSMax Reitz$QEMU_IMG convert -f $IMGFMT -O $IMGFMT "$TEST_IMG" nbd://example.com 2>&1 \
61*2247798dSMax Reitz    | _filter_imgfmt
62*2247798dSMax Reitz
63*2247798dSMax Reitzecho
64*2247798dSMax Reitzecho '=== Unsupported format in qemu-img amend ==='
65*2247798dSMax Reitzecho
66*2247798dSMax Reitz
67*2247798dSMax Reitz# The protocol does not matter here
68*2247798dSMax Reitz_use_sample_img empty.bochs.bz2
69*2247798dSMax Reitz$QEMU_IMG amend -f $IMGFMT -o foo=bar "$TEST_IMG" 2>&1 | _filter_imgfmt
70*2247798dSMax Reitz
71*2247798dSMax Reitz
72*2247798dSMax Reitz# success, all done
73*2247798dSMax Reitzecho
74*2247798dSMax Reitzecho '*** done'
75*2247798dSMax Reitzrm -f $seq.full
76*2247798dSMax Reitzstatus=0
77